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.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -0
  3. data/Gemfile +13 -0
  4. data/Gemfile.lock +104 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +567 -0
  7. data/Rakefile +13 -0
  8. data/cocoapods-bin.gemspec +27 -0
  9. data/cocoapods-bindyf-0.1.29.2.gem +0 -0
  10. data/debug_install.sh +8 -0
  11. data/lib/cocoapods-bin.rb +4 -0
  12. data/lib/cocoapods-bin/command.rb +3 -0
  13. data/lib/cocoapods-bin/command/bin.rb +60 -0
  14. data/lib/cocoapods-bin/command/bin/archive.rb +130 -0
  15. data/lib/cocoapods-bin/command/bin/init.rb +71 -0
  16. data/lib/cocoapods-bin/command/bin/lib.rb +14 -0
  17. data/lib/cocoapods-bin/command/bin/lib/lint.rb +69 -0
  18. data/lib/cocoapods-bin/command/bin/list.rb +50 -0
  19. data/lib/cocoapods-bin/command/bin/open.rb +61 -0
  20. data/lib/cocoapods-bin/command/bin/repo.rb +15 -0
  21. data/lib/cocoapods-bin/command/bin/repo/push.rb +124 -0
  22. data/lib/cocoapods-bin/command/bin/repo/update.rb +42 -0
  23. data/lib/cocoapods-bin/command/bin/search.rb +69 -0
  24. data/lib/cocoapods-bin/command/bin/spec.rb +15 -0
  25. data/lib/cocoapods-bin/command/bin/spec/create.rb +75 -0
  26. data/lib/cocoapods-bin/command/bin/spec/lint.rb +119 -0
  27. data/lib/cocoapods-bin/command/bin/umbrella.rb +55 -0
  28. data/lib/cocoapods-bin/config/config.rb +80 -0
  29. data/lib/cocoapods-bin/config/config_asker.rb +58 -0
  30. data/lib/cocoapods-bin/gem_version.rb +11 -0
  31. data/lib/cocoapods-bin/helpers.rb +5 -0
  32. data/lib/cocoapods-bin/helpers/framework.rb +66 -0
  33. data/lib/cocoapods-bin/helpers/framework_builder.rb +190 -0
  34. data/lib/cocoapods-bin/helpers/sources_helper.rb +33 -0
  35. data/lib/cocoapods-bin/helpers/spec_creator.rb +147 -0
  36. data/lib/cocoapods-bin/helpers/spec_files_helper.rb +77 -0
  37. data/lib/cocoapods-bin/native.rb +20 -0
  38. data/lib/cocoapods-bin/native/acknowledgements.rb +27 -0
  39. data/lib/cocoapods-bin/native/analyzer.rb +53 -0
  40. data/lib/cocoapods-bin/native/installation_options.rb +26 -0
  41. data/lib/cocoapods-bin/native/installer.rb +115 -0
  42. data/lib/cocoapods-bin/native/linter.rb +26 -0
  43. data/lib/cocoapods-bin/native/path_source.rb +33 -0
  44. data/lib/cocoapods-bin/native/pod_source_installer.rb +19 -0
  45. data/lib/cocoapods-bin/native/podfile.rb +79 -0
  46. data/lib/cocoapods-bin/native/podfile_env.rb +36 -0
  47. data/lib/cocoapods-bin/native/podspec_finder.rb +25 -0
  48. data/lib/cocoapods-bin/native/resolver.rb +199 -0
  49. data/lib/cocoapods-bin/native/sandbox_analyzer.rb +34 -0
  50. data/lib/cocoapods-bin/native/source.rb +35 -0
  51. data/lib/cocoapods-bin/native/sources_manager.rb +20 -0
  52. data/lib/cocoapods-bin/native/specification.rb +31 -0
  53. data/lib/cocoapods-bin/native/validator.rb +16 -0
  54. data/lib/cocoapods-bin/source_provider_hook.rb +39 -0
  55. data/lib/cocoapods_plugin.rb +5 -0
  56. data/spec/command/bin_spec.rb +12 -0
  57. data/spec/spec_helper.rb +50 -0
  58. metadata +173 -0
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pod
4
+ class Command
5
+ class Bin < Command
6
+ class Open < Bin
7
+ self.summary = '打开 workspace 工程.'
8
+
9
+ def self.options
10
+ [
11
+ ['--install', '先执行 install, 再执行 open. 相当于 pod install && pod bin open'],
12
+ ['--update', '先执行 update, 再执行 open. 相当于 pod update && pod bin open'],
13
+ ['--deep=5', '查找深度.']
14
+ ]
15
+ end
16
+
17
+ def initialize(argv)
18
+ @install = argv.flag?('install')
19
+ @update = argv.flag?('update')
20
+ @deep = argv.option('deep').try(:to_i) || 3
21
+ super
22
+ end
23
+
24
+ def run
25
+ if @install || @update
26
+ command_class = Object.const_get("Pod::Command::#{@install ? 'Install' : 'Update'}")
27
+ command = command_class.new(CLAide::ARGV.new([]))
28
+ command.validate!
29
+ command.run
30
+ end
31
+
32
+ path = find_in_children(Pathname.pwd.children, @deep) ||
33
+ find_in_parent(Pathname.pwd.parent, @deep)
34
+ if path
35
+ `open #{path}`
36
+ else
37
+ UI.puts "#{Pathname.pwd} 目录, 搜索上下深度 #{@deep} , 无法找到 xcworkspace 文件.".red
38
+ end
39
+ end
40
+
41
+ def find_in_children(paths, deep)
42
+ deep -= 1
43
+ pathname = paths.find { |ph| ph.extname == '.xcworkspace' }
44
+
45
+ return pathname if pathname || paths.empty? || deep <= 0
46
+
47
+ find_in_children(paths.select(&:directory?).flat_map(&:children), deep)
48
+ end
49
+
50
+ def find_in_parent(path, deep)
51
+ deep -= 1
52
+ pathname = path.children.find { |fn| fn.extname == '.xcworkspace' }
53
+
54
+ return pathname if pathname || deep <= 0
55
+
56
+ find_in_parent(path.parent, deep)
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cocoapods-bin/command/bin/repo/push'
4
+ require 'cocoapods-bin/command/bin/repo/update'
5
+
6
+ module Pod
7
+ class Command
8
+ class Bin < Command
9
+ class Repo < Bin
10
+ self.abstract_command = true
11
+ self.summary = '管理 spec 仓库.'
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,124 @@
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 Repo < Bin
10
+ class Push < Repo
11
+ self.summary = '发布组件.'
12
+ self.description = <<-DESC
13
+ 发布二进制组件 / 源码组件
14
+ DESC
15
+
16
+ self.arguments = [
17
+ CLAide::Argument.new('NAME.podspec', false)
18
+ ]
19
+
20
+ def self.options
21
+ [
22
+ ['--binary', '发布组件的二进制版本'],
23
+ ['--template-podspec=A.binary-template.podspec', '生成拥有 subspec 的二进制 spec 需要的模版 podspec, 插件会更改 version 和 source'],
24
+ ['--reserve-created-spec', '保留生成的二进制 spec 文件'],
25
+ ['--code-dependencies', '使用源码依赖进行 lint'],
26
+ ['--loose-options', '添加宽松的 options, 包括 --use-libraries (可能会造成 entry point (start) undefined)'],
27
+ ['--allow-prerelease', '允许使用 prerelease 的版本 lint'],
28
+ ['--original-podspec=A.podspec', '指定根据某个 spec 生成二进制 spec 文件,用于同一目录下存在多个 spec 文件的情况'],
29
+ ].concat(Pod::Command::Repo::Push.options).concat(super).uniq
30
+ end
31
+
32
+ def initialize(argv)
33
+ @podspec = argv.shift_argument
34
+ @binary = argv.flag?('binary')
35
+ @loose_options = argv.flag?('loose-options')
36
+ @code_dependencies = argv.flag?('code-dependencies')
37
+ @sources = argv.option('sources') || []
38
+ @reserve_created_spec = argv.flag?('reserve-created-spec')
39
+ @template_podspec = argv.option('template-podspec')
40
+ @allow_prerelease = argv.flag?('allow-prerelease')
41
+ @original_podspec = argv.option('original-podspec')
42
+ super
43
+
44
+ @additional_args = argv.remainder!
45
+ end
46
+
47
+ def run
48
+ Podfile.execute_with_bin_plugin do
49
+ Podfile.execute_with_allow_prerelease(@allow_prerelease) do
50
+ Podfile.execute_with_use_binaries(!@code_dependencies) do
51
+ argvs = [
52
+ repo,
53
+ "--sources=#{sources_option(@code_dependencies, @sources)}",
54
+ *@additional_args
55
+ ]
56
+
57
+ argvs << spec_file if spec_file
58
+
59
+ if @loose_options
60
+ argvs += ['--allow-warnings', '--use-json']
61
+ if code_spec&.all_dependencies&.any?
62
+ argvs << '--use-libraries'
63
+ end
64
+ end
65
+
66
+ push = Pod::Command::Repo::Push.new(CLAide::ARGV.new(argvs))
67
+ push.validate!
68
+ push.run
69
+ end
70
+ end
71
+ end
72
+ ensure
73
+ clear_binary_spec_file_if_needed unless @reserve_created_spec
74
+ end
75
+
76
+ private
77
+
78
+ def template_spec_file
79
+ @template_spec_file ||= begin
80
+ if @template_podspec
81
+ find_spec_file(@template_podspec)
82
+ else
83
+ binary_template_spec_file
84
+ end
85
+ end
86
+ end
87
+
88
+ def spec_file
89
+ @spec_file ||= begin
90
+ if @podspec
91
+ find_spec_file(@podspec)
92
+ else
93
+ if code_spec_files.empty?
94
+ raise Informative, '当前目录下没有找到可用源码 podspec.'
95
+ end
96
+
97
+ spec_file = if @binary
98
+ code_spec = Pod::Specification.from_file(code_spec_files.first)
99
+ code_spec_files.each do |spec|
100
+ if @original_podspec && spec.to_s == @original_podspec
101
+ code_spec = Pod::Specification.from_file(spec)
102
+ end
103
+ end
104
+
105
+ if template_spec_file
106
+ template_spec = Pod::Specification.from_file(template_spec_file)
107
+ end
108
+ create_binary_spec_file(code_spec, template_spec)
109
+ else
110
+ code_spec_files.first
111
+ end
112
+ spec_file
113
+ end
114
+ end
115
+ end
116
+
117
+ def repo
118
+ @binary ? binary_source.name : code_source.name
119
+ end
120
+ end
121
+ end
122
+ end
123
+ end
124
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'parallel'
4
+
5
+ module Pod
6
+ class Command
7
+ class Bin < Command
8
+ class Repo < Bin
9
+ class Update < Repo
10
+ self.summary = '更新私有源'
11
+
12
+ self.arguments = [
13
+ CLAide::Argument.new('NAME', false)
14
+ ]
15
+
16
+ def self.options
17
+ [
18
+ ['--all', '更新所有私有源,默认只更新二进制相关私有源']
19
+ ].concat(super)
20
+ end
21
+
22
+ def initialize(argv)
23
+ @all = argv.flag?('all')
24
+ @name = argv.shift_argument
25
+ super
26
+ end
27
+
28
+ def run
29
+ show_output = !config.silent?
30
+ if @name || @all
31
+ config.sources_manager.update(@name, show_output)
32
+ else
33
+ Parallel.each(valid_sources, in_threads: 4) do |source|
34
+ source.update(show_output)
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pod
4
+ class Command
5
+ class Bin < Command
6
+ class Search < Bin
7
+ self.summary = '查找二进制 spec.'
8
+
9
+ self.arguments = [
10
+ CLAide::Argument.new('QUERY', true)
11
+ ]
12
+
13
+ def self.options
14
+ [
15
+ ['--code', '查找源码 spec'],
16
+ ['--stats', '展示额外信息'],
17
+ ['--no-pager', '不以 pager 形式展示'],
18
+ ['--regex', '`QUERY` 视为正则']
19
+ ]
20
+ end
21
+
22
+ def initialize(argv)
23
+ @code = argv.flag?('code')
24
+ @stats = argv.flag?('stats')
25
+ @use_pager = argv.flag?('pager', true)
26
+ @use_regex = argv.flag?('regex')
27
+ @query = argv.arguments! unless argv.arguments.empty?
28
+ super
29
+ end
30
+
31
+ def validate!
32
+ super
33
+ help! '必须指定查找的组件.' unless @query
34
+ end
35
+
36
+ def run
37
+ query_regex = @query.reduce([]) do |result, q|
38
+ result << (@use_regex ? q : Regexp.escape(q))
39
+ end.join(' ').strip
40
+
41
+ source = @code ? code_source : binary_source
42
+
43
+ aggregate = Pod::Source::Aggregate.new([source])
44
+ sets = aggregate.search_by_name(query_regex, true)
45
+
46
+ if @use_pager
47
+ UI.with_pager { print_sets(sets) }
48
+ else
49
+ print_sets(sets)
50
+ end
51
+ end
52
+
53
+ def print_sets(sets)
54
+ sets.each do |set|
55
+ begin
56
+ if @stats
57
+ UI.pod(set, :stats)
58
+ else
59
+ UI.pod(set, :normal)
60
+ end
61
+ rescue DSLError
62
+ UI.warn "Skipping `#{set.name}` because the podspec contains errors."
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cocoapods-bin/command/bin/spec/create'
4
+ require 'cocoapods-bin/command/bin/spec/lint'
5
+
6
+ module Pod
7
+ class Command
8
+ class Bin < Command
9
+ class Spec < Bin
10
+ self.abstract_command = true
11
+ self.summary = '管理二进制 spec.'
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cocoapods-bin/helpers'
4
+
5
+ module Pod
6
+ class Command
7
+ class Bin < Command
8
+ class Spec < Bin
9
+ class Create < Spec
10
+ self.summary = '创建二进制 spec.'
11
+ self.description = <<-DESC
12
+ 根据源码 podspec 文件,创建对应的二进制 podspec 文件.
13
+ DESC
14
+
15
+ def self.options
16
+ [
17
+ ['--platforms=ios', '生成二进制 spec 支持的平台'],
18
+ ['--template-podspec=A.binary-template.podspec', '生成拥有 subspec 的二进制 spec 需要的模版 podspec, 插件会更改 version 和 source'],
19
+ ['--no-overwrite', '不允许覆盖']
20
+ ].concat(super)
21
+ end
22
+
23
+ def initialize(argv)
24
+ @platforms = argv.option('platforms', 'ios')
25
+ @allow_overwrite = argv.flag?('overwrite', true)
26
+ @template_podspec = argv.option('template-podspec')
27
+ @podspec = argv.shift_argument
28
+ super
29
+ end
30
+
31
+ def run
32
+ UI.puts "开始读取 podspec 文件...\n"
33
+
34
+ code_spec = Pod::Specification.from_file(spec_file)
35
+ if template_spec_file
36
+ template_spec = Pod::Specification.from_file(template_spec_file)
37
+ end
38
+
39
+ if binary_spec && !@allow_overwrite
40
+ UI.warn "二进制 podspec 文件 #{binary_spec_files.first} 已存在.\n"
41
+ else
42
+ UI.puts "开始生成二进制 podspec 文件...\n"
43
+ spec_file = create_binary_spec_file(code_spec, template_spec)
44
+ UI.puts "创建二进制 podspec 文件 #{spec_file} 成功.\n".green
45
+ end
46
+ end
47
+
48
+ def template_spec_file
49
+ @template_spec_file ||= begin
50
+ if @template_podspec
51
+ find_spec_file(@template_podspec)
52
+ else
53
+ binary_template_spec_file
54
+ end
55
+ end
56
+ end
57
+
58
+ def spec_file
59
+ @spec_file ||= begin
60
+ if @podspec
61
+ find_spec_file(@podspec)
62
+ else
63
+ if code_spec_files.empty?
64
+ raise Informative, '当前目录下没有找到可用源码 podspec.'
65
+ end
66
+
67
+ code_spec_files.first
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,119 @@
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 Spec < Bin
10
+ class Lint < Spec
11
+ self.summary = 'lint spec.'
12
+ self.description = <<-DESC
13
+ spec lint 二进制组件 / 源码组件
14
+ DESC
15
+
16
+ self.arguments = [
17
+ CLAide::Argument.new(%w[NAME.podspec DIRECTORY http://PATH/NAME.podspec], false, true)
18
+ ]
19
+
20
+ def self.options
21
+ [
22
+ ['--binary', 'lint 组件的二进制版本'],
23
+ ['--template-podspec=A.binary-template.podspec', '生成拥有 subspec 的二进制 spec 需要的模版 podspec, 插件会更改 version 和 source'],
24
+ ['--reserve-created-spec', '保留生成的二进制 spec 文件'],
25
+ ['--code-dependencies', '使用源码依赖进行 lint'],
26
+ ['--loose-options', '添加宽松的 options, 包括 --use-libraries (可能会造成 entry point (start) undefined)'],
27
+ ['--allow-prerelease', '允许使用 prerelease 的版本 lint'],
28
+ ['--original-podspec=A.podspec', '指定根据某个 spec 生成二进制 spec 文件,用于同一目录下存在多个 spec 文件的情况'],
29
+ ].concat(Pod::Command::Spec::Lint.options).concat(super).uniq
30
+ end
31
+
32
+ def initialize(argv)
33
+ @podspec = argv.shift_argument
34
+ @loose_options = argv.flag?('loose-options')
35
+ @code_dependencies = argv.flag?('code-dependencies')
36
+ @sources = argv.option('sources') || []
37
+ @binary = argv.flag?('binary')
38
+ @reserve_created_spec = argv.flag?('reserve-created-spec')
39
+ @template_podspec = argv.option('template-podspec')
40
+ @allow_prerelease = argv.flag?('allow-prerelease')
41
+ @original_podspec = argv.option('original-podspec')
42
+ super
43
+
44
+ @additional_args = argv.remainder!
45
+ end
46
+
47
+ def run
48
+ Podfile.execute_with_bin_plugin do
49
+ Podfile.execute_with_allow_prerelease(@allow_prerelease) do
50
+ Podfile.execute_with_use_binaries(!@code_dependencies) do
51
+ argvs = [
52
+ "--sources=#{sources_option(@code_dependencies, @sources)}",
53
+ *@additional_args
54
+ ]
55
+
56
+ argvs << spec_file if spec_file
57
+
58
+ if @loose_options
59
+ argvs += ['--allow-warnings']
60
+ if code_spec&.all_dependencies&.any?
61
+ argvs << '--use-libraries'
62
+ end
63
+ end
64
+
65
+ lint = Pod::Command::Spec::Lint.new(CLAide::ARGV.new(argvs))
66
+ lint.validate!
67
+ lint.run
68
+ end
69
+ end
70
+ end
71
+ ensure
72
+ clear_binary_spec_file_if_needed unless @reserve_created_spec
73
+ end
74
+
75
+ private
76
+
77
+ def template_spec_file
78
+ @template_spec_file ||= begin
79
+ if @template_podspec
80
+ find_spec_file(@template_podspec)
81
+ else
82
+ binary_template_spec_file
83
+ end
84
+ end
85
+ end
86
+
87
+ def spec_file
88
+ @spec_file ||= begin
89
+ if @podspec
90
+ find_spec_file(@podspec) || @podspec
91
+ else
92
+ if code_spec_files.empty?
93
+ raise Informative, '当前目录下没有找到可用源码 podspec.'
94
+ end
95
+
96
+ spec_file = if @binary
97
+ code_spec = Pod::Specification.from_file(code_spec_files.first)
98
+ code_spec_files.each do |spec|
99
+ if @original_podspec && spec.to_s == @original_podspec
100
+ code_spec = Pod::Specification.from_file(spec)
101
+ end
102
+ end
103
+
104
+ if template_spec_file
105
+ template_spec = Pod::Specification.from_file(template_spec_file)
106
+ end
107
+ create_binary_spec_file(code_spec, template_spec)
108
+ else
109
+ code_spec_files.first
110
+ end
111
+ spec_file
112
+ end
113
+ end
114
+ end
115
+ end
116
+ end
117
+ end
118
+ end
119
+ end