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
@@ -1,19 +1,21 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'parallel'
2
4
 
3
5
  module Pod
4
6
  class Command
5
7
  class Bin < Command
6
- class Repo < Bin
8
+ class Repo < Bin
7
9
  class Update < Repo
8
10
  self.summary = '更新私有源'
9
11
 
10
12
  self.arguments = [
11
- CLAide::Argument.new('NAME', false),
13
+ CLAide::Argument.new('NAME', false)
12
14
  ]
13
15
 
14
16
  def self.options
15
17
  [
16
- ['--all', '更新所有私有源,默认只更新二进制相关私有源'],
18
+ ['--all', '更新所有私有源,默认只更新二进制相关私有源']
17
19
  ].concat(super)
18
20
  end
19
21
 
@@ -37,4 +39,4 @@ module Pod
37
39
  end
38
40
  end
39
41
  end
40
- end
42
+ end
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Pod
2
4
  class Command
3
5
  class Bin < Command
4
- class Search < Bin
6
+ class Search < Bin
5
7
  self.summary = '查找二进制 spec.'
6
8
 
7
9
  self.arguments = [
8
- CLAide::Argument.new('QUERY', true),
10
+ CLAide::Argument.new('QUERY', true)
9
11
  ]
10
12
 
11
13
  def self.options
@@ -13,7 +15,7 @@ module Pod
13
15
  ['--code', '查找源码 spec'],
14
16
  ['--stats', '展示额外信息'],
15
17
  ['--no-pager', '不以 pager 形式展示'],
16
- ['--regex', '`QUERY` 视为正则'],
18
+ ['--regex', '`QUERY` 视为正则']
17
19
  ]
18
20
  end
19
21
 
@@ -31,17 +33,17 @@ module Pod
31
33
  help! '必须指定查找的组件.' unless @query
32
34
  end
33
35
 
34
- def run
35
- query_regex = @query.reduce([]) { |result, q|
36
+ def run
37
+ query_regex = @query.reduce([]) do |result, q|
36
38
  result << (@use_regex ? q : Regexp.escape(q))
37
- }.join(' ').strip
39
+ end.join(' ').strip
38
40
 
39
41
  source = @code ? code_source : binary_source
40
42
 
41
43
  aggregate = Pod::Source::Aggregate.new([source])
42
44
  sets = aggregate.search_by_name(query_regex, true)
43
45
 
44
- if(@use_pager)
46
+ if @use_pager
45
47
  UI.with_pager { print_sets(sets) }
46
48
  else
47
49
  print_sets(sets)
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'cocoapods-bin/command/bin/spec/create'
2
4
  require 'cocoapods-bin/command/bin/spec/lint'
3
5
 
4
6
  module Pod
5
7
  class Command
6
8
  class Bin < Command
7
- class Spec < Bin
9
+ class Spec < Bin
8
10
  self.abstract_command = true
9
11
  self.summary = '管理二进制 spec.'
10
12
  end
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'cocoapods-bin/helpers'
2
4
 
3
5
  module Pod
4
6
  class Command
5
7
  class Bin < Command
6
- class Spec < Bin
8
+ class Spec < Bin
7
9
  class Create < Spec
8
10
  self.summary = '创建二进制 spec.'
9
11
  self.description = <<-DESC
@@ -19,18 +21,20 @@ module Pod
19
21
  end
20
22
 
21
23
  def initialize(argv)
22
- @platforms = argv.option('platforms', 'ios')
24
+ @platforms = argv.option('platforms', 'ios')
23
25
  @allow_overwrite = argv.flag?('overwrite', true)
24
26
  @template_podspec = argv.option('template-podspec')
25
27
  @podspec = argv.shift_argument
26
28
  super
27
29
  end
28
30
 
29
- def run
31
+ def run
30
32
  UI.puts "开始读取 podspec 文件...\n"
31
33
 
32
34
  code_spec = Pod::Specification.from_file(spec_file)
33
- template_spec = Pod::Specification.from_file(template_spec_file) if template_spec_file
35
+ if template_spec_file
36
+ template_spec = Pod::Specification.from_file(template_spec_file)
37
+ end
34
38
 
35
39
  if binary_spec && !@allow_overwrite
36
40
  UI.warn "二进制 podspec 文件 #{binary_spec_files.first} 已存在.\n"
@@ -44,8 +48,8 @@ module Pod
44
48
  def template_spec_file
45
49
  @template_spec_file ||= begin
46
50
  if @template_podspec
47
- find_spec_file(@template_podspec)
48
- else
51
+ find_spec_file(@template_podspec)
52
+ else
49
53
  binary_template_spec_file
50
54
  end
51
55
  end
@@ -54,9 +58,12 @@ module Pod
54
58
  def spec_file
55
59
  @spec_file ||= begin
56
60
  if @podspec
57
- find_spec_file(@podspec)
61
+ find_spec_file(@podspec)
58
62
  else
59
- raise Informative, "当前目录下没有找到可用源码 podspec." if code_spec_files.empty?
63
+ if code_spec_files.empty?
64
+ raise Informative, '当前目录下没有找到可用源码 podspec.'
65
+ end
66
+
60
67
  code_spec_files.first
61
68
  end
62
69
  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 Spec < Bin
9
+ class Spec < Bin
8
10
  class Lint < Spec
9
11
  self.summary = 'lint spec.'
10
12
  self.description = <<-DESC
@@ -12,7 +14,7 @@ module Pod
12
14
  DESC
13
15
 
14
16
  self.arguments = [
15
- CLAide::Argument.new(%w(NAME.podspec DIRECTORY http://PATH/NAME.podspec), false, true),
17
+ CLAide::Argument.new(%w[NAME.podspec DIRECTORY http://PATH/NAME.podspec], false, true)
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
  "--sources=#{sources_option(@code_dependencies, @sources)}",
49
51
  *@additional_args
@@ -53,7 +55,9 @@ module Pod
53
55
 
54
56
  if @loose_options
55
57
  argvs += ['--allow-warnings']
56
- argvs << '--use-libraries' if code_spec&.all_dependencies&.any?
58
+ if code_spec&.all_dependencies&.any?
59
+ argvs << '--use-libraries'
60
+ end
57
61
  end
58
62
 
59
63
  lint = Pod::Command::Spec::Lint.new(CLAide::ARGV.new(argvs))
@@ -71,8 +75,8 @@ module Pod
71
75
  def template_spec_file
72
76
  @template_spec_file ||= begin
73
77
  if @template_podspec
74
- find_spec_file(@template_podspec)
75
- else
78
+ find_spec_file(@template_podspec)
79
+ else
76
80
  binary_template_spec_file
77
81
  end
78
82
  end
@@ -83,11 +87,15 @@ module Pod
83
87
  if @podspec
84
88
  find_spec_file(@podspec) || @podspec
85
89
  else
86
- raise Informative, "当前目录下没有找到可用源码 podspec." if code_spec_files.empty?
90
+ if code_spec_files.empty?
91
+ raise Informative, '当前目录下没有找到可用源码 podspec.'
92
+ end
87
93
 
88
94
  spec_file = if @binary
89
95
  code_spec = Pod::Specification.from_file(code_spec_files.first)
90
- template_spec = Pod::Specification.from_file(template_spec_file) if template_spec_file
96
+ if template_spec_file
97
+ template_spec = Pod::Specification.from_file(template_spec_file)
98
+ end
91
99
  create_binary_spec_file(code_spec, template_spec)
92
100
  else
93
101
  code_spec_files.first
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Pod
2
4
  class Command
3
5
  class Bin < Command
4
- class Umbrella < Bin
6
+ class Umbrella < Bin
5
7
  self.summary = '生成伞头文件 .'
6
8
 
7
9
  self.arguments = [
8
- CLAide::Argument.new('PATH', false),
10
+ CLAide::Argument.new('PATH', false)
9
11
  ]
10
12
 
11
13
  def initialize(argv)
@@ -16,7 +18,9 @@ module Pod
16
18
 
17
19
  def validate!
18
20
  super
19
- help! '[!] No `Podspec` found in the project directory.' if @spec_file.nil?
21
+ if @spec_file.nil?
22
+ help! '[!] No `Podspec` found in the project directory.'
23
+ end
20
24
  end
21
25
 
22
26
  def run
@@ -26,13 +30,15 @@ module Pod
26
30
 
27
31
  UI.puts "Generateing umbrella file for #{pod_name}"
28
32
 
29
- header_generator = Pod::Generator::Header.new(Platform.ios)
33
+ header_generator = Pod::Generator::Header.new(Platform.ios)
30
34
  spec = Pod::Specification.from_file(Pathname.new(@spec_file))
31
35
  public_header_files = spec.consumer(:ios).public_header_files
32
- public_header_files = spec.consumer(:ios).source_files if public_header_files.empty?
36
+ if public_header_files.empty?
37
+ public_header_files = spec.consumer(:ios).source_files
38
+ end
33
39
  public_header_files = Pathname.glob(public_header_files).map(&:basename).select do |pathname|
34
40
  pathname.extname.to_s == '.h' &&
35
- pathname.basename('.h').to_s != pod_name
41
+ pathname.basename('.h').to_s != pod_name
36
42
  end
37
43
 
38
44
  header_generator.imports = public_header_files
@@ -41,7 +47,7 @@ module Pod
41
47
 
42
48
  header_generator.save_as(@path)
43
49
 
44
- UI.puts "Done!".green
50
+ UI.puts 'Done!'.green
45
51
  end
46
52
  end
47
53
  end
@@ -1,23 +1,24 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yaml'
2
4
 
3
5
  module CBin
4
6
  class Config
5
7
  def config_file
6
- File.expand_path("#{Pod::Config.instance.home_dir}/bin.yml")
8
+ File.expand_path("#{Pod::Config.instance.home_dir}/bin.yml")
7
9
  end
8
10
 
9
-
10
11
  def template_hash
11
12
  {
12
13
  'code_repo_url' => { description: '源码私有源 Git 地址', default: 'git@git.2dfire.net:ios/cocoapods-spec.git' },
13
14
  'binary_repo_url' => { description: '二进制私有源 Git 地址', default: 'git@git.2dfire.net:ios/cocoapods-spec-binary.git' },
14
15
  'binary_download_url' => { description: '二进制下载地址,内部会依次传入组件名称与版本,替换字符串中的 %s ', default: 'http://iosframeworkserver-shopkeeperclient.app.2dfire.com/download/%s/%s.zip' },
15
16
  # 'binary_type' => { description: '二进制打包类型', default: 'framework', selection: %w[framework library] },
16
- 'download_file_type' => { description: '下载二进制文件类型', default: 'zip', selection: %w[zip tgz tar tbz txz dmg] },
17
+ 'download_file_type' => { description: '下载二进制文件类型', default: 'zip', selection: %w[zip tgz tar tbz txz dmg] }
17
18
  }
18
19
  end
19
20
 
20
- def sync_config(config)
21
+ def sync_config(config)
21
22
  File.open(config_file, 'w+') do |f|
22
23
  f.write(config.to_yaml)
23
24
  end
@@ -29,16 +30,16 @@ module CBin
29
30
 
30
31
  private
31
32
 
32
- def load_config
33
- if File.exists?(config_file)
33
+ def load_config
34
+ if File.exist?(config_file)
34
35
  YAML.load_file(config_file)
35
- else
36
+ else
36
37
  default_config
37
38
  end
38
39
  end
39
40
 
40
- def config
41
- @config ||= begin
41
+ def config
42
+ @config ||= begin
42
43
  @config = OpenStruct.new load_config
43
44
  validate!
44
45
  @config
@@ -48,10 +49,13 @@ module CBin
48
49
  def validate!
49
50
  template_hash.each do |k, v|
50
51
  selection = v[:selection]
51
- next if !selection || selection.empty?
52
+ next if !selection || selection.empty?
53
+
52
54
  config_value = @config.send(k)
53
55
  next unless config_value
54
- raise Pod::Informative, "#{k} 字段的值必须限定在可选值 [ #{selection.join(' / ')} ] 内".red unless selection.include?(config_value)
56
+ unless selection.include?(config_value)
57
+ raise Pod::Informative, "#{k} 字段的值必须限定在可选值 [ #{selection.join(' / ')} ] 内".red
58
+ end
55
59
  end
56
60
  end
57
61
 
@@ -70,7 +74,7 @@ module CBin
70
74
  end
71
75
  end
72
76
 
73
- def self.config
77
+ def self.config
74
78
  @config ||= Config.new
75
- end
76
- end
79
+ end
80
+ end
@@ -1,18 +1,22 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yaml'
2
4
  require 'cocoapods-bin/config/config'
3
5
 
4
6
  module CBin
5
- class Config
6
- class Asker
7
- def show_prompt
7
+ class Config
8
+ class Asker
9
+ def show_prompt
8
10
  print ' > '.green
9
11
  end
10
12
 
11
13
  def ask_with_answer(question, pre_answer, selection)
12
14
  print "\n#{question}\n"
13
15
 
14
- print_selection_info = -> { print "可选值:[ #{selection.join(' / ')} ]\n" if selection }
15
- print_selection_info.call
16
+ print_selection_info = lambda {
17
+ print "可选值:[ #{selection.join(' / ')} ]\n" if selection
18
+ }
19
+ print_selection_info.call
16
20
  print "旧值:#{pre_answer}\n" unless pre_answer.nil?
17
21
 
18
22
  answer = ''
@@ -26,30 +30,29 @@ module CBin
26
30
  print "\n"
27
31
  end
28
32
 
29
- unless answer.empty?
30
- break if !selection || selection.include?(answer)
31
- print_selection_info.call
32
- end
33
+ next if answer.empty?
34
+ break if !selection || selection.include?(answer)
35
+
36
+ print_selection_info.call
33
37
  end
34
38
 
35
39
  answer
36
40
  end
37
41
 
38
-
39
42
  def wellcome_message
40
- print <<-EOF
43
+ print <<~EOF
41
44
 
42
- 开始设置二进制化初始信息.
43
- 所有的信息都会保存在 #{CBin.config.config_file} 文件中.
44
- 你可以在对应目录下手动添加编辑该文件. 文件包含的配置信息样式如下:
45
+ 开始设置二进制化初始信息.
46
+ 所有的信息都会保存在 #{CBin.config.config_file} 文件中.
47
+ 你可以在对应目录下手动添加编辑该文件. 文件包含的配置信息样式如下:
45
48
 
46
- #{CBin.config.default_config.to_yaml}
47
- EOF
49
+ #{CBin.config.default_config.to_yaml}
50
+ EOF
48
51
  end
49
52
 
50
53
  def done_message
51
54
  print "\n设置完成.\n".green
52
55
  end
53
- end
54
- end
55
- end
56
+ end
57
+ end
58
+ end
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module CBin
2
- VERSION = "0.1.24"
4
+ VERSION = '0.1.25'
3
5
  end
4
6
 
5
7
  module Pod
6
8
  def self.match_version?(*version)
7
- Gem::Dependency.new("", *version).match?('', Pod::VERSION)
9
+ Gem::Dependency.new('', *version).match?('', Pod::VERSION)
8
10
  end
9
- end
11
+ end