podspec 공개 라이브러리 만들기

6115 단어

정의


개인pod: 회사의 서버를 통해 코드 창고로 저장된pod는 상응하는 권한을 분배받은 사람(일반적으로 회사 내부 직원)을 제외한 다른 사람이 이pod에 접근할 수 없다는 것을 개인적으로 이해합니다.구성 요소화 개발에서 개인적인pod를 구성 요소로 합니다.
공공pod: 공개된pod, 예를 들어 자주 사용하는github에서pod를 지원하는 라이브러리는 누구든지 접근할 수 있습니다.

기본 단계

1、  
2、 clone , 
3、 podspec : `pod spec create podName`
4、 podspec (pod lib lint: 、pod spec lint: )
5、 tag, podspec
6、 repo, pod search pod 

podspec 만들기 및 편집


cd는 로컬 프로젝트 디렉터리에 가서 실행합니다pod spec create podName .이때 로컬에podName이 생성됩니다.podspec 파일.편집기로 이 파일을 열면 podspec을 설명하는 필드가 많습니다. 간단한 사용법만 소개합니다. 더 많은 필드를 보려면 이동하십시오.http://guides.cocoapods.org/syntax/podspec.html
#
#  Be sure to run `pod spec lint AA.podspec' to ensure this is a
#  valid spec and to remove all comments including this before submitting the spec.
#
#  To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
#  To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
#

Pod::Spec.new do |s|

  # ―――  Spec Metadata  ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  These will help people to find your library, and whilst it
  #  can feel like a chore to fill in it's definitely to your advantage. The
  #  summary should be tweet-length, and the description more in depth.
  #

  s.name         = "AA"
  s.version      = "0.0.1"
  s.summary      = "A short description of AA."

  # This description is used to generate tags and improve search results.
  #   * Think: What does it do? Why did you write it? What is the focus?
  #   * Try to keep it short, snappy and to the point.
  #   * Write the description between the DESC delimiters below.
  #   * Finally, don't worry about the indent, CocoaPods strips it!
  s.description  = < "MIT", :file => "FILE_LICENSE" }


  # ――― Author Metadata  ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  Specify the authors of the library, with email addresses. Email addresses
  #  of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also
  #  accepts just a name if you'd rather not provide an email address.
  #
  #  Specify a social_media_url where others can refer to, for example a twitter
  #  profile URL.
  #

  s.author             = { "lixp" => "[email protected]" }
  # Or just: s.author    = "lixp"
  # s.authors            = { "lixp" => "[email protected]" }
  # s.social_media_url   = "http://twitter.com/lixp"

  # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  If this Pod runs only on iOS or OS X, then specify the platform and
  #  the deployment target. You can optionally include the target after the platform.
  #

  # s.platform     = :ios
  # s.platform     = :ios, "5.0"

  #  When using multiple platforms
  # s.ios.deployment_target = "5.0"
  # s.osx.deployment_target = "10.7"
  # s.watchos.deployment_target = "2.0"
  # s.tvos.deployment_target = "9.0"


  # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  Specify the location from where the source should be retrieved.
  #  Supports git, hg, bzr, svn and HTTP.
  #

  s.source       = { :git => "http://EXAMPLE/AA.git", :tag => "#{s.version}" }


  # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  CocoaPods is smart about how it includes source code. For source files
  #  giving a folder will include any swift, h, m, mm, c & cpp files.
  #  For header files it will include any header in the folder.
  #  Not including the public_header_files will make all headers public.
  #

  s.source_files  = "Classes", "Classes/**/*.{h,m}"
  s.exclude_files = "Classes/Exclude"

  # s.public_header_files = "Classes/**/*.h"


  # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  A list of resources included with the Pod. These are copied into the
  #  target bundle with a build phase script. Anything else will be cleaned.
  #  You can preserve files from being cleaned, please don't preserve
  #  non-essential files like tests, examples and documentation.
  #

  # s.resource  = "icon.png"
  # s.resources = "Resources/*.png"

  # s.preserve_paths = "FilesToSave", "MoreFilesToSave"


  # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  Link your library with frameworks, or libraries. Libraries do not include
  #  the lib prefix of their name.
  #

  # s.framework  = "SomeFramework"
  # s.frameworks = "SomeFramework", "AnotherFramework"

  # s.library   = "iconv"
  # s.libraries = "iconv", "xml2"


  # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  If your library depends on compiler flags you can set them in the xcconfig hash
  #  where they will only apply to your library. If you depend on other Podspecs
  #  you can include multiple dependencies to ensure it works.

  # s.requires_arc = true

  # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
  # s.dependency "JSONKit", "~> 1.4"

end

podspec 파일 검증


명령을 집행하다pod lib lint 현지 검사를 진행한다.
처음 사용하는 경우 먼저 등록해야 합니다.pod trunk register [email protected] 'yourName'
등록 성공 여부를 확인합니다pod trunk me
검증pod lib lint

태그,podspec 올리기

git tag -m"first release iOS_Category with podspec" "0.0.1"
git push --tags

push

pod trunk push podName.podspec pod repo push xyj-xyjpodspec【 】 XYJBaseUI.podspec【podspec 】 --allow-warnings[ ]

로컬 repo 업데이트

pod repo update
그리고 돼요.45, 6, 7, 914.

좋은 웹페이지 즐겨찾기