cocoapods-mtxx-bin 0.0.13 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cocoapods-mtxx-bin/command/bin/buildAll.rb +45 -23
  3. data/lib/cocoapods-mtxx-bin/command/bin/init.rb +14 -36
  4. data/lib/cocoapods-mtxx-bin/command/bin/lock/dependency.rb +82 -0
  5. data/lib/cocoapods-mtxx-bin/command/bin/lock/spec_repo.rb +105 -0
  6. data/lib/cocoapods-mtxx-bin/command/bin/lock/version.rb +41 -0
  7. data/lib/cocoapods-mtxx-bin/command/bin/lock.rb +36 -0
  8. data/lib/cocoapods-mtxx-bin/command/bin/outputSource.rb +18 -11
  9. data/lib/cocoapods-mtxx-bin/command/bin/upload.rb +2 -2
  10. data/lib/cocoapods-mtxx-bin/command/bin.rb +11 -12
  11. data/lib/cocoapods-mtxx-bin/config/config.rb +24 -49
  12. data/lib/cocoapods-mtxx-bin/config/config_asker.rb +1 -4
  13. data/lib/cocoapods-mtxx-bin/gem_version.rb +1 -1
  14. data/lib/cocoapods-mtxx-bin/helpers/buildAll/bin_helper.rb +11 -0
  15. data/lib/cocoapods-mtxx-bin/helpers/buildAll/builder.rb +44 -39
  16. data/lib/cocoapods-mtxx-bin/helpers/buildAll/podspec_util.rb +11 -8
  17. data/lib/cocoapods-mtxx-bin/helpers/buildAll/zip_file_helper.rb +17 -13
  18. data/lib/cocoapods-mtxx-bin/helpers/pod_size_helper.rb +30 -12
  19. data/lib/cocoapods-mtxx-bin/native/installer.rb +8 -7
  20. data/lib/cocoapods-mtxx-bin/native/podfile.rb +8 -0
  21. data/lib/cocoapods-mtxx-bin/native/podfile_env.rb +1 -0
  22. data/lib/cocoapods-mtxx-bin/native/resolver.rb +31 -32
  23. data/lib/cocoapods-mtxx-bin/native/sources_manager.rb +2 -1
  24. data/lib/cocoapods-mtxx-bin/source_provider_hook.rb +4 -2
  25. metadata +6 -6
  26. data/lib/cocoapods-mtxx-bin/command/bin/imy.rb +0 -45
  27. data/lib/cocoapods-mtxx-bin/command/bin/initHotKey.rb +0 -70
  28. data/lib/cocoapods-mtxx-bin/config/config_hot_key.rb +0 -103
  29. data/lib/cocoapods-mtxx-bin/config/config_hot_key_asker.rb +0 -57
@@ -6,7 +6,7 @@ require 'cocoapods-mtxx-bin/native/podfile'
6
6
  require 'cocoapods-mtxx-bin/native/sources_manager'
7
7
  require 'cocoapods-mtxx-bin/native/installation_options'
8
8
  require 'cocoapods-mtxx-bin/gem_version'
9
- require 'cocoapods-mtxx-bin/command/bin/archive'
9
+ # require 'cocoapods-mtxx-bin/command/bin/archive'
10
10
  require 'cocoapods-mtxx-bin/helpers/buildAll/bin_helper'
11
11
  require 'cocoapods-mtxx-bin/config/config'
12
12
 
@@ -91,8 +91,7 @@ module Pod
91
91
 
92
92
  # 读取黑名单
93
93
  def read_black_list
94
- binary_dir = CBin.config.binary_dir
95
- config_file = File.join(binary_dir, 'BinConfig.yaml')
94
+ config_file = File.join(Pod::Config.instance.project_root, 'BinConfig.yaml')
96
95
  return nil unless File.exist?(config_file)
97
96
  config = YAML.load(File.open(config_file))
98
97
  return nil if config.nil?
@@ -232,35 +231,35 @@ module Pod
232
231
  end.compact
233
232
  end
234
233
 
235
- if missing_binary_specs.any?
236
- missing_binary_specs.uniq.each do |spec|
237
- # UI.message "【#{spec.name} | #{spec.version}】组件无对应二进制版本 , 将采用源码依赖." unless spec.root.source[:type] == 'zip'
238
- end
239
- # 下面的代码为了实现 auto 命令的 --all-make
240
- Pod::Command::Bin::Archive.missing_binary_specs(missing_binary_specs)
241
- #缓存没有二进制组件到spec文件,local_psec_dir 目录
242
- sources_sepc = []
243
- des_dir = CBin::Config::Builder.instance.local_psec_dir
244
- FileUtils.rm_f(des_dir) if File.exist?des_dir
245
- Dir.mkdir des_dir unless File.exist?des_dir
246
- missing_binary_specs.uniq.each do |spec|
247
- # 排除subspec
248
- next if spec.name.include?('/')
249
-
250
- spec_git_res = false
251
- CBin::Config::Builder.instance.ignore_git_list.each do |ignore_git|
252
- spec_git_res = spec.source[:git] && spec.source[:git].include?(ignore_git)
253
- break if spec_git_res
254
- end
255
- next if spec_git_res
256
-
257
- #获取没有制作二进制版本的spec集合
258
- sources_sepc << spec
259
- unless spec.defined_in_file.nil?
260
- FileUtils.cp("#{spec.defined_in_file}", "#{des_dir}")
261
- end
262
- end
263
- end
234
+ # if missing_binary_specs.any?
235
+ # missing_binary_specs.uniq.each do |spec|
236
+ # # UI.message "【#{spec.name} | #{spec.version}】组件无对应二进制版本 , 将采用源码依赖." unless spec.root.source[:type] == 'zip'
237
+ # end
238
+ # # 下面的代码为了实现 auto 命令的 --all-make
239
+ # Pod::Command::Bin::Archive.missing_binary_specs(missing_binary_specs)
240
+ # #缓存没有二进制组件到spec文件,local_psec_dir 目录
241
+ # sources_sepc = []
242
+ # des_dir = CBin::Config::Builder.instance.local_psec_dir
243
+ # FileUtils.rm_f(des_dir) if File.exist?des_dir
244
+ # Dir.mkdir des_dir unless File.exist?des_dir
245
+ # missing_binary_specs.uniq.each do |spec|
246
+ # # 排除subspec
247
+ # next if spec.name.include?('/')
248
+ #
249
+ # spec_git_res = false
250
+ # CBin::Config::Builder.instance.ignore_git_list.each do |ignore_git|
251
+ # spec_git_res = spec.source[:git] && spec.source[:git].include?(ignore_git)
252
+ # break if spec_git_res
253
+ # end
254
+ # next if spec_git_res
255
+ #
256
+ # #获取没有制作二进制版本的spec集合
257
+ # sources_sepc << spec
258
+ # unless spec.defined_in_file.nil?
259
+ # FileUtils.cp("#{spec.defined_in_file}", "#{des_dir}")
260
+ # end
261
+ # end
262
+ # end
264
263
 
265
264
  specs_by_target
266
265
  end
@@ -8,7 +8,8 @@ module Pod
8
8
  class Manager
9
9
  # 源码 source list
10
10
  def code_source_list
11
- CBin.config.code_repo_url_list.split(";").map { |source| source_with_name_or_url(source)}
11
+ []
12
+ # CBin.config.code_repo_url_list.split(";").map { |source| source_with_name_or_url(source)}
12
13
  end
13
14
  # 二进制 source
14
15
  def binary_source
@@ -6,6 +6,9 @@ require 'yaml'
6
6
 
7
7
  Pod::HooksManager.register('cocoapods-mtxx-bin', :pre_install) do |_context, _|
8
8
  require 'cocoapods-mtxx-bin/native'
9
+ require 'cocoapods-mtxx-bin/helpers/buildAll/bin_helper'
10
+
11
+ Pod::UI.puts "当前configuration: `#{CBin::BuildAll::BinHelper.configuration}`".green
9
12
 
10
13
  # pod bin repo update 更新二进制私有源
11
14
  Pod::Command::Bin::Repo::Update.new(CLAide::ARGV.new($ARGV)).run
@@ -45,8 +48,7 @@ Pod::HooksManager.register('cocoapods-mtxx-bin', :source_provider) do |context,
45
48
  podfile = Pod::Config.instance.podfile
46
49
  if podfile
47
50
  # 读取配置文件
48
- project_root = CBin.config.binary_dir
49
- config_file = File.join(project_root, 'BinConfig.yaml')
51
+ config_file = File.join(Pod::Config.instance.project_root, 'BinConfig.yaml')
50
52
  if File.exist?(config_file)
51
53
  config = YAML.load(File.open(config_file))
52
54
  unless config.nil?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-mtxx-bin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jensen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-28 00:00:00.000000000 Z
11
+ date: 2022-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel
@@ -103,11 +103,13 @@ files:
103
103
  - lib/cocoapods-mtxx-bin/command/bin/auto.rb
104
104
  - lib/cocoapods-mtxx-bin/command/bin/buildAll.rb
105
105
  - lib/cocoapods-mtxx-bin/command/bin/code.rb
106
- - lib/cocoapods-mtxx-bin/command/bin/imy.rb
107
106
  - lib/cocoapods-mtxx-bin/command/bin/init.rb
108
- - lib/cocoapods-mtxx-bin/command/bin/initHotKey.rb
109
107
  - lib/cocoapods-mtxx-bin/command/bin/install.rb
110
108
  - lib/cocoapods-mtxx-bin/command/bin/lib/lint.rb
109
+ - lib/cocoapods-mtxx-bin/command/bin/lock.rb
110
+ - lib/cocoapods-mtxx-bin/command/bin/lock/dependency.rb
111
+ - lib/cocoapods-mtxx-bin/command/bin/lock/spec_repo.rb
112
+ - lib/cocoapods-mtxx-bin/command/bin/lock/version.rb
111
113
  - lib/cocoapods-mtxx-bin/command/bin/outputSource.rb
112
114
  - lib/cocoapods-mtxx-bin/command/bin/repo.rb
113
115
  - lib/cocoapods-mtxx-bin/command/bin/repo/push.rb
@@ -120,8 +122,6 @@ files:
120
122
  - lib/cocoapods-mtxx-bin/config/config.rb
121
123
  - lib/cocoapods-mtxx-bin/config/config_asker.rb
122
124
  - lib/cocoapods-mtxx-bin/config/config_builder.rb
123
- - lib/cocoapods-mtxx-bin/config/config_hot_key.rb
124
- - lib/cocoapods-mtxx-bin/config/config_hot_key_asker.rb
125
125
  - lib/cocoapods-mtxx-bin/gem_version.rb
126
126
  - lib/cocoapods-mtxx-bin/helpers.rb
127
127
  - lib/cocoapods-mtxx-bin/helpers/Info.plist
@@ -1,45 +0,0 @@
1
- require 'cocoapods-mtxx-bin/config/config_hot_key_asker'
2
-
3
- module Pod
4
- class Command
5
- class Bin < Command
6
- class Imy < Bin
7
- self.summary = '设置快捷键'
8
- self.description = <<-DESC
9
- 设置快捷键
10
- DESC
11
-
12
- self.arguments = [
13
- CLAide::Argument.new('1', false)
14
- ]
15
-
16
- def self.options
17
- [
18
- ].concat(super)
19
- end
20
-
21
- def initialize(argv)
22
- @hot_key = argv.shift_argument || '1'
23
- super
24
- end
25
-
26
- def run
27
- CBin.config_hot_key.set_hot_key_index(@hot_key)
28
- UI.puts "cd #{CBin.config_hot_key.hot_key_dir}".yellow
29
-
30
- if Dir.exist?(CBin.config_hot_key.hot_key_dir)
31
- Dir.chdir(CBin.config_hot_key.hot_key_dir) do
32
- UI.puts " #{CBin.config_hot_key.hot_key_cmd}".yellow
33
- system CBin.config_hot_key.hot_key_cmd
34
- end
35
- else
36
- raise "配置项中文件目录不存在 #{CBin.config_hot_key.hot_key_dir}"
37
- end
38
-
39
-
40
- end
41
-
42
- end
43
- end
44
- end
45
- end
@@ -1,70 +0,0 @@
1
-
2
- require 'cocoapods-mtxx-bin/config/config_hot_key_asker'
3
-
4
- module Pod
5
- class Command
6
- class Bin < Command
7
- class Inithk < Bin
8
- self.summary = '初始化快捷键配置'
9
- self.description = <<-DESC
10
- 创建 文件,在其中保存插件需要的配置信息,
11
- 如二进制私有源地址、源码私有源地址等。
12
- DESC
13
-
14
- def self.options
15
- [
16
- ['--bin-url=URL', '配置文件地址,直接从此地址下载配置文件']
17
- ].concat(super)
18
- end
19
-
20
- def initialize(argv)
21
- @bin_url = argv.option('bin-url')
22
- super
23
- end
24
-
25
- def run
26
- if @bin_url.nil?
27
- config_with_asker
28
- else
29
- config_with_url(@bin_url)
30
- end
31
- end
32
-
33
- private
34
-
35
- def config_with_url(url)
36
- require 'open-uri'
37
-
38
- UI.puts "开始下载配置文件...\n"
39
- file = open(url)
40
- contents = YAML.safe_load(file.read)
41
-
42
- UI.puts "开始同步配置文件...\n"
43
- CBin.config_hot_key.sync_config(contents.to_hash)
44
- UI.puts "设置完成.\n".green
45
- rescue Errno::ENOENT => e
46
- raise Informative, "配置文件路径 #{url} 无效,请确认后重试."
47
- end
48
-
49
- def config_with_asker
50
- asker = CBin::Config_Hot_Key::Asker.new
51
- asker.wellcome_message
52
-
53
- config = {}
54
- template_hash = CBin.config_hot_key.template_hash
55
- template_hash.each do |k, v|
56
- default = begin
57
- CBin.config_hot_key.send(k)
58
- rescue StandardError
59
- nil
60
- end
61
- config[k] = asker.ask_with_answer(v[:description], default, v[:selection])
62
- end
63
-
64
- CBin.config_hot_key.sync_config(config)
65
- asker.done_message
66
- end
67
- end
68
- end
69
- end
70
- end
@@ -1,103 +0,0 @@
1
- require 'yaml'
2
- require 'cocoapods-mtxx-bin/native/podfile'
3
- require 'cocoapods-mtxx-bin/native/podfile_env'
4
- require 'cocoapods/generate'
5
-
6
- module CBin
7
- class Config_Hot_Key
8
-
9
- def config_file
10
- config_file_with_hot_key_index(hot_key_index)
11
- end
12
-
13
- def template_hash
14
- {
15
- 'hot_key_index' => { description: '快捷键', default: '1', selection: %w[1 2 3...] },
16
- 'hot_key_dir' => { description: '快捷键执行目录', default: '' },
17
- 'hot_key_cmd' => { description: '快捷键执行命令', default: 'pod bin update --no-repo-update' }
18
- }
19
- end
20
-
21
- def config_file_with_hot_key_index(hot_key_index)
22
- file = config_file_whith_hot_key_index(hot_key_index)
23
- raise "\n===== #{hot_key_index} 参数有误,请检查%w[1 2 3...]===" unless (hot_key_index.to_i).is_a?(Integer)
24
- File.expand_path("#{Pod::Config.instance.home_dir}/#{file}")
25
- end
26
-
27
- def hot_key_index
28
- @hot_key_index = 1 if @hot_key_index.is_a?(NilClass)
29
- @hot_key_index
30
- end
31
-
32
- def set_hot_key_index(hot_key_index)
33
- @hot_key_index = hot_key_index
34
- end
35
-
36
- def config_file_whith_hot_key_index(hot_key_index)
37
- "hot_key_#{hot_key_index}.yml"
38
- end
39
-
40
- def sync_config(config)
41
- File.open(config_file_with_hot_key_index(config['hot_key_index']), 'w+') do |f|
42
- f.write(config.to_yaml)
43
- end
44
- end
45
-
46
- def default_config
47
- @default_config ||= Hash[template_hash.map { |k, v| [k, v[:default]] }]
48
- end
49
-
50
- private
51
-
52
- def load_config
53
- file = config_file
54
- if (!file.nil?) && File.exist?(config_file)
55
- YAML.load_file(config_file)
56
- else
57
- default_config
58
- end
59
- end
60
-
61
- def config
62
- @config ||= begin
63
- puts "====== cocoapods-mtxx-bin #{CBin::VERSION} 版本 ======== \n"
64
- @config = OpenStruct.new load_config
65
- validate!
66
- @config
67
- end
68
- end
69
-
70
- def validate!
71
- template_hash.each do |k, v|
72
- selection = v[:selection]
73
- next if !selection || selection.empty?
74
-
75
- config_value = @config.send(k)
76
- next unless config_value
77
- unless selection.include?(config_value)
78
- raise Pod::Informative, "#{k} 字段的值必须限定在可选值 [ #{selection.join(' / ')} ] 内".red
79
- end
80
- end
81
- end
82
-
83
- def respond_to_missing?(method, include_private = false)
84
- config.respond_to?(method) || super
85
- end
86
-
87
- def method_missing(method, *args, &block)
88
- if config.respond_to?(method)
89
- config.send(method, *args)
90
- elsif template_hash.keys.include?(method.to_s)
91
- raise Pod::Informative, "#{method} 字段必须在配置文件 #{config_file} 中设置, 请执行 init 命令配置或手动修改配置文件".red
92
- else
93
- super
94
- end
95
- end
96
- end
97
-
98
- def self.config_hot_key
99
- @config_hot_key ||= Config_Hot_Key.new
100
- end
101
-
102
- end
103
-
@@ -1,57 +0,0 @@
1
- require 'yaml'
2
- require 'cocoapods-mtxx-bin/config/config_hot_key'
3
-
4
- module CBin
5
- class Config_Hot_Key
6
- class Asker
7
- def show_prompt
8
- print ' > '.green
9
- end
10
-
11
- def ask_with_answer(question, pre_answer, selection)
12
- print "\n#{question}\n"
13
-
14
- print_selection_info = lambda {
15
- print "可选值:[ #{selection.join(' / ')} ]\n" if selection
16
- }
17
- print_selection_info.call
18
- print "旧值:#{pre_answer}\n" unless pre_answer.nil?
19
-
20
- answer = ''
21
- loop do
22
- show_prompt
23
- answer = STDIN.gets.chomp.strip
24
-
25
- if answer == '' && !pre_answer.nil?
26
- answer = pre_answer
27
- print answer.yellow
28
- print "\n"
29
- end
30
-
31
- next if answer.empty?
32
- break if !selection || selection.include?(answer)
33
-
34
- print_selection_info.call
35
- end
36
-
37
- answer
38
- end
39
-
40
- def wellcome_message
41
- print <<~EOF
42
-
43
- 开始设置快捷键 pod bin imy.
44
- 所有的信息都会保存在 #{CBin.config_hot_key.config_file} 文件中.
45
- %w[hot_key.yaml]
46
- 你可以在对应目录下手动添加编辑该文件. 文件包含的配置信息样式如下:
47
-
48
- #{CBin.config_hot_key.default_config.to_yaml}
49
- EOF
50
- end
51
-
52
- def done_message
53
- print "\n设置完成.\n".green
54
- end
55
- end
56
- end
57
- end