cocoapods-bindyf 0.1.29.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +104 -0
- data/LICENSE.txt +22 -0
- data/README.md +567 -0
- data/Rakefile +13 -0
- data/cocoapods-bin.gemspec +27 -0
- data/cocoapods-bindyf-0.1.29.2.gem +0 -0
- data/debug_install.sh +8 -0
- data/lib/cocoapods-bin.rb +4 -0
- data/lib/cocoapods-bin/command.rb +3 -0
- data/lib/cocoapods-bin/command/bin.rb +60 -0
- data/lib/cocoapods-bin/command/bin/archive.rb +130 -0
- data/lib/cocoapods-bin/command/bin/init.rb +71 -0
- data/lib/cocoapods-bin/command/bin/lib.rb +14 -0
- data/lib/cocoapods-bin/command/bin/lib/lint.rb +69 -0
- data/lib/cocoapods-bin/command/bin/list.rb +50 -0
- data/lib/cocoapods-bin/command/bin/open.rb +61 -0
- data/lib/cocoapods-bin/command/bin/repo.rb +15 -0
- data/lib/cocoapods-bin/command/bin/repo/push.rb +124 -0
- data/lib/cocoapods-bin/command/bin/repo/update.rb +42 -0
- data/lib/cocoapods-bin/command/bin/search.rb +69 -0
- data/lib/cocoapods-bin/command/bin/spec.rb +15 -0
- data/lib/cocoapods-bin/command/bin/spec/create.rb +75 -0
- data/lib/cocoapods-bin/command/bin/spec/lint.rb +119 -0
- data/lib/cocoapods-bin/command/bin/umbrella.rb +55 -0
- data/lib/cocoapods-bin/config/config.rb +80 -0
- data/lib/cocoapods-bin/config/config_asker.rb +58 -0
- data/lib/cocoapods-bin/gem_version.rb +11 -0
- data/lib/cocoapods-bin/helpers.rb +5 -0
- data/lib/cocoapods-bin/helpers/framework.rb +66 -0
- data/lib/cocoapods-bin/helpers/framework_builder.rb +190 -0
- data/lib/cocoapods-bin/helpers/sources_helper.rb +33 -0
- data/lib/cocoapods-bin/helpers/spec_creator.rb +147 -0
- data/lib/cocoapods-bin/helpers/spec_files_helper.rb +77 -0
- data/lib/cocoapods-bin/native.rb +20 -0
- data/lib/cocoapods-bin/native/acknowledgements.rb +27 -0
- data/lib/cocoapods-bin/native/analyzer.rb +53 -0
- data/lib/cocoapods-bin/native/installation_options.rb +26 -0
- data/lib/cocoapods-bin/native/installer.rb +115 -0
- data/lib/cocoapods-bin/native/linter.rb +26 -0
- data/lib/cocoapods-bin/native/path_source.rb +33 -0
- data/lib/cocoapods-bin/native/pod_source_installer.rb +19 -0
- data/lib/cocoapods-bin/native/podfile.rb +79 -0
- data/lib/cocoapods-bin/native/podfile_env.rb +36 -0
- data/lib/cocoapods-bin/native/podspec_finder.rb +25 -0
- data/lib/cocoapods-bin/native/resolver.rb +199 -0
- data/lib/cocoapods-bin/native/sandbox_analyzer.rb +34 -0
- data/lib/cocoapods-bin/native/source.rb +35 -0
- data/lib/cocoapods-bin/native/sources_manager.rb +20 -0
- data/lib/cocoapods-bin/native/specification.rb +31 -0
- data/lib/cocoapods-bin/native/validator.rb +16 -0
- data/lib/cocoapods-bin/source_provider_hook.rb +39 -0
- data/lib/cocoapods_plugin.rb +5 -0
- data/spec/command/bin_spec.rb +12 -0
- data/spec/spec_helper.rb +50 -0
- metadata +173 -0
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cocoapods-bin/gem_version.rb'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'cocoapods-bindyf'
|
8
|
+
spec.version = CBin::VERSION
|
9
|
+
spec.authors = ['tripleCC']
|
10
|
+
spec.email = ['triplec.linux@gmail.com']
|
11
|
+
spec.description = %q{cocoapods-bin is a plugin which helps develpers switching pods between source code and binary.}
|
12
|
+
spec.summary = %q{cocoapods-bin is a plugin which helps develpers switching pods between source code and binary.}
|
13
|
+
spec.homepage = 'https://github.com/doge1024/cocoapods-bin-framework'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_dependency 'parallel'
|
22
|
+
spec.add_dependency 'cocoapods', '~> 1.8.4'
|
23
|
+
spec.add_dependency 'cocoapods-generate', '~> 1.6.0'
|
24
|
+
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
26
|
+
spec.add_development_dependency 'rake'
|
27
|
+
end
|
Binary file
|
data/debug_install.sh
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'cocoapods-bin/command/bin/init'
|
4
|
+
require 'cocoapods-bin/command/bin/spec'
|
5
|
+
require 'cocoapods-bin/command/bin/lib'
|
6
|
+
require 'cocoapods-bin/command/bin/repo'
|
7
|
+
require 'cocoapods-bin/command/bin/open'
|
8
|
+
require 'cocoapods-bin/command/bin/search'
|
9
|
+
require 'cocoapods-bin/command/bin/list'
|
10
|
+
require 'cocoapods-bin/command/bin/archive'
|
11
|
+
require 'cocoapods-bin/command/bin/umbrella'
|
12
|
+
require 'cocoapods-bin/helpers'
|
13
|
+
|
14
|
+
module Pod
|
15
|
+
class Command
|
16
|
+
# This is an example of a cocoapods plugin adding a top-level subcommand
|
17
|
+
# to the 'pod' command.
|
18
|
+
#
|
19
|
+
# You can also create subcommands of existing or new commands. Say you
|
20
|
+
# wanted to add a subcommand to `list` to show newly deprecated pods,
|
21
|
+
# (e.g. `pod list deprecated`), there are a few things that would need
|
22
|
+
# to change.
|
23
|
+
#
|
24
|
+
# - move this file to `lib/pod/command/list/deprecated.rb` and update
|
25
|
+
# the class to exist in the the Pod::Command::List namespace
|
26
|
+
# - change this class to extend from `List` instead of `Command`. This
|
27
|
+
# tells the plugin system that it is a subcommand of `list`.
|
28
|
+
# - edit `lib/cocoapods_plugins.rb` to require this file
|
29
|
+
#
|
30
|
+
# @todo Create a PR to add your plugin to CocoaPods/cocoapods.org
|
31
|
+
# in the `plugins.json` file, once your plugin is released.
|
32
|
+
#
|
33
|
+
class Bin < Command
|
34
|
+
include CBin::SourcesHelper
|
35
|
+
include CBin::SpecFilesHelper
|
36
|
+
|
37
|
+
self.abstract_command = true
|
38
|
+
|
39
|
+
self.default_subcommand = 'open'
|
40
|
+
self.summary = '组件二进制化插件.'
|
41
|
+
self.description = <<-DESC
|
42
|
+
组件二进制化插件。利用源码私有源与二进制私有源实现对组件依赖类型的切换。
|
43
|
+
DESC
|
44
|
+
|
45
|
+
def initialize(argv)
|
46
|
+
require 'cocoapods-bin/native'
|
47
|
+
|
48
|
+
@help = argv.flag?('help')
|
49
|
+
super
|
50
|
+
end
|
51
|
+
|
52
|
+
def validate!
|
53
|
+
super
|
54
|
+
# 这里由于 --help 是在 validate! 方法中提取的,会导致 --help 失效
|
55
|
+
# pod lib create 也有这个问题
|
56
|
+
banner! if @help
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,130 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'cocoapods-bin/native/podfile'
|
4
|
+
require 'cocoapods/command/gen'
|
5
|
+
require 'cocoapods/generate'
|
6
|
+
require 'cocoapods-bin/helpers/framework_builder'
|
7
|
+
|
8
|
+
module Pod
|
9
|
+
class Command
|
10
|
+
class Bin < Command
|
11
|
+
class Archive < Bin
|
12
|
+
self.summary = '将组件归档为静态 framework.'
|
13
|
+
self.description = <<-DESC
|
14
|
+
将组件归档为静态 framework,仅支持 iOS 平台
|
15
|
+
此静态 framework 不包含依赖组件的 symbol
|
16
|
+
DESC
|
17
|
+
|
18
|
+
def self.options
|
19
|
+
[
|
20
|
+
['--code-dependencies', '使用源码依赖'],
|
21
|
+
['--allow-prerelease', '允许使用 prerelease 的版本'],
|
22
|
+
['--no-clean', '保留构建中间产物'],
|
23
|
+
['--no-zip', '不压缩静态 framework 为 zip']
|
24
|
+
].concat(Pod::Command::Gen.options).concat(super).uniq
|
25
|
+
end
|
26
|
+
|
27
|
+
self.arguments = [
|
28
|
+
CLAide::Argument.new('NAME.podspec', false)
|
29
|
+
]
|
30
|
+
|
31
|
+
def initialize(argv)
|
32
|
+
@code_dependencies = argv.flag?('code-dependencies')
|
33
|
+
@allow_prerelease = argv.flag?('allow-prerelease')
|
34
|
+
@clean = argv.flag?('clean', true)
|
35
|
+
@zip = argv.flag?('zip', true)
|
36
|
+
@sources = argv.option('sources') || []
|
37
|
+
@platform = Platform.new(:ios)
|
38
|
+
super
|
39
|
+
@podspec = argv.shift_argument
|
40
|
+
@additional_args = argv.remainder!
|
41
|
+
end
|
42
|
+
|
43
|
+
def run
|
44
|
+
@spec = Specification.from_file(spec_file)
|
45
|
+
generate_project
|
46
|
+
build_static_framework
|
47
|
+
zip_static_framework if @zip
|
48
|
+
clean_workspace if @clean
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def generate_project
|
54
|
+
Podfile.execute_with_bin_plugin do
|
55
|
+
Podfile.execute_with_allow_prerelease(@allow_prerelease) do
|
56
|
+
Podfile.execute_with_use_binaries(!@code_dependencies) do
|
57
|
+
argvs = [
|
58
|
+
"--sources=#{sources_option(@code_dependencies, @sources)}",
|
59
|
+
"--gen-directory=#{gen_name}",
|
60
|
+
'--clean',
|
61
|
+
*@additional_args
|
62
|
+
]
|
63
|
+
|
64
|
+
argvs << spec_file if spec_file
|
65
|
+
|
66
|
+
gen = Pod::Command::Gen.new(CLAide::ARGV.new(argvs))
|
67
|
+
gen.validate!
|
68
|
+
gen.run
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def zip_static_framework
|
75
|
+
output_name = "#{framework_name}.zip"
|
76
|
+
unless File.exist?(framework_name)
|
77
|
+
raise Informative, "没有需要压缩的 framework 文件:#{framework_name}"
|
78
|
+
end
|
79
|
+
|
80
|
+
UI.puts "Compressing #{framework_name} into #{output_name}"
|
81
|
+
|
82
|
+
`zip --symlinks -r #{output_name} #{framework_name}`
|
83
|
+
end
|
84
|
+
|
85
|
+
def build_static_framework
|
86
|
+
source_dir = Dir.pwd
|
87
|
+
file_accessor = Sandbox::FileAccessor.new(Pathname.new('.').expand_path, @spec.consumer(@platform))
|
88
|
+
Dir.chdir(workspace_directory) do
|
89
|
+
builder = CBin::Framework::Builder.new(@spec, file_accessor, @platform, source_dir)
|
90
|
+
builder.build
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def clean_workspace
|
95
|
+
UI.puts 'Cleaning workspace'
|
96
|
+
|
97
|
+
FileUtils.rm_rf(gen_name)
|
98
|
+
FileUtils.rm_rf(framework_name) if @zip
|
99
|
+
end
|
100
|
+
|
101
|
+
def gen_name
|
102
|
+
'bin-archive'
|
103
|
+
end
|
104
|
+
|
105
|
+
def framework_name
|
106
|
+
"#{@spec.name}.framework"
|
107
|
+
end
|
108
|
+
|
109
|
+
def workspace_directory
|
110
|
+
File.expand_path("./#{gen_name}/#{@spec.name}")
|
111
|
+
end
|
112
|
+
|
113
|
+
def spec_file
|
114
|
+
@spec_file ||= begin
|
115
|
+
if @podspec
|
116
|
+
find_spec_file(@podspec)
|
117
|
+
else
|
118
|
+
if code_spec_files.empty?
|
119
|
+
raise Informative, '当前目录下没有找到可用源码 podspec.'
|
120
|
+
end
|
121
|
+
|
122
|
+
spec_file = code_spec_files.first
|
123
|
+
spec_file
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'cocoapods-bin/config/config_asker'
|
4
|
+
|
5
|
+
module Pod
|
6
|
+
class Command
|
7
|
+
class Bin < Command
|
8
|
+
class Init < Bin
|
9
|
+
self.summary = '初始化插件.'
|
10
|
+
self.description = <<-DESC
|
11
|
+
创建 #{CBin.config.config_file} 文件,在其中保存插件需要的配置信息,
|
12
|
+
如二进制私有源地址、源码私有源地址等。
|
13
|
+
DESC
|
14
|
+
|
15
|
+
def self.options
|
16
|
+
[
|
17
|
+
['--bin-url=URL', '配置文件地址,直接从此地址下载配置文件']
|
18
|
+
].concat(super)
|
19
|
+
end
|
20
|
+
|
21
|
+
def initialize(argv)
|
22
|
+
@bin_url = argv.option('bin-url')
|
23
|
+
super
|
24
|
+
end
|
25
|
+
|
26
|
+
def run
|
27
|
+
if @bin_url.nil?
|
28
|
+
config_with_asker
|
29
|
+
else
|
30
|
+
config_with_url(@bin_url)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def config_with_url(url)
|
37
|
+
require 'open-uri'
|
38
|
+
|
39
|
+
UI.puts "开始下载配置文件...\n"
|
40
|
+
file = open(url)
|
41
|
+
contents = YAML.safe_load(file.read)
|
42
|
+
|
43
|
+
UI.puts "开始同步配置文件...\n"
|
44
|
+
CBin.config.sync_config(contents.to_hash)
|
45
|
+
UI.puts "设置完成.\n".green
|
46
|
+
rescue Errno::ENOENT => e
|
47
|
+
raise Informative, "配置文件路径 #{url} 无效,请确认后重试."
|
48
|
+
end
|
49
|
+
|
50
|
+
def config_with_asker
|
51
|
+
asker = CBin::Config::Asker.new
|
52
|
+
asker.wellcome_message
|
53
|
+
|
54
|
+
config = {}
|
55
|
+
template_hash = CBin.config.template_hash
|
56
|
+
template_hash.each do |k, v|
|
57
|
+
default = begin
|
58
|
+
CBin.config.send(k)
|
59
|
+
rescue StandardError
|
60
|
+
nil
|
61
|
+
end
|
62
|
+
config[k] = asker.ask_with_answer(v[:description], default, v[:selection])
|
63
|
+
end
|
64
|
+
|
65
|
+
CBin.config.sync_config(config)
|
66
|
+
asker.done_message
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'cocoapods-bin/config/config'
|
4
|
+
require 'cocoapods-bin/native/podfile'
|
5
|
+
|
6
|
+
module Pod
|
7
|
+
class Command
|
8
|
+
class Bin < Command
|
9
|
+
class Lib < Bin
|
10
|
+
class Lint < Lib
|
11
|
+
self.summary = 'lint 组件.'
|
12
|
+
self.description = <<-DESC
|
13
|
+
lint 二进制组件 / 源码组件
|
14
|
+
DESC
|
15
|
+
|
16
|
+
self.arguments = [
|
17
|
+
CLAide::Argument.new('NAME.podspec', false)
|
18
|
+
]
|
19
|
+
|
20
|
+
# lib lint 不会下载 source,所以不能进行二进制 lint
|
21
|
+
# 要 lint 二进制版本,需要进行 spec lint,此 lint 会去下载 source
|
22
|
+
def self.options
|
23
|
+
[
|
24
|
+
['--code-dependencies', '使用源码依赖进行 lint'],
|
25
|
+
['--loose-options', '添加宽松的 options, 包括 --use-libraries (可能会造成 entry point (start) undefined)'],
|
26
|
+
['--allow-prerelease', '允许使用 prerelease 的版本 lint']
|
27
|
+
].concat(Pod::Command::Lib::Lint.options).concat(super).uniq
|
28
|
+
end
|
29
|
+
|
30
|
+
def initialize(argv)
|
31
|
+
@loose_options = argv.flag?('loose-options')
|
32
|
+
@code_dependencies = argv.flag?('code-dependencies')
|
33
|
+
@sources = argv.option('sources') || []
|
34
|
+
@allow_prerelease = argv.flag?('allow-prerelease')
|
35
|
+
@podspec = argv.shift_argument
|
36
|
+
super
|
37
|
+
|
38
|
+
@additional_args = argv.remainder!
|
39
|
+
end
|
40
|
+
|
41
|
+
def run
|
42
|
+
Podfile.execute_with_bin_plugin do
|
43
|
+
Podfile.execute_with_allow_prerelease(@allow_prerelease) do
|
44
|
+
Podfile.execute_with_use_binaries(!@code_dependencies) do
|
45
|
+
argvs = [
|
46
|
+
@podspec || code_spec_files.first,
|
47
|
+
"--sources=#{sources_option(@code_dependencies, @sources)}",
|
48
|
+
*@additional_args
|
49
|
+
]
|
50
|
+
|
51
|
+
if @loose_options
|
52
|
+
argvs << '--allow-warnings'
|
53
|
+
if code_spec&.all_dependencies&.any?
|
54
|
+
argvs << '--use-libraries'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
lint = Pod::Command::Lib::Lint.new(CLAide::ARGV.new(argvs))
|
59
|
+
lint.validate!
|
60
|
+
lint.run
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class Bin < Command
|
6
|
+
class List < Bin
|
7
|
+
self.summary = '展示二进制 pods .'
|
8
|
+
|
9
|
+
def self.options
|
10
|
+
[
|
11
|
+
['--code', '展示源码 pods'],
|
12
|
+
['--diff', '展示缺少二进制版本的源码 pods'],
|
13
|
+
['--update', '展示前执行 `pod bin repo update`']
|
14
|
+
].concat(super)
|
15
|
+
end
|
16
|
+
|
17
|
+
def initialize(argv)
|
18
|
+
@update = argv.flag?('update')
|
19
|
+
@code = argv.flag?('code')
|
20
|
+
@diff = argv.flag?('diff')
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
def run
|
25
|
+
update_if_necessary!
|
26
|
+
|
27
|
+
source = @code ? code_source : binary_source
|
28
|
+
|
29
|
+
sets = if @diff
|
30
|
+
binary_pod_set_names = binary_source.pod_sets.map(&:name)
|
31
|
+
sets = code_source.pod_sets.reject { |set| binary_pod_set_names.include?(set.name) }
|
32
|
+
else
|
33
|
+
source.pod_sets
|
34
|
+
end
|
35
|
+
|
36
|
+
sets.each { |set| UI.pod(set, :name_and_version) }
|
37
|
+
UI.puts "\n#{sets.count} pods were found"
|
38
|
+
end
|
39
|
+
|
40
|
+
def update_if_necessary!
|
41
|
+
if @update
|
42
|
+
UI.section("\nUpdating Spec Repositories\n".yellow) do
|
43
|
+
Pod::Command::Bin::Repo::Update.new(CLAide::ARGV.new([])).run
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|