cocoapods-bin 0.1.24 → 0.1.25

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 (48) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/lib/cocoapods-bin.rb +3 -1
  4. data/lib/cocoapods-bin/command.rb +2 -0
  5. data/lib/cocoapods-bin/command/bin.rb +4 -2
  6. data/lib/cocoapods-bin/command/bin/archive.rb +21 -15
  7. data/lib/cocoapods-bin/command/bin/init.rb +14 -9
  8. data/lib/cocoapods-bin/command/bin/lib.rb +3 -1
  9. data/lib/cocoapods-bin/command/bin/lib/lint.rb +13 -9
  10. data/lib/cocoapods-bin/command/bin/list.rb +16 -12
  11. data/lib/cocoapods-bin/command/bin/open.rb +10 -8
  12. data/lib/cocoapods-bin/command/bin/repo.rb +3 -1
  13. data/lib/cocoapods-bin/command/bin/repo/push.rb +22 -14
  14. data/lib/cocoapods-bin/command/bin/repo/update.rb +6 -4
  15. data/lib/cocoapods-bin/command/bin/search.rb +9 -7
  16. data/lib/cocoapods-bin/command/bin/spec.rb +3 -1
  17. data/lib/cocoapods-bin/command/bin/spec/create.rb +15 -8
  18. data/lib/cocoapods-bin/command/bin/spec/lint.rb +18 -10
  19. data/lib/cocoapods-bin/command/bin/umbrella.rb +13 -7
  20. data/lib/cocoapods-bin/config/config.rb +18 -14
  21. data/lib/cocoapods-bin/config/config_asker.rb +22 -19
  22. data/lib/cocoapods-bin/gem_version.rb +5 -3
  23. data/lib/cocoapods-bin/helpers.rb +2 -0
  24. data/lib/cocoapods-bin/helpers/framework.rb +5 -3
  25. data/lib/cocoapods-bin/helpers/framework_builder.rb +31 -24
  26. data/lib/cocoapods-bin/helpers/sources_helper.rb +6 -4
  27. data/lib/cocoapods-bin/helpers/spec_creator.rb +28 -18
  28. data/lib/cocoapods-bin/helpers/spec_files_helper.rb +28 -15
  29. data/lib/cocoapods-bin/native.rb +16 -14
  30. data/lib/cocoapods-bin/native/acknowledgements.rb +5 -2
  31. data/lib/cocoapods-bin/native/analyzer.rb +6 -5
  32. data/lib/cocoapods-bin/native/installation_options.rb +13 -11
  33. data/lib/cocoapods-bin/native/installer.rb +54 -47
  34. data/lib/cocoapods-bin/native/linter.rb +4 -2
  35. data/lib/cocoapods-bin/native/path_source.rb +9 -7
  36. data/lib/cocoapods-bin/native/pod_source_installer.rb +10 -6
  37. data/lib/cocoapods-bin/native/podfile.rb +11 -7
  38. data/lib/cocoapods-bin/native/podfile_env.rb +11 -9
  39. data/lib/cocoapods-bin/native/podspec_finder.rb +3 -0
  40. data/lib/cocoapods-bin/native/resolver.rb +65 -45
  41. data/lib/cocoapods-bin/native/sandbox_analyzer.rb +27 -25
  42. data/lib/cocoapods-bin/native/source.rb +7 -4
  43. data/lib/cocoapods-bin/native/sources_manager.rb +11 -9
  44. data/lib/cocoapods-bin/native/specification.rb +14 -12
  45. data/lib/cocoapods-bin/native/validator.rb +3 -3
  46. data/lib/cocoapods-bin/source_provider_hook.rb +12 -8
  47. data/lib/cocoapods_plugin.rb +2 -0
  48. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1cb60567dc623ef8e850e97e77d570543e9d9ced364a5e3d1eaa7e26a2bf77b5
4
- data.tar.gz: 1b414882912dde9104b837f7974c9b05e63612eb445b523465b4101365b0c1bf
3
+ metadata.gz: f2f632f9b4f18ed2c88a9be2346807dcb22ae70c195d892859b06f85cc95aad2
4
+ data.tar.gz: 24b2cb8937a8e27e9a39d07ce7c6ce5969324c65268e9317749d68bd9ed751b5
5
5
  SHA512:
6
- metadata.gz: 214006541f453363f4d8c1cd1b4d7e3c4058998fa4709be451cbae7b962aeeec77ab652362c6e11eb4487a699554b66b6b71ea06c0a53216839260bf662cd1f6
7
- data.tar.gz: 9b9c9021311ca147bdd3529167e546e2e2cfc3642a39a56c63b204021c37be950d36451f07197f7d6403e069887a47986fc7007209ce39b5926447ea3a64fb56
6
+ metadata.gz: 3f13ed9d68f96970587b44ac57a04bde83bc2c4c6a030d7b933f33d2c692be9deb7884725b20d40041dfd278df56fc0c8440d9592a0ff0fa5a043422c7c8da34
7
+ data.tar.gz: 5391f2105a5527b9532036753e84ceea33d9c4789644cc649cc4245e21d3f1833f2881d9094230929825721cc4190e43c28b817a1ac21b8de3e2d864a2d4b8e4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cocoapods-bin (0.1.24)
4
+ cocoapods-bin (0.1.25)
5
5
  cocoapods (~> 1.4)
6
6
  cocoapods-generate (~> 1.4)
7
7
  parallel
@@ -72,7 +72,7 @@ GEM
72
72
  nanaimo (0.2.6)
73
73
  nap (1.1.0)
74
74
  netrc (0.11.0)
75
- parallel (1.18.0)
75
+ parallel (1.19.1)
76
76
  prettybacon (0.0.2)
77
77
  bacon (~> 1.2)
78
78
  rake (13.0.0)
data/lib/cocoapods-bin.rb CHANGED
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'cocoapods-bin/gem_version'
2
- require 'cocoapods-bin/native/sources_manager'
4
+ require 'cocoapods-bin/native/sources_manager'
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'cocoapods-bin/command/bin'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'cocoapods-bin/command/bin/init'
2
4
  require 'cocoapods-bin/command/bin/spec'
3
5
  require 'cocoapods-bin/command/bin/lib'
@@ -42,9 +44,9 @@ module Pod
42
44
 
43
45
  def initialize(argv)
44
46
  require 'cocoapods-bin/native'
45
-
47
+
46
48
  @help = argv.flag?('help')
47
- super
49
+ super
48
50
  end
49
51
 
50
52
  def validate!
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'cocoapods-bin/native/podfile'
2
4
  require 'cocoapods/command/gen'
3
5
  require 'cocoapods/generate'
@@ -6,7 +8,7 @@ require 'cocoapods-bin/helpers/framework_builder'
6
8
  module Pod
7
9
  class Command
8
10
  class Bin < Command
9
- class Archive < Bin
11
+ class Archive < Bin
10
12
  self.summary = '将组件归档为静态 framework.'
11
13
  self.description = <<-DESC
12
14
  将组件归档为静态 framework,仅支持 iOS 平台
@@ -18,12 +20,12 @@ module Pod
18
20
  ['--code-dependencies', '使用源码依赖'],
19
21
  ['--allow-prerelease', '允许使用 prerelease 的版本'],
20
22
  ['--no-clean', '保留构建中间产物'],
21
- ['--no-zip', '不压缩静态 framework 为 zip'],
22
- ].concat(Pod::Command::Gen.options).concat(super).uniq
23
+ ['--no-zip', '不压缩静态 framework 为 zip']
24
+ ].concat(Pod::Command::Gen.options).concat(super).uniq
23
25
  end
24
26
 
25
27
  self.arguments = [
26
- CLAide::Argument.new('NAME.podspec', false),
28
+ CLAide::Argument.new('NAME.podspec', false)
27
29
  ]
28
30
 
29
31
  def initialize(argv)
@@ -38,7 +40,7 @@ module Pod
38
40
  @additional_args = argv.remainder!
39
41
  end
40
42
 
41
- def run
43
+ def run
42
44
  @spec = Specification.from_file(spec_file)
43
45
  generate_project
44
46
  build_static_framework
@@ -50,8 +52,8 @@ module Pod
50
52
 
51
53
  def generate_project
52
54
  Podfile.execute_with_bin_plugin do
53
- Podfile.execute_with_allow_prerelease(@allow_prerelease) do
54
- Podfile.execute_with_use_binaries(!@code_dependencies) do
55
+ Podfile.execute_with_allow_prerelease(@allow_prerelease) do
56
+ Podfile.execute_with_use_binaries(!@code_dependencies) do
55
57
  argvs = [
56
58
  "--sources=#{sources_option(@code_dependencies, @sources)}",
57
59
  "--gen-directory=#{gen_name}",
@@ -72,7 +74,9 @@ module Pod
72
74
 
73
75
  def zip_static_framework
74
76
  output_name = "#{framework_name}.zip"
75
- raise Informative, "没有需要压缩的 framework 文件:#{framework_name}" unless File.exist?(framework_name)
77
+ unless File.exist?(framework_name)
78
+ raise Informative, "没有需要压缩的 framework 文件:#{framework_name}"
79
+ end
76
80
 
77
81
  UI.puts "Compressing #{framework_name} into #{output_name}"
78
82
 
@@ -81,22 +85,22 @@ module Pod
81
85
 
82
86
  def build_static_framework
83
87
  source_dir = Dir.pwd
84
- file_accessor = Sandbox::FileAccessor.new(Pathname.new(".").expand_path, @spec.consumer(@platform))
85
- Dir.chdir(workspace_directory) do
88
+ file_accessor = Sandbox::FileAccessor.new(Pathname.new('.').expand_path, @spec.consumer(@platform))
89
+ Dir.chdir(workspace_directory) do
86
90
  builder = CBin::Framework::Builder.new(@spec, file_accessor, @platform, source_dir)
87
91
  builder.build
88
92
  end
89
93
  end
90
94
 
91
95
  def clean_workspace
92
- UI.puts "Cleaning workspace"
96
+ UI.puts 'Cleaning workspace'
93
97
 
94
98
  FileUtils.rm_rf(gen_name)
95
- FileUtils.rm_rf(framework_name) if @zip
99
+ FileUtils.rm_rf(framework_name) if @zip
96
100
  end
97
101
 
98
102
  def gen_name
99
- "bin-archive"
103
+ 'bin-archive'
100
104
  end
101
105
 
102
106
  def framework_name
@@ -110,9 +114,11 @@ module Pod
110
114
  def spec_file
111
115
  @spec_file ||= begin
112
116
  if @podspec
113
- find_spec_file(@podspec)
117
+ find_spec_file(@podspec)
114
118
  else
115
- raise Informative, "当前目录下没有找到可用源码 podspec." if code_spec_files.empty?
119
+ if code_spec_files.empty?
120
+ raise Informative, '当前目录下没有找到可用源码 podspec.'
121
+ end
116
122
 
117
123
  spec_file = code_spec_files.first
118
124
  spec_file
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'cocoapods-bin/config/config_asker'
2
4
 
3
5
  module Pod
4
6
  class Command
5
7
  class Bin < Command
6
- class Init < Bin
8
+ class Init < Bin
7
9
  self.summary = '初始化插件.'
8
10
  self.description = <<-DESC
9
11
  创建 #{CBin.config.config_file} 文件,在其中保存插件需要的配置信息,
@@ -12,17 +14,16 @@ module Pod
12
14
 
13
15
  def self.options
14
16
  [
15
- ['--bin-url=URL', '配置文件地址,直接从此地址下载配置文件'],
17
+ ['--bin-url=URL', '配置文件地址,直接从此地址下载配置文件']
16
18
  ].concat(super)
17
19
  end
18
20
 
19
-
20
21
  def initialize(argv)
21
22
  @bin_url = argv.option('bin-url')
22
23
  super
23
24
  end
24
25
 
25
- def run
26
+ def run
26
27
  if @bin_url.nil?
27
28
  config_with_asker
28
29
  else
@@ -37,12 +38,12 @@ module Pod
37
38
 
38
39
  UI.puts "开始下载配置文件...\n"
39
40
  file = open(url)
40
- contents = YAML.load(file.read)
41
-
41
+ contents = YAML.safe_load(file.read)
42
+
42
43
  UI.puts "开始同步配置文件...\n"
43
- CBin.config.sync_config(contents.to_hash)
44
+ CBin.config.sync_config(contents.to_hash)
44
45
  UI.puts "设置完成.\n".green
45
- rescue Errno::ENOENT => error
46
+ rescue Errno::ENOENT => e
46
47
  raise Informative, "配置文件路径 #{url} 无效,请确认后重试."
47
48
  end
48
49
 
@@ -53,7 +54,11 @@ module Pod
53
54
  config = {}
54
55
  template_hash = CBin.config.template_hash
55
56
  template_hash.each do |k, v|
56
- default = CBin.config.send(k) rescue nil
57
+ default = begin
58
+ CBin.config.send(k)
59
+ rescue StandardError
60
+ nil
61
+ end
57
62
  config[k] = asker.ask_with_answer(v[:description], default, v[:selection])
58
63
  end
59
64
 
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'cocoapods-bin/command/bin/lib/lint'
2
4
 
3
5
  module Pod
4
6
  class Command
5
7
  class Bin < Command
6
- class Lib < Bin
8
+ class Lib < Bin
7
9
  self.abstract_command = true
8
10
  self.summary = '管理二进制 pod.'
9
11
  end
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'cocoapods-bin/config/config'
2
4
  require 'cocoapods-bin/native/podfile'
3
5
 
4
6
  module Pod
5
7
  class Command
6
8
  class Bin < Command
7
- class Lib < Bin
9
+ class Lib < Bin
8
10
  class Lint < Lib
9
11
  self.summary = 'lint 组件.'
10
12
  self.description = <<-DESC
@@ -12,7 +14,7 @@ module Pod
12
14
  DESC
13
15
 
14
16
  self.arguments = [
15
- CLAide::Argument.new('NAME.podspec', false),
17
+ CLAide::Argument.new('NAME.podspec', false)
16
18
  ]
17
19
 
18
20
  # lib lint 不会下载 source,所以不能进行二进制 lint
@@ -36,21 +38,23 @@ module Pod
36
38
  @additional_args = argv.remainder!
37
39
  end
38
40
 
39
- def run
40
- Podfile.execute_with_bin_plugin do
41
- Podfile.execute_with_allow_prerelease(@allow_prerelease) do
42
- Podfile.execute_with_use_binaries(!@code_dependencies) do
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
43
45
  argvs = [
44
46
  @podspec || code_spec_files.first,
45
47
  "--sources=#{sources_option(@code_dependencies, @sources)}",
46
48
  *@additional_args
47
49
  ]
48
-
50
+
49
51
  if @loose_options
50
52
  argvs << '--allow-warnings'
51
- argvs << '--use-libraries' if code_spec&.all_dependencies&.any?
53
+ if code_spec&.all_dependencies&.any?
54
+ argvs << '--use-libraries'
55
+ end
52
56
  end
53
-
57
+
54
58
  lint = Pod::Command::Lib::Lint.new(CLAide::ARGV.new(argvs))
55
59
  lint.validate!
56
60
  lint.run
@@ -1,21 +1,23 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Pod
2
4
  class Command
3
5
  class Bin < Command
4
- class List < Bin
6
+ class List < Bin
5
7
  self.summary = '展示二进制 pods .'
6
8
 
7
9
  def self.options
8
10
  [
9
11
  ['--code', '展示源码 pods'],
10
12
  ['--diff', '展示缺少二进制版本的源码 pods'],
11
- ['--update', '展示前执行 `pod bin repo update`'],
13
+ ['--update', '展示前执行 `pod bin repo update`']
12
14
  ].concat(super)
13
15
  end
14
16
 
15
17
  def initialize(argv)
16
18
  @update = argv.flag?('update')
17
- @code = argv.flag?('code')
18
- @diff = argv.flag?('diff')
19
+ @code = argv.flag?('code')
20
+ @diff = argv.flag?('diff')
19
21
  super
20
22
  end
21
23
 
@@ -24,11 +26,11 @@ module Pod
24
26
 
25
27
  source = @code ? code_source : binary_source
26
28
 
27
- sets = if @diff
28
- binary_pod_set_names = binary_source.pod_sets.map(&:name)
29
- sets = code_source.pod_sets.reject { |set| binary_pod_set_names.include?(set.name) }
30
- else
31
- source.pod_sets
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
32
34
  end
33
35
 
34
36
  sets.each { |set| UI.pod(set, :name_and_version) }
@@ -36,9 +38,11 @@ module Pod
36
38
  end
37
39
 
38
40
  def update_if_necessary!
39
- UI.section("\nUpdating Spec Repositories\n".yellow) do
40
- Pod::Command::Bin::Repo::Update.new(CLAide::ARGV.new([])).run
41
- end if @update
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
42
46
  end
43
47
  end
44
48
  end
@@ -1,14 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Pod
2
4
  class Command
3
5
  class Bin < Command
4
- class Open < Bin
6
+ class Open < Bin
5
7
  self.summary = '打开 workspace 工程.'
6
8
 
7
9
  def self.options
8
10
  [
9
11
  ['--install', '先执行 install, 再执行 open. 相当于 pod install && pod bin open'],
10
12
  ['--update', '先执行 update, 再执行 open. 相当于 pod update && pod bin open'],
11
- ['--deep=5', '查找深度.'],
13
+ ['--deep=5', '查找深度.']
12
14
  ]
13
15
  end
14
16
 
@@ -22,16 +24,16 @@ module Pod
22
24
  def run
23
25
  if @install || @update
24
26
  command_class = Object.const_get("Pod::Command::#{@install ? 'Install' : 'Update'}")
25
- command = command_class.new(CLAide::ARGV.new([]))
27
+ command = command_class.new(CLAide::ARGV.new([]))
26
28
  command.validate!
27
29
  command.run
28
30
  end
29
31
 
30
- path = find_in_children(Pathname.pwd.children, @deep) ||
31
- find_in_parent(Pathname.pwd.parent, @deep)
32
+ path = find_in_children(Pathname.pwd.children, @deep) ||
33
+ find_in_parent(Pathname.pwd.parent, @deep)
32
34
  if path
33
- `open #{path}`
34
- else
35
+ `open #{path}`
36
+ else
35
37
  UI.puts "#{Pathname.pwd} 目录, 搜索上下深度 #{@deep} , 无法找到 xcworkspace 文件.".red
36
38
  end
37
39
  end
@@ -47,7 +49,7 @@ module Pod
47
49
 
48
50
  def find_in_parent(path, deep)
49
51
  deep -= 1
50
- pathname = path.children.find {|fn| fn.extname == '.xcworkspace'}
52
+ pathname = path.children.find { |fn| fn.extname == '.xcworkspace' }
51
53
 
52
54
  return pathname if pathname || deep <= 0
53
55
 
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'cocoapods-bin/command/bin/repo/push'
2
4
  require 'cocoapods-bin/command/bin/repo/update'
3
5
 
4
6
  module Pod
5
7
  class Command
6
8
  class Bin < Command
7
- class Repo < Bin
9
+ class Repo < Bin
8
10
  self.abstract_command = true
9
11
  self.summary = '管理 spec 仓库.'
10
12
  end
@@ -1,18 +1,20 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'cocoapods-bin/config/config'
2
4
  require 'cocoapods-bin/native/podfile'
3
5
 
4
6
  module Pod
5
7
  class Command
6
8
  class Bin < Command
7
- class Repo < Bin
8
- class Push < Repo
9
+ class Repo < Bin
10
+ class Push < Repo
9
11
  self.summary = '发布组件.'
10
12
  self.description = <<-DESC
11
13
  发布二进制组件 / 源码组件
12
14
  DESC
13
15
 
14
16
  self.arguments = [
15
- CLAide::Argument.new('NAME.podspec', false),
17
+ CLAide::Argument.new('NAME.podspec', false)
16
18
  ]
17
19
 
18
20
  def self.options
@@ -40,10 +42,10 @@ module Pod
40
42
  @additional_args = argv.remainder!
41
43
  end
42
44
 
43
- def run
45
+ def run
44
46
  Podfile.execute_with_bin_plugin do
45
- Podfile.execute_with_allow_prerelease(@allow_prerelease) do
46
- Podfile.execute_with_use_binaries(!@code_dependencies) do
47
+ Podfile.execute_with_allow_prerelease(@allow_prerelease) do
48
+ Podfile.execute_with_use_binaries(!@code_dependencies) do
47
49
  argvs = [
48
50
  repo,
49
51
  "--sources=#{sources_option(@code_dependencies, @sources)}",
@@ -54,9 +56,11 @@ module Pod
54
56
 
55
57
  if @loose_options
56
58
  argvs += ['--allow-warnings', '--use-json']
57
- argvs << '--use-libraries' if code_spec&.all_dependencies&.any?
59
+ if code_spec&.all_dependencies&.any?
60
+ argvs << '--use-libraries'
61
+ end
58
62
  end
59
-
63
+
60
64
  push = Pod::Command::Repo::Push.new(CLAide::ARGV.new(argvs))
61
65
  push.validate!
62
66
  push.run
@@ -72,8 +76,8 @@ module Pod
72
76
  def template_spec_file
73
77
  @template_spec_file ||= begin
74
78
  if @template_podspec
75
- find_spec_file(@template_podspec)
76
- else
79
+ find_spec_file(@template_podspec)
80
+ else
77
81
  binary_template_spec_file
78
82
  end
79
83
  end
@@ -82,13 +86,17 @@ module Pod
82
86
  def spec_file
83
87
  @spec_file ||= begin
84
88
  if @podspec
85
- find_spec_file(@podspec)
89
+ find_spec_file(@podspec)
86
90
  else
87
- raise Informative, "当前目录下没有找到可用源码 podspec." if code_spec_files.empty?
91
+ if code_spec_files.empty?
92
+ raise Informative, '当前目录下没有找到可用源码 podspec.'
93
+ end
88
94
 
89
95
  spec_file = if @binary
90
96
  code_spec = Pod::Specification.from_file(code_spec_files.first)
91
- template_spec = Pod::Specification.from_file(template_spec_file) if template_spec_file
97
+ if template_spec_file
98
+ template_spec = Pod::Specification.from_file(template_spec_file)
99
+ end
92
100
  create_binary_spec_file(code_spec, template_spec)
93
101
  else
94
102
  code_spec_files.first
@@ -99,7 +107,7 @@ module Pod
99
107
  end
100
108
 
101
109
  def repo
102
- @binary ? binary_source.name : code_source.name
110
+ @binary ? binary_source.name : code_source.name
103
111
  end
104
112
  end
105
113
  end