cocoapods-meitu-bin 1.0.0

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 (80) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +20 -0
  3. data/README.md +56 -0
  4. data/lib/cocoapods-meitu-bin/command/bin/archive.rb +206 -0
  5. data/lib/cocoapods-meitu-bin/command/bin/auto.rb +212 -0
  6. data/lib/cocoapods-meitu-bin/command/bin/build_all.rb +345 -0
  7. data/lib/cocoapods-meitu-bin/command/bin/header_files_specifications.rb +262 -0
  8. data/lib/cocoapods-meitu-bin/command/bin/init.rb +72 -0
  9. data/lib/cocoapods-meitu-bin/command/bin/install.rb +44 -0
  10. data/lib/cocoapods-meitu-bin/command/bin/lib/lint.rb +67 -0
  11. data/lib/cocoapods-meitu-bin/command/bin/lock/dependency.rb +89 -0
  12. data/lib/cocoapods-meitu-bin/command/bin/lock/spec_repo.rb +105 -0
  13. data/lib/cocoapods-meitu-bin/command/bin/lock/version.rb +68 -0
  14. data/lib/cocoapods-meitu-bin/command/bin/lock.rb +36 -0
  15. data/lib/cocoapods-meitu-bin/command/bin/output_source.rb +146 -0
  16. data/lib/cocoapods-meitu-bin/command/bin/repo/push.rb +88 -0
  17. data/lib/cocoapods-meitu-bin/command/bin/repo/update.rb +42 -0
  18. data/lib/cocoapods-meitu-bin/command/bin/repo.rb +14 -0
  19. data/lib/cocoapods-meitu-bin/command/bin/source/add.rb +148 -0
  20. data/lib/cocoapods-meitu-bin/command/bin/source/delete.rb +59 -0
  21. data/lib/cocoapods-meitu-bin/command/bin/source/list.rb +46 -0
  22. data/lib/cocoapods-meitu-bin/command/bin/source.rb +30 -0
  23. data/lib/cocoapods-meitu-bin/command/bin/spec/create.rb +73 -0
  24. data/lib/cocoapods-meitu-bin/command/bin/spec/lint.rb +109 -0
  25. data/lib/cocoapods-meitu-bin/command/bin/spec.rb +13 -0
  26. data/lib/cocoapods-meitu-bin/command/bin/update.rb +154 -0
  27. data/lib/cocoapods-meitu-bin/command/bin/upload.rb +175 -0
  28. data/lib/cocoapods-meitu-bin/command/bin.rb +69 -0
  29. data/lib/cocoapods-meitu-bin/command.rb +1 -0
  30. data/lib/cocoapods-meitu-bin/config/config.rb +149 -0
  31. data/lib/cocoapods-meitu-bin/config/config_asker.rb +57 -0
  32. data/lib/cocoapods-meitu-bin/config/config_builder.rb +216 -0
  33. data/lib/cocoapods-meitu-bin/gem_version.rb +9 -0
  34. data/lib/cocoapods-meitu-bin/helpers/Info.plist +0 -0
  35. data/lib/cocoapods-meitu-bin/helpers/buildAll/bin_helper.rb +97 -0
  36. data/lib/cocoapods-meitu-bin/helpers/buildAll/builder.rb +434 -0
  37. data/lib/cocoapods-meitu-bin/helpers/buildAll/podspec_util.rb +140 -0
  38. data/lib/cocoapods-meitu-bin/helpers/buildAll/zip_file_helper.rb +87 -0
  39. data/lib/cocoapods-meitu-bin/helpers/build_helper.rb +167 -0
  40. data/lib/cocoapods-meitu-bin/helpers/build_utils.rb +64 -0
  41. data/lib/cocoapods-meitu-bin/helpers/framework.rb +86 -0
  42. data/lib/cocoapods-meitu-bin/helpers/framework_builder.rb +551 -0
  43. data/lib/cocoapods-meitu-bin/helpers/library.rb +54 -0
  44. data/lib/cocoapods-meitu-bin/helpers/library_builder.rb +90 -0
  45. data/lib/cocoapods-meitu-bin/helpers/pod_size_helper.rb +54 -0
  46. data/lib/cocoapods-meitu-bin/helpers/sources_helper.rb +35 -0
  47. data/lib/cocoapods-meitu-bin/helpers/spec_creator.rb +170 -0
  48. data/lib/cocoapods-meitu-bin/helpers/spec_files_helper.rb +80 -0
  49. data/lib/cocoapods-meitu-bin/helpers/spec_source_creator.rb +304 -0
  50. data/lib/cocoapods-meitu-bin/helpers/upload_helper.rb +104 -0
  51. data/lib/cocoapods-meitu-bin/helpers.rb +5 -0
  52. data/lib/cocoapods-meitu-bin/native/acknowledgements.rb +27 -0
  53. data/lib/cocoapods-meitu-bin/native/analyzer.rb +109 -0
  54. data/lib/cocoapods-meitu-bin/native/file_accessor.rb +28 -0
  55. data/lib/cocoapods-meitu-bin/native/gen.rb +79 -0
  56. data/lib/cocoapods-meitu-bin/native/installation_options.rb +28 -0
  57. data/lib/cocoapods-meitu-bin/native/installer.rb +259 -0
  58. data/lib/cocoapods-meitu-bin/native/linter.rb +26 -0
  59. data/lib/cocoapods-meitu-bin/native/lockfile.rb +85 -0
  60. data/lib/cocoapods-meitu-bin/native/path_source.rb +33 -0
  61. data/lib/cocoapods-meitu-bin/native/pod_source_installer.rb +19 -0
  62. data/lib/cocoapods-meitu-bin/native/pod_target_installer.rb +87 -0
  63. data/lib/cocoapods-meitu-bin/native/podfile.rb +99 -0
  64. data/lib/cocoapods-meitu-bin/native/podfile_env.rb +38 -0
  65. data/lib/cocoapods-meitu-bin/native/podfile_generator.rb +201 -0
  66. data/lib/cocoapods-meitu-bin/native/podspec_finder.rb +25 -0
  67. data/lib/cocoapods-meitu-bin/native/resolver.rb +299 -0
  68. data/lib/cocoapods-meitu-bin/native/sandbox_analyzer.rb +34 -0
  69. data/lib/cocoapods-meitu-bin/native/source.rb +35 -0
  70. data/lib/cocoapods-meitu-bin/native/sources_manager.rb +21 -0
  71. data/lib/cocoapods-meitu-bin/native/specification.rb +31 -0
  72. data/lib/cocoapods-meitu-bin/native/target_validator.rb +41 -0
  73. data/lib/cocoapods-meitu-bin/native/validator.rb +40 -0
  74. data/lib/cocoapods-meitu-bin/native.rb +26 -0
  75. data/lib/cocoapods-meitu-bin/source_provider_hook.rb +68 -0
  76. data/lib/cocoapods-meitu-bin.rb +2 -0
  77. data/lib/cocoapods_plugin.rb +11 -0
  78. data/spec/command/bin_spec.rb +12 -0
  79. data/spec/spec_helper.rb +50 -0
  80. metadata +201 -0
@@ -0,0 +1,44 @@
1
+
2
+ require 'cocoapods-meitu-bin/command/bin/update'
3
+ module Pod
4
+ class Command
5
+ class Bin < Command
6
+ class Install < Bin
7
+ include Pod
8
+
9
+ self.summary = 'pod install 拦截器'
10
+
11
+ self.description = <<-DESC
12
+ pod install 拦截器,会加载本地Podfile_local文件
13
+ 会通过DSL加载到原始Podfile文件中
14
+ 支持 pod 'xxx' 各种写法
15
+ 支持 post_install/pre_install钩子,采用覆盖做法
16
+ DESC
17
+ def self.options
18
+ [
19
+ ['--repo-update', 'Force running `pod repo update` before install'],
20
+ ['--deployment', 'Disallow any changes to the Podfile or the Podfile.lock during installation'],
21
+ ['--clean-install', 'Ignore the contents of the project cache and force a full pod installation. This only ' \
22
+ 'applies to projects that have enabled incremental installation']
23
+ ].concat(super).reject { |(name, _)| name == '--no-repo-update' }
24
+ end
25
+
26
+ def initialize(argv)
27
+ @update = argv.flag?('update')
28
+ super
29
+ @additional_args = argv.remainder!
30
+ end
31
+
32
+ def run
33
+ Update.load_local_podfile
34
+ argvs = [
35
+ *@additional_args
36
+ ]
37
+ gen = Pod::Command::Install.new(CLAide::ARGV.new(argvs))
38
+ gen.validate!
39
+ gen.run
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,67 @@
1
+ require 'cocoapods-meitu-bin/config/config'
2
+ require 'cocoapods-meitu-bin/native/podfile'
3
+
4
+ module Pod
5
+ class Command
6
+ class Bin < Command
7
+ class Lib < Bin
8
+ class Lint < Lib
9
+ self.summary = 'lint 组件.'
10
+ self.description = <<-DESC
11
+ lint 二进制组件 / 源码组件
12
+ DESC
13
+
14
+ self.arguments = [
15
+ CLAide::Argument.new('NAME.podspec', false)
16
+ ]
17
+
18
+ # lib lint 不会下载 source,所以不能进行二进制 lint
19
+ # 要 lint 二进制版本,需要进行 spec lint,此 lint 会去下载 source
20
+ def self.options
21
+ [
22
+ ['--code-dependencies', '使用源码依赖进行 lint'],
23
+ ['--loose-options', '添加宽松的 options, 包括 --use-libraries (可能会造成 entry point (start) undefined)'],
24
+ ['--allow-prerelease', '允许使用 prerelease 的版本 lint']
25
+ ].concat(Pod::Command::Lib::Lint.options).concat(super).uniq
26
+ end
27
+
28
+ def initialize(argv)
29
+ @loose_options = argv.flag?('loose-options')
30
+ @code_dependencies = argv.flag?('code-dependencies')
31
+ @sources = argv.option('sources') || []
32
+ @allow_prerelease = argv.flag?('allow-prerelease')
33
+ @podspec = argv.shift_argument
34
+ super
35
+
36
+ @additional_args = argv.remainder!
37
+ end
38
+
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
43
+ argvs = [
44
+ @podspec || code_spec_files.first,
45
+ "--sources=#{sources_option(@code_dependencies, @sources)}",
46
+ *@additional_args
47
+ ]
48
+
49
+ if @loose_options
50
+ argvs << '--allow-warnings'
51
+ if code_spec&.all_dependencies&.any?
52
+ argvs << '--use-libraries'
53
+ end
54
+ end
55
+
56
+ lint = Pod::Command::Lib::Lint.new(CLAide::ARGV.new(argvs))
57
+ lint.validate!
58
+ lint.run
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,89 @@
1
+
2
+ module Pod
3
+ class Command
4
+ class Bin < Command
5
+ class Lock < Bin
6
+ class Dependency < Lock
7
+ include Pod
8
+
9
+ self.summary = '分析`POD_NAME`依赖的库'
10
+ self.description = <<-DESC
11
+ #{self.summary},如果加上`--reverse`,则分析依赖`POD_NAME`的库
12
+ DESC
13
+
14
+ self.arguments = [
15
+ CLAide::Argument.new('POD_NAME', true)
16
+ ]
17
+
18
+ def self.options
19
+ [
20
+ %w[--reverse 分析依赖`POD_NAME`的库]
21
+ ].concat(super).uniq
22
+ end
23
+
24
+ def initialize(argv)
25
+ super
26
+ @pod_name = argv.shift_argument
27
+ @reverse = argv.flag?('reverse', false)
28
+ end
29
+
30
+ def run
31
+ super
32
+ raise Informative, "请输入Pod库名称,如:AFNetworking" if @pod_name.nil?
33
+ if @reverse
34
+ reverse_dependencies
35
+ else
36
+ dependencies
37
+ end
38
+ end
39
+
40
+ def dependencies
41
+ deps = []
42
+ @analyze_result.specifications.map do |spec|
43
+ if spec.root.name == @pod_name
44
+ deps.concat(spec.dependencies)
45
+ end
46
+ end
47
+ UI.puts "\n"
48
+ if deps.empty?
49
+ UI.puts "`#{@pod_name}`无依赖的库".red
50
+ else
51
+ deps.reject! { |dep| dep.root_name == @pod_name }
52
+ unless deps.nil?
53
+ deps.uniq!
54
+ end
55
+ if deps.nil? or deps.empty?
56
+ UI.puts "`#{@pod_name}`无依赖的库".red
57
+ else
58
+ UI.puts "`#{@pod_name}`依赖的库如下:".yellow
59
+ deps.map { |dep| UI.puts "- #{dep}" }
60
+ UI.puts "total #{deps.size} deps".green
61
+ end
62
+ end
63
+ end
64
+
65
+ def reverse_dependencies
66
+ pods = []
67
+ @analyze_result.specifications.map do |spec|
68
+ spec.dependencies.map do |dep|
69
+ if dep.root_name == @pod_name and !spec.root.name.include?(@pod_name)
70
+ pods << spec.root.name
71
+ break
72
+ end
73
+ end
74
+ end
75
+ UI.puts "\n"
76
+ if pods.empty?
77
+ UI.puts "没有依赖`#{@pod_name}`的库".red
78
+ else
79
+ pods.uniq!
80
+ UI.puts "依赖`#{@pod_name}`的库如下:".yellow
81
+ pods.map { |pod| UI.puts "- #{pod}" }
82
+ UI.puts "total #{pods.size} pods".green
83
+ end
84
+ end
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,105 @@
1
+
2
+ module Pod
3
+ class Command
4
+ class Bin < Command
5
+ class Lock < Bin
6
+ class SpecRepo < Lock
7
+ include Pod
8
+
9
+ self.summary = '分析`podspec`源'
10
+ self.description = <<-DESC
11
+ #{self.summary},如果加`POD_NAME`,则分析该`POD_NAME`所属的repo仓库;如果不加,则打印项目中用到的repo仓库及每个仓库下Pod个数
12
+ DESC
13
+
14
+ self.arguments = [
15
+ CLAide::Argument.new('POD_NAME', false)
16
+ ]
17
+
18
+ def initialize(argv)
19
+ super
20
+ @pod_name = argv.shift_argument
21
+ end
22
+
23
+ def run
24
+ super
25
+ if @pod_name.nil?
26
+ spec_repo_summary
27
+ else
28
+ pod_source
29
+ end
30
+ end
31
+
32
+ private
33
+
34
+ def spec_repos
35
+ raise Informative, "依赖分析失败" if @analyze_result.nil?
36
+ result = Hash.new
37
+ @analyze_result.specs_by_source.map do |source, specs|
38
+ next unless source
39
+ next if specs.empty?
40
+ key = source.url || source.name
41
+
42
+ # save `trunk` as 'trunk' so that the URL itself can be changed without lockfile churn
43
+ key = Pod::TrunkSource::TRUNK_REPO_NAME if source.name == Pod::TrunkSource::TRUNK_REPO_NAME
44
+
45
+ value = specs.map { |s| s.root.name }.uniq
46
+ # 合并重复的source源,而不是替换
47
+ if result[key].nil?
48
+ result[key] = YAMLHelper.sorted_array(value)
49
+ else
50
+ result[key] = YAMLHelper.sorted_array(result[key].concat(value))
51
+ end
52
+ end
53
+ result.compact
54
+ end
55
+
56
+ def external_sources
57
+ deps = config.podfile.dependencies.select(&:external?)
58
+ deps = deps.sort { |d, other| d.name <=> other.name }
59
+ sources = {}
60
+ deps.each { |d| sources[d.root_name] = d.external_source }
61
+ sources
62
+ end
63
+
64
+ # 打印所有source及其pods个数
65
+ def spec_repo_summary
66
+ pod_count = 0
67
+ UI.puts "\n"
68
+ spec_repos.map do |source, specs|
69
+ pod_count += specs.size
70
+ UI.puts "#{source}".yellow
71
+ UI.puts "- #{specs.size} pods"
72
+ end
73
+ pod_count += external_sources.keys.size
74
+ UI.puts "External".yellow
75
+ UI.puts "- #{external_sources.keys.size} pods"
76
+
77
+ UI.puts "\n"
78
+ UI.puts "total #{spec_repos.size + 1} sources, #{pod_count} pods".green
79
+ end
80
+
81
+ # 打印pod所属的source
82
+ def pod_source
83
+ sources = []
84
+ external = false
85
+ spec_repos.map do |source, specs|
86
+ if specs.include?(@pod_name)
87
+ sources << source
88
+ end
89
+ end
90
+ external_sources.map do |pod, ext_source|
91
+ if pod == @pod_name
92
+ external = true
93
+ sources << ext_source
94
+ end
95
+ end
96
+ UI.puts "\n"
97
+ raise Informative, "未找到`#{@pod_name}`所属的source,请检查`#{@pod_name}`是否拼写错误" if sources.empty?
98
+ UI.puts "#{@pod_name}#{external ? ' (External Source)' : ''}".yellow
99
+ sources.map { |source| UI.puts "- #{source}" }
100
+ end
101
+ end
102
+ end
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,68 @@
1
+
2
+ module Pod
3
+ class Command
4
+ class Bin < Command
5
+ class Lock < Bin
6
+ class Version < Lock
7
+ include Pod
8
+
9
+ self.summary = '分析项目中使用的`Pod`库版本'
10
+
11
+ self.arguments = [
12
+ CLAide::Argument.new('POD_NAME', true)
13
+ ]
14
+
15
+ def self.options
16
+ [
17
+ %w[--source 查看二进制对应源码版本]
18
+ ].concat(super).uniq
19
+ end
20
+
21
+ def initialize(argv)
22
+ super
23
+ @pod_name = argv.shift_argument
24
+ @source = argv.flag?('source', false)
25
+ end
26
+
27
+ def run
28
+ super
29
+ raise Informative, "请输入Pod库名称,如:AFNetworking" if @pod_name.nil?
30
+ versions = []
31
+ @analyze_result.specifications.map do |spec|
32
+ if spec.name == @pod_name
33
+ versions << spec.version
34
+ end
35
+ end
36
+ versions = versions.uniq
37
+ UI.puts "\n"
38
+ raise Informative, "未查找到`#{@pod_name}`的版本号,请检查`#{@pod_name}`是否拼写错误" if versions.empty?
39
+ UI.puts "`#{@pod_name}`版本号如下:".yellow
40
+ versions.map do |v|
41
+ if @source
42
+ UI.puts "- #{get_source_version(v.to_s)}"
43
+ else
44
+ UI.puts "- #{v}"
45
+ end
46
+ end
47
+
48
+ UI.puts "[!] `#{@pod_name}`有`#{versions.size}`个版本,可能会导致意想不到的事情,请确保每个Pod库只有一个依赖版本".yellow if versions.size > 1
49
+ end
50
+
51
+ private
52
+
53
+ # 获取源码版本号
54
+ def get_source_version(version)
55
+ source_version = version
56
+ version_arr = version.split('.')
57
+ if version_arr.last.include?('bin')
58
+ version_arr.delete_at(version_arr.size - 1)
59
+ source_version = version_arr.join('.')
60
+ end
61
+ source_version
62
+ end
63
+
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,36 @@
1
+ require 'cocoapods-meitu-bin/command/bin/lock/spec_repo'
2
+ require 'cocoapods-meitu-bin/command/bin/lock/version'
3
+ require 'cocoapods-meitu-bin/command/bin/lock/dependency'
4
+
5
+ module Pod
6
+ class Command
7
+ class Bin < Command
8
+ class Lock < Bin
9
+ include Pod
10
+ include Config::Mixin
11
+
12
+ self.abstract_command = true
13
+ self.summary = '分析 Pod 依赖关系'
14
+
15
+ def initialize(argv)
16
+ super
17
+ end
18
+
19
+ def run
20
+ # 校验Podfile是否存在
21
+ verify_podfile_exists!
22
+ # 依赖分析
23
+ @analyze_result = analyze
24
+ end
25
+
26
+ # 依赖分析
27
+ def analyze
28
+ UI.title 'Analyze dependencies'.green do
29
+ analyzer = Pod::Installer::Analyzer.new(config.sandbox, config.podfile, config.lockfile)
30
+ analyzer.analyze(true )
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,146 @@
1
+ require 'cocoapods-meitu-bin/helpers/buildAll/builder'
2
+ require 'cocoapods-meitu-bin/helpers/buildAll/podspec_util'
3
+ require 'cocoapods-meitu-bin/helpers/buildAll/zip_file_helper'
4
+ require 'cocoapods-meitu-bin/helpers/buildAll/bin_helper'
5
+ require 'cocoapods-meitu-bin/config/config'
6
+ require 'yaml'
7
+ require 'digest'
8
+
9
+ module Pod
10
+ class Command
11
+ class Bin < Command
12
+ class OutputSource < Bin
13
+ self.summary = '输出各个组件的source源,默认输出全部组件的source'
14
+ self.description = <<-DESC
15
+ #{summary}
16
+ DESC
17
+
18
+ def self.options
19
+ [
20
+ %w[--error-source 过滤异常的source,比如http的,CI打包只支持SSH认证]
21
+ ].concat(super).uniq
22
+ end
23
+
24
+ def initialize(argv)
25
+ @error_source = argv.flag?('error-source', false)
26
+ super
27
+ end
28
+
29
+ def run
30
+ # 开始时间
31
+ @start_time = Time.now.to_i
32
+ # 更新repo仓库
33
+ repo_update
34
+ # 分析依赖
35
+ @analyze_result = analyse
36
+ # 打印source
37
+ show_cost_source
38
+ # 计算耗时
39
+ show_cost_time
40
+ end
41
+
42
+ private
43
+
44
+ # 打印source
45
+ def show_cost_source
46
+ all_source_list = []
47
+ error_source_list = []
48
+ @analyze_result.specifications.each do |specification|
49
+ all_source_list << { specification.root.name => specification.root.source }
50
+ if @error_source && invalid_git_address?(specification)
51
+ error_source_list << { specification.root.name => specification.root.source }
52
+ end
53
+ end
54
+ if @error_source
55
+ if error_source_list.uniq.empty?
56
+ UI.info "没有有问题的组件".green
57
+ else
58
+ UI.info '问题组件,source 为http CI打包不支持http认证,应修改为ssh'.red
59
+ error_source_list.uniq.map do |source|
60
+ UI.info "- #{source}".red
61
+ end
62
+ end
63
+ else
64
+ UI.info '输出所有pod组件source'.yellow
65
+ all_source_list.uniq.map do |source|
66
+ UI.info "- #{source}"
67
+ end
68
+ end
69
+ end
70
+
71
+ # git clone 地址 是否非法
72
+ def invalid_git_address?(specification)
73
+ return false if specification.root.source[:git].nil?
74
+ git = specification.root.source[:git]
75
+ git.include?('http://') || git.include?('https://')
76
+ end
77
+
78
+ # 打印耗时
79
+ def show_cost_time
80
+ return if @start_time.nil?
81
+ UI.info "总耗时:#{Time.now.to_i - @start_time}s".green
82
+ end
83
+
84
+ # 更新repo仓库
85
+ def repo_update
86
+ if @repo_update
87
+ UI.title 'Repo update'.green do
88
+ return if podfile.nil?
89
+ sources_manager = Pod::Config.instance.sources_manager
90
+ podfile.sources.uniq.map do |src|
91
+ UI.message "Update repo: #{src}"
92
+ source = sources_manager.source_with_name_or_url(src)
93
+ source.update(false)
94
+ end
95
+ end
96
+ end
97
+ end
98
+
99
+ # 获取 podfile
100
+ def podfile
101
+ @podfile ||= begin
102
+ podfile_path = File.join(Pathname.pwd, 'Podfile')
103
+ raise 'Podfile不存在' unless File.exist?(podfile_path)
104
+ sources_manager = Pod::Config.instance.sources_manager
105
+ podfile = Podfile.from_file(Pathname.new(podfile_path))
106
+ podfile_hash = podfile.to_hash
107
+ podfile_hash['sources'] = (podfile_hash['sources'] || []).concat(sources_manager.code_source_list.map(&:url))
108
+ podfile_hash['sources'] << sources_manager.binary_source.url
109
+ podfile_hash['sources'].uniq!
110
+ Podfile.from_hash(podfile_hash)
111
+ end
112
+ end
113
+
114
+ # 获取 podfile.lock
115
+ def lockfile
116
+ @lockfile ||= begin
117
+ lock_path = File.join(Pathname.pwd, 'Podfile.lock')
118
+ raise 'Podfile.lock不存在,请执行pod install' unless File.exist?(lock_path)
119
+ Lockfile.from_file(Pathname.new(lock_path))
120
+ end
121
+ end
122
+
123
+ # 获取 sandbox
124
+ def sandbox
125
+ @sandbox ||= begin
126
+ sandbox_path = File.join(Pathname.pwd, 'Pods')
127
+ raise 'Pods文件夹不存在,请执行pod install' unless File.exist?(sandbox_path)
128
+ Pod::Sandbox.new(sandbox_path)
129
+ end
130
+ end
131
+
132
+ # 根据podfile和podfile.lock分析依赖
133
+ def analyse
134
+ UI.title 'Analyze dependencies'.green do
135
+ analyzer = Pod::Installer::Analyzer.new(
136
+ sandbox,
137
+ podfile,
138
+ lockfile
139
+ )
140
+ analyzer.analyze(true)
141
+ end
142
+ end
143
+ end
144
+ end
145
+ end
146
+ end
@@ -0,0 +1,88 @@
1
+
2
+ require 'cocoapods-meitu-bin/config/config'
3
+ require 'cocoapods-meitu-bin/native/podfile'
4
+
5
+ module Pod
6
+ class Command
7
+ class Bin < Command
8
+ class Repo < Bin
9
+ class Push < Repo
10
+ self.summary = '发布组件'
11
+ self.description = <<-DESC
12
+ #{self.summary}
13
+ 跳过lint过程
14
+ DESC
15
+
16
+ self.arguments = [
17
+ CLAide::Argument.new('REPO', true ),
18
+ CLAide::Argument.new('NAME.podspec', false )
19
+ ]
20
+
21
+ def self.options
22
+ [].concat(Pod::Command::Repo::Push.options).concat(super).uniq
23
+ end
24
+
25
+ def initialize(argv)
26
+ @repo = argv.shift_argument
27
+ @podspec = argv.shift_argument
28
+ super
29
+
30
+ @additional_args = argv.remainder!
31
+ end
32
+
33
+ def run
34
+ argvs = [
35
+ @repo,
36
+ *@additional_args
37
+ ]
38
+
39
+ push = Pod::Command::Repo::Push.new(CLAide::ARGV.new(argvs))
40
+ push.validate!
41
+ push.run
42
+ ensure
43
+ clear_binary_spec_file_if_needed unless @reserve_created_spec
44
+ end
45
+
46
+ private
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
+ # spec_file = if @binary
68
+ # code_spec = Pod::Specification.from_file(code_spec_files.first)
69
+ # if template_spec_file
70
+ # template_spec = Pod::Specification.from_file(template_spec_file)
71
+ # end
72
+ # create_binary_spec_file(code_spec, template_spec)
73
+ # else
74
+ # code_spec_files.first
75
+ # end
76
+ # spec_file
77
+ # end
78
+ # end
79
+ # end
80
+ #
81
+ # def repo
82
+ # @binary ? binary_source.name : code_source_list.first.name
83
+ # end
84
+ end
85
+ end
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,42 @@
1
+ require 'parallel'
2
+
3
+ module Pod
4
+ class Command
5
+ class Bin < Command
6
+ class Repo < Bin
7
+ class Update < Repo
8
+ self.summary = '更新私有源'
9
+
10
+ self.arguments = [
11
+ CLAide::Argument.new('NAME', false)
12
+ ]
13
+
14
+ def self.options
15
+ [
16
+ ['--all', '更新所有私有源,默认只更新二进制相关私有源']
17
+ ].concat(super)
18
+ end
19
+
20
+ def initialize(argv)
21
+ @all = argv.flag?('all')
22
+ @name = argv.shift_argument
23
+ super
24
+ end
25
+
26
+ def run
27
+ if @all
28
+ config.sources_manager.update()
29
+ else
30
+ valid_sources.map { |source|
31
+ UI.puts "更新私有源仓库 #{source.to_s}"
32
+ source.update(false)
33
+ }
34
+ end
35
+ end
36
+
37
+
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end