Coder Social home page Coder Social logo

cocoapods-project-gen's Introduction

cocoapods-project-gen

License MIT 

A gem which can gen cocoapods project.

Installation

Add this line to your application's Gemfile:

gem 'cocoapods-project-gen'

And then execute:

# bundle install
$ bundle install

Or install it yourself as:

# gem install
$ gem install cocoapods-project-gen

Quickstart

To begin gen an cocoapods project by opening an podpsec dir, and to your command line with:

xcframework gen 

or

xcframework gen --output-dir=<xcframework output dir>
xcframework gen --output-dir=<xcframework output dir> **.podspec

To begin gen an cocoapods project start by create an ProjectGenerator:

podspecs = [**.podspec]
ProjectGen::Command.run(['gen', "--output-dir=#{File.expand_path('./Resources/output', __dir__)}", *podspecs])

or to build for xcframework use this way:

require 'cocoapods-project-gen'

product_type = :dynamic_framework
use_module = true
external_podspecs = []
swift_version = '4.2'
configuration = :release
output_dir = <output dir>
generator = ProjectGen::ProjectGenerator.new(include_podspecs.first, @sources, @platforms)
generator.local = false
generator.no_clean       = false
generator.allow_warnings = true
generator.only_subspec   = %w[AFNetworking/UIKit AFNetworking/Reachability]
generator.use_frameworks = product_type == :dynamic_framework
generator.use_static_frameworks = product_type == :framework
generator.use_modular_headers = use_module
generator.external_podspecs = external_podspecs.drop(1)
generator.swift_version = swift_version
generator.configuration = configuration
# xcframework gen
xc_gen = ProjectGen::XcframeworkGen.new(generator)
xc_gen.generate_xcframework(output_dir, build_library_for_distribution: true)

local or no local:

require 'cocoapods-project-gen'
podspecs = Pathname.glob(File.expand_path('./Resources/Specs', __dir__) + '/*.podspec{.json,}')
local_podspecs = Pathname.glob(File.expand_path('./Resources/Specs/local/**', __dir__) + '/*.podspec{.json,}').join(',')
no_local_podspecs = Pathname.glob(File.expand_path('./Resources/Specs/no_local/', __dir__) + '**/*.podspec{.json,}').join(',')
out_put = File.expand_path('./Resources/output', __dir__)
vs = ProjectGen::Command.run(['gen', '--use-libraries', '--build-library-for-distribution', '--sources=https://github.com/CocoaPods/Specs.git', *podspecs, "--include-podspecs=#{local_podspecs}", "--external-podspecs=#{no_local_podspecs}", "--output-dir=#{out_put}"])

other options:

['--no-build', 'Is or is not to build xcframework'],
['--build-library-for-distribution', ' Enables BUILD_LIBRARY_FOR_DISTRIBUTION'],
['--use-latest', 'When multiple dependencies with different sources, use latest.'],
['--local', 'podpsecs is local or not'],
['--output-dir=/project/dir/', 'Gen output dir'],
['--allow-warnings', 'Gen even if warnings are present'],
['--subspecs=NAME/NAME', 'Gen only the given subspecs'],
['--no-clean', 'Gen leaves the build directory intact for inspection'],
['--use-libraries', 'Gen uses static libraries to install the spec'],
['--use-modular-headers', 'Gen uses modular headers during installation'],
['--use-static-frameworks', 'Gen uses static frameworks during installation'],
["--sources=#{Pod::TrunkSource::TRUNK_REPO_URL}", 'The sources from which to pull dependent pods ' \
"(defaults to #{Pod::TrunkSource::TRUNK_REPO_URL}). Multiple sources must be comma-delimited"],
['--platforms=ios,macos', 'Gen against specific platforms (defaults to all platforms supported by the ' \
'podspec). Multiple platforms must be comma-delimited'],
['--swift-version=VERSION', 'The `SWIFT_VERSION` that should be used to gen the spec. ' \
'This takes precedence over the Swift versions specified by the spec or a `.swift-version` file'],
['--include-podspecs=**/*.podspec', 'Additional ancillary podspecs which are used for gening via :path'],
['--external-podspecs=**/*.podspec', 'Additional ancillary podspecs which are used for gening '\
'via :podspec. If there are --include-podspecs, then these are removed from them'],
['--configuration=CONFIGURATION', 'Build using the given configuration (defaults to Release)']

Command Line Tool

Installing the cocoapods-project-gen gem will also install one command-line tool xcframework gen which you can use to generate xcframework from podspec.

For more information consult

  • xcframework --help
  • xcframework gen --help

Contributing

Bug reports and pull requests are welcome on GitHub at cocoapods-project-gen. This project is intended to be a safe, welcoming space for collaboration.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the yaml-vfs project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

cocoapods-project-gen's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

cocoapods-project-gen's Issues

undefined method `relative_path_from' for nil:NilClass

Hello teacher, when i use Ruby3.0.0, execute “xcframework gen”.
Error:
.rvm/gems/ruby-3.0.0/gems/cocoapods-project-gen-0.2.3/lib/cocoapods-project-gen/gen/product.rb:155:in block in add_file_accessors_paths_to_products_group': undefined method relative_path_from' for nil:NilClass (NoMethodError)

How to use cocoapods-project-gen in Ruby3.0.0?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.