Pod private warehouse building

 Pod private warehouse building

  1. Create a `private warehouse index Library` (iOS)
  2. Adding `` private warehouse index database to manage local repo
  3. Create your own `the formation of the library project
  4. Upload `` library project to set up `` private warehouse index Library
  5. App project calls `` the formation of the library project

 

purpose

Private library management, engineering is used to simplify the code structure to achieve code reuse and project management programs, almost every company has its own private warehouse component of project management.

1. Create a `` private warehouse index Library

description

  • `Private warehouse index database is managed by the various versions of the component library. We here can be understood as an empty git repository, the following can be understood separately from the name of district
  • Private Library: refers to the place where we actually place the assembly code.
  • Index Library: a place to store the spec file, the code used to index into position.

 

Figuratively, the index database is like a pointer, like a private library object pointer stored in the address of the object, the object can be found in the address! (You can manage any components warehouse)

create

Free to create an empty warehouse can be on their gitlab or github, as in my own case for the warehouse address:

 

https://gitlab.rokid-inc.com/kingbo/iOS.git

2. Add `` private warehouse index database to manage local repo

1.cocoapods local repository path

~ / .Cocoapods / rest

2. Add a remote index your local library 

// Note here git repository name and the name on consistent (inconsistent seems finally can not find private libraries, as follows: iOS is the name of the warehouse) 
 POD repo the Add iOS HTTPS: //gitlab.rokid-inc.com/kingbo/iOS. git

At this time, the directory structure is as follows:

. 
└── Repos 
    ├── Master 
    └── iOS // this is our own local repository of maps 

In fact, there have been private warehouse and our gitlab established a relationship, when you add components later, will push directly to our git repository

 

3. Create your own library project set up ``

Set up here can be any library, the following test preparation, so I am ready for the name: `RokidToolsKitTest`

3.1 gitlab warehouse building name

 

Create a `RokidToolsKitTest` warehouse in gitlab above, here's my address as follows:

https://gitlab.rokid-inc.com/lingbo.jin/RokidToolsKitTest.git

Remote code clone would not have said to the local

3.2 gitignore file creation

In addition, we need to note that, due to the need to manage the engineering components inside the pod file something, we need to create a hidden file named `.gitignore` in this warehouse with the directory (hidden files)

3.3 CHANGELOG.md file creation (negligible)

Because components of the project also involves versioned, so this file is recorded iterative function changes for each component 

3.4 pod pod command to create local projects

 pod lib create  RokidToolsKitTest

Execute the above command line, and then select the dialog box depending on the circumstances, we will create a final assembly works (including `podspec` configuration file there are many, here is not to write)

3.5 link associated with the local and remote warehouse warehouse 

git remote add origin  https://gitlab.rokid-inc.com/lingbo.jin/RokidToolsKitTest.git

 

(Finished writing your own code, and finally submitted directly to the warehouse gitlab good, not one by one to write business logic)

 

 3.6 Changing podspec file information

Development needs to be created podspec file after the completion of the following format:

:: Spec.new do POD | S | 

  s.name              = ' RokidToolsKitTest ' 

  s.version           = ' 0.1.0 ' 

  s.summary           = ' RokidToolsKitTest ' 

  s.swift_version     = ' 4.0 '  # I have here is swift verification is not the time to write An error occurs 

  s.description       = << - DESC 

   here is a description, by our own set up to write specific business 

                       DESC 

  s.homepage          = ' https://gitlab.rokid-inc.com/lingbo.jin/RokidToolsKitTest ' 

  S .license           = {: type =>'MIT', :file => 'LICENSE' }

  s.author           = { 'jinlingbo' => '[email protected]' }

  s.source           = { :git => 'https://gitlab.rokid-inc.com/lingbo.jin/RokidToolsKitTest.git', :tag => s.version.to_s }

  s.ios.deployment_target = '8.0'

  s.source_files = 'RokidToolsKitTest/Classes/**/*'

end

 

4. Upload the `` library project to set up `` private warehouse index Library

The need to publish our own warehouse lib after development is completed, the following specific procedures 

 4.1 verify the spec file

In fact, after we finished own library, you need to verify that your library compile, and therefore needs to be verified before submitting next

  # Cd to keep in touch with the current directory and files in the same directory podspec 

 POD lib lint - Private

  // If there are multiple source files, such as its private bank address, you can add - Source, as follows 

 POD lib lint --private - -sources = https: //github.com/CocoaPods/Specs.git,https: //gitlab.rokid-inc.com/kingbo/iOS.git

Version 4.2 to make a branch

After verification by the need to fight for a version tag  

Here's 0.1 .0 version to be consistent with the spec file 

$ git Tag 0.1 0.05 

$ git the Push   the --tags

### to publish the current version 4.3

// execution uploaded to a private warehouse, in step 2, we have linked the `iOS` the warehouse address, it will push after push here directly into our git repository 

pod repo push iOS RokidToolsKitTest.podspec

 

5, App project calls `` the formation of the library project

If all goes well you can directly call set up, using the same methods and the use of other libraries

 

Source ' https://github.com/CocoaPods/Specs.git ' 
Source ' https://gitlab.rokid-inc.com/kingbo/iOS.git '  # Remember to add your own private repository indexes in the project   

target ' RokidToolsKitTest_Example ' do 
    POD ' RokidToolsKitTest ' , ' 0.1.0 ' 
    POD ' SVProgressHUD ' , ' ~> 2.2.5 ' 
   target ' RokidToolsKitTest_Tests ' do 
    the inherit:! search_paths 
  End 

End

 

 to sum up

Here, roughly the private warehouse processes has been completed, then we think about how to solve, private library will be packaged into a framework and opening to the outside. . . . Follow this topic continues.

 [References]

http://www.cocoachina.com/ios/20180511/23359.html

 

Guess you like

Origin www.cnblogs.com/kingbo/p/11455043.html