Skip to content
This repository has been archived by the owner on Nov 14, 2020. It is now read-only.

acecilia/SpecGen

Repository files navigation

SpecGen

SpecGen is a command line tool for generating podspec files from frameworks, so they can be used in a CocoaPods setup.

  • 🔥 Generates .podspec files from .framework files
  • 🔥 Carthage compatibility, so the generated .podspec files contain the version specified in the Carfile.resolved (effectively delegating to Carthage the dependency resolution)
  • 🔥 Use CocoaPods and Carthage together, allowing pods to depend on frameworks installed by Carthage
  • 🔥 Massively reduce build times by substituting source code pods with their .framework

Installing

mint install acecilia/specgen

Make

git clone https://github.com/acecilia/specgen.git
cd SpecGen
make

Usage (with Carthage)

  1. Tell SpecGen which .podspec files to generate by customizing your Cartfile:

    github "SwiftKickMobile/SwiftMessages" == 5.0.1
    
    # specgen:start
    github "hackiftekhar/IQKeyboardManager" == 6.2 # specgen:frameworks IQKeyboardManager IQKeyboardManagerSwift
    github "madebybowtie/FlagKit" == 2.2
    
  2. Generate the .podspec files:

    specgen bootstrap
  3. Integrate the .podspec files in your Podfile:

load '<path_to_frameworks>/Podfile' # <==============
target 'MyApp' do
    autogenerated_pods # <==============
    pod 'Alamofire', '~> 3.0'
end

Advanced usage

Generate .podspec files

If you are using Carthage (by default specgen looks for the frameworks under Carthage/Build/iOS), simply run:

specgen bootstrap

If not, you have to specify the path containing the frameworks:

specgen bootstrap --frameworksPath <path_to_frameworks>

This will generate the necessary .podspec files next to the frameworks.

To see all the possible options, run:

specgen --help

Integrate the .podspec files in your Podfile

You have two options:

  • Using the autogenerated Podfile:

    load '<path_to_frameworks>/Podfile' # <==============
    target 'MyApp' do
        autogenerated_pods # <==============
        pod 'Alamofire', '~> 3.0'
    end
  • Not using the autogenerated Podfile: point each pod to the local path containing the .podspec file:

    target 'MyApp' do
        pod 'FlagKit', :path => '<path_to_frameworks>'
        pod 'IQKeyboardManager', :path => '<path_to_frameworks>'
        pod 'IQKeyboardManagerSwift', :path => '<path_to_frameworks>'
        pod 'NVActivityIndicatorView', :path => '<path_to_frameworks>'
        pod 'NVActivityIndicatorViewAppExtension', :path => '<path_to_frameworks>'
        pod 'Result', :path => '<path_to_frameworks>'
        pod 'SideMenu', :path => '<path_to_frameworks>'
        pod 'SnapKit', :path => '<path_to_frameworks>'
        pod 'SwiftMessages', :path => '<path_to_frameworks>'
        pod 'Alamofire', '~> 3.0'
    end

Use a Cartfile to customize which .podspec files to generate:

it is possible to add comments to a Cartfile in order to specify which of the frameworks requires a .podspec. Take the following Cartfile as an example:

github "SwiftKickMobile/SwiftMessages" == 5.0.1

# specgen:start
github "hackiftekhar/IQKeyboardManager" == 6.2 # specgen:frameworks IQKeyboardManager IQKeyboardManagerSwift
github "madebybowtie/FlagKit" == 2.2

SpecGen will generate .podspec files for three frameworks:

  • IQKeyboardManager, with version 6.2
  • IQKeyboardManagerSwift, with version 6.2
  • FlagKit, with version 2.2

This allows to add some frameworks in your project by following the official Carthage method, and some others through CocoaPods, using the .podspec files generated by SpecGen.

License

SpecGen is licensed under the MIT license. See LICENSE for more info.

About

A command line tool for generating podspec files from frameworks, so they can be used in a CocoaPods setup

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published