cocoapods-tdf-bin 0.0.16 → 0.0.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf063e0d4570d17654e501c087cd63ae676b990238bb720cf5ff5303972a6984
4
- data.tar.gz: c230891ecb4fbaacf6dcdedcb70f1c92610a164c31f75965a125fac8a49034de
3
+ metadata.gz: 0c0aa092f0b877d34f9d83f058a11fd05a1ba66970ea31d052139c6cf20ce067
4
+ data.tar.gz: 84105568bae6e85ba0a53fba5920542e3bcdd98dfd1c0cdb63c299f40c880b85
5
5
  SHA512:
6
- metadata.gz: e682d524e2a7ab92f8be63fd9aafa1ec1fb190b2397d5991e9e7873294d1cee4390c510390ef240a772580685633098970af651772289464323c0c3cd8cbe2b4
7
- data.tar.gz: 7a6c7498c6fc74a2972c157b92c6cf7181350e936ddf03e6c43defd9f4ed4063f67dd6b0ce3f03d6843f40c57fee36fbb086f13f91058e83cee1aa78727f52b2
6
+ metadata.gz: c11d27a445a8e609e2eee91dc2d82bd23ed8fcdb43f435173d728963f96a1bfd1767f514ac597bbc12c2c89fab4b329325cc57f37e2ff227815245e76788451a
7
+ data.tar.gz: e444caa31f9bc67f4e06770d57f738e9906a1fd57082f8108f611af260116fa3214db85a2d68198f0cfcc4e9b5cfc3aae57d8f6d21f683bdcb5dae92c462da21
@@ -0,0 +1,151 @@
1
+ require 'cocoapods-tdf-bin/native/podfile_env'
2
+ require 'cocoapods-tdf-bin/native/podfile'
3
+ require 'cocoapods-tdf-bin/helpers/string_helper'
4
+
5
+ module Pod
6
+ class Command
7
+ class Bin < Command
8
+ class Batch < Bin
9
+
10
+ self.summary = "批量操作本地依赖组件的 git 命令"
11
+ self.description = <<-DESC
12
+ 用来批量操作通过 batch_pod_local 本地依赖的组件库,比如 pod bin batch pull, pod bin batch checkout master 等等;
13
+ 操作的是是通过 batch_pod_local 依赖的本地组件
14
+ DESC
15
+
16
+ def self.options
17
+ [
18
+ ['clone', '本地库全部 clone 到指定本地目录'],
19
+ ['done', '完成本地库,自动将本地的 local 依赖改为remote依赖'],
20
+ ['{ git 命令 }', '本地库全部执行 git 命令,比如 pod bin batch pull, pod bin batch checkout -b feature/***'],
21
+ ]
22
+ end
23
+
24
+ def initialize(argv)
25
+ @arguments = argv.arguments
26
+ super
27
+ end
28
+
29
+ def run
30
+ podfile = File.join(Pathname.pwd, "Podfile")
31
+ podfile_instance = Pod::Podfile.from_file(podfile)
32
+ if podfile_instance.get_batch_local_pods == nil
33
+ help! "没有本地依赖的组件"
34
+ end
35
+ if @arguments.size == 1 && @arguments[0] == "clone"
36
+ clone_all(podfile_instance)
37
+ elsif @arguments.size == 1 && @arguments[0] == "done"
38
+ done_all(podfile_instance)
39
+ else
40
+ run_git(podfile_instance)
41
+ end
42
+ end
43
+
44
+ def validate!
45
+ if @arguments.size < 1
46
+ help! "命令参数不够"
47
+ end
48
+ git = `which git`
49
+ if git.empty?
50
+ help! "没有安装 git 命令"
51
+ end
52
+ end
53
+
54
+ def clone_all(podfile_instance)
55
+ local_pods = podfile_instance.get_batch_local_pods
56
+ local_pods.each_key do |name|
57
+ path = local_pods[name][0][:path]
58
+ repo_url = find_repo_with_pod(name)
59
+ puts "============== #{name} 开始 clone 到 #{path}==============".blue
60
+ puts `git clone #{repo_url} #{path}`
61
+ end
62
+ end
63
+
64
+ def run_git(podfile_instance)
65
+ podfile_instance.get_batch_local_pods.each_value do |value|
66
+ path = value[0][:path]
67
+ arg = @arguments.join(" ")
68
+ puts "============== #{path} 开始执行 git #{arg} 命令 ==============".blue
69
+ puts `git -C #{path} #{arg}`
70
+ end
71
+ end
72
+
73
+ def done_all(podfile_instance)
74
+ # 通过 local_batch 找出对应的group 和 branch 并分组
75
+ local_pods = podfile_instance.get_batch_local_pods
76
+ group_map = {}
77
+ local_pods.each_key do |name|
78
+ path = local_pods[name][0][:path]
79
+ git_url = `git -C #{path} remote get-url --push origin`
80
+ current_branch = `git -C #{path} branch --show-current`.delete!("\n")
81
+ group_name = get_group_with_repo(git_url)
82
+ puts "============== #{name} 当前分支 #{current_branch} 当前组 #{group_name} ==============".blue
83
+
84
+ group_key = "#{group_name}&&#{current_branch}"
85
+ repo_arr = group_map[group_key]
86
+ if repo_arr.is_a? Array
87
+ repo_arr << name
88
+ else
89
+ arr = [name]
90
+ group_map[group_key] = arr
91
+ end
92
+ end
93
+
94
+ # 生成对应的 bacth_pod_remte 字符串
95
+ pod_remote_str = ""
96
+ group_map.each_key do |key|
97
+ pod_remote_str << " batch_pod_remote [\n"
98
+ pod_names = group_map[key]
99
+ pod_names.each do |name|
100
+ pod_remote_str << " \"#{name}\",\n"
101
+ end
102
+ group = key.split("&&")[0]
103
+ branch = key.split("&&")[1]
104
+ pod_remote_str << " ], \"#{branch}\", \"#{group}\"\n\n"
105
+ end
106
+ puts "将 local_batch 依赖 替换为 \n#{pod_remote_str}".blue
107
+
108
+ # 替换 podfile 中的local batch
109
+ podfile = File.join(Pathname.pwd, "Podfile")
110
+ podfile_str = File.read(podfile).gsub(/ *batch_pod_local *\[([^\].]*)\], *".*"/, pod_remote_str)
111
+ File.open(podfile, "r+") do |podfile|
112
+ podfile << podfile_str
113
+ end
114
+ puts "替换成功".blue
115
+ end
116
+
117
+ def find_repo_with_pod(pod_name)
118
+ sources = config.sources_manager.all
119
+ sources = sources.select do |s|
120
+ s.name == "2dfire-cocoapods-spec"
121
+ end
122
+ source = sources[0]
123
+ repo_path = source.repo.to_s + "/#{pod_name}"
124
+ versions = `ls #{repo_path}`.split("\n")
125
+ versions = versions.sort do |x ,y|
126
+ y<=>x
127
+ end
128
+ last_version = versions[0]
129
+ spec_file = `ls #{repo_path}/#{last_version}`.split("\n")[0]
130
+ spec = Pod::Spec.from_file("#{repo_path}/#{last_version}/#{spec_file}")
131
+ git_url = spec.attributes_hash["source"]["git"]
132
+ git_url
133
+ end
134
+
135
+ def get_group_with_repo(repo_url)
136
+ if repo_url.start_with?("http")
137
+ re = Regexp.new("git.2dfire.net/.*/")
138
+ repo_group = repo_url.match(re)[0][15..-2]
139
+ else
140
+ re = Regexp.new("git.2dfire.net:.*/")
141
+ repo_group = repo_url.match(re)[0][15..-2]
142
+ end
143
+ repo_group
144
+ end
145
+
146
+ private :clone_all, :run_git, :find_repo_with_pod, :done_all, :get_group_with_repo
147
+
148
+ end
149
+ end
150
+ end
151
+ end
@@ -1,13 +1,9 @@
1
1
 
2
- require 'cocoapods-tdf-bin/command/bin/initHotKey'
3
2
  require 'cocoapods-tdf-bin/command/bin/init'
4
3
  require 'cocoapods-tdf-bin/command/bin/archive'
5
4
  require 'cocoapods-tdf-bin/command/bin/auto'
6
5
  require 'cocoapods-tdf-bin/command/bin/code'
7
- require 'cocoapods-tdf-bin/command/bin/update'
8
- require 'cocoapods-tdf-bin/command/bin/install'
9
- require 'cocoapods-tdf-bin/command/bin/imy'
10
-
6
+ require 'cocoapods-tdf-bin/command/bin/batch'
11
7
  require 'cocoapods-tdf-bin/helpers'
12
8
 
13
9
  module Pod
@@ -1,6 +1,6 @@
1
1
 
2
2
  module CBin
3
- VERSION = '0.0.16'
3
+ VERSION = '0.0.20'
4
4
  end
5
5
 
6
6
  module Pod
@@ -0,0 +1,30 @@
1
+ class String
2
+ # colorization
3
+ def colorize(color_code)
4
+ "\e[#{color_code}m#{self}\e[0m"
5
+ end
6
+
7
+ def red
8
+ colorize(31)
9
+ end
10
+
11
+ def green
12
+ colorize(32)
13
+ end
14
+
15
+ def yellow
16
+ colorize(33)
17
+ end
18
+
19
+ def blue
20
+ colorize(34)
21
+ end
22
+
23
+ def pink
24
+ colorize(35)
25
+ end
26
+
27
+ def light_blue
28
+ colorize(36)
29
+ end
30
+ end
@@ -21,6 +21,7 @@ module Pod
21
21
  def use_frameworks_value
22
22
  {:linkage => :static}
23
23
  end
24
+
24
25
  end
25
26
  end
26
27
  end
@@ -12,6 +12,46 @@ module Pod
12
12
  set_internal_hash_value(ALLOW_PRERELEASE, true)
13
13
  end
14
14
 
15
+ def batch_pod_local(pods, path = "../../")
16
+ pod_hash = Hash.new
17
+ pods.each do |name|
18
+ pod_hash[name] = [ :path => "#{path}#{name}" ]
19
+ end
20
+ if get_batch_local_pods.nil?
21
+ set_internal_hash_value(BATCH_POD_LOCAL, pod_hash)
22
+ else
23
+ set_internal_hash_value(BATCH_POD_LOCAL, get_internal_hash_value(BATCH_POD_LOCAL).merge(pod_hash))
24
+ end
25
+ end
26
+
27
+ def batch_pod_remote(pods, branch , group = 'ios')
28
+ pod_hash = Hash.new
29
+ pods.each do |name|
30
+ pod_hash[name] = [ :git => "git@git.2dfire.net:#{group}/#{name}.git", :branch => "#{branch}" ]
31
+ end
32
+ if get_batch_remote_pods.nil?
33
+ set_internal_hash_value(BATCH_POD_REMOTE, pod_hash)
34
+ else
35
+ set_internal_hash_value(BATCH_POD_REMOTE, get_internal_hash_value(BATCH_POD_REMOTE).merge(pod_hash))
36
+ end
37
+ end
38
+
39
+ def pod(name = nil, *requirements)
40
+ unless name
41
+ raise StandardError, 'A dependency requires a name.'
42
+ end
43
+
44
+ local_pod_hash = get_batch_local_pods
45
+ remote_pod_hash = get_batch_remote_pods
46
+ if remote_pod_hash != nil
47
+ requirements = remote_pod_hash[name].nil? ? requirements : remote_pod_hash[name];
48
+ end
49
+ if local_pod_hash != nil
50
+ requirements = local_pod_hash[name].nil? ? requirements : local_pod_hash[name];
51
+ end
52
+ current_target_definition.store_pod(name, *requirements)
53
+ end
54
+
15
55
  def use_binaries!(flag = true)
16
56
  set_internal_hash_value(USE_BINARIES, flag)
17
57
  end
@@ -61,6 +101,14 @@ module Pod
61
101
  get_internal_hash_value(USE_BINARIES, false) || ENV[USE_BINARIES] == 'true'
62
102
  end
63
103
 
104
+ def get_batch_local_pods
105
+ get_internal_hash_value(BATCH_POD_LOCAL)
106
+ end
107
+
108
+ def get_batch_remote_pods
109
+ get_internal_hash_value(BATCH_POD_REMOTE)
110
+ end
111
+
64
112
  def use_source_pods
65
113
  get_internal_hash_value(USE_SOURCE_PODS, []) + String(ENV[USE_SOURCE_PODS]).split('|').uniq
66
114
  end
@@ -8,6 +8,8 @@ module Pod
8
8
  ALLOW_PRERELEASE = 'allow_prerelease'
9
9
  USE_PLUGINS = 'use_plugins'
10
10
  CONFIGURATION_ENV = 'configuration_env'
11
+ BATCH_POD_LOCAL = 'batch_pod_local'
12
+ BATCH_POD_REMOTE = 'batch_pod_remote'
11
13
 
12
14
  module ENVExecutor
13
15
  def execute_with_bin_plugin(&block)
@@ -36,6 +36,7 @@ module Pod
36
36
  end
37
37
 
38
38
  use_frameworks!(generator.use_frameworks_value)
39
+ use_binaries!
39
40
 
40
41
  if (supported_swift_versions = generator.supported_swift_versions)
41
42
  supports_swift_versions(supported_swift_versions)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-tdf-bin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - gaijiaofan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-19 00:00:00.000000000 Z
11
+ date: 2021-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel
@@ -95,16 +95,13 @@ files:
95
95
  - lib/cocoapods-tdf-bin/command/bin.rb
96
96
  - lib/cocoapods-tdf-bin/command/bin/archive.rb
97
97
  - lib/cocoapods-tdf-bin/command/bin/auto.rb
98
+ - lib/cocoapods-tdf-bin/command/bin/batch.rb
98
99
  - lib/cocoapods-tdf-bin/command/bin/code.rb
99
- - lib/cocoapods-tdf-bin/command/bin/imy.rb
100
100
  - lib/cocoapods-tdf-bin/command/bin/init.rb
101
- - lib/cocoapods-tdf-bin/command/bin/initHotKey.rb
102
- - lib/cocoapods-tdf-bin/command/bin/install.rb
103
101
  - lib/cocoapods-tdf-bin/command/bin/lib/lint.rb
104
102
  - lib/cocoapods-tdf-bin/command/bin/repo/update.rb
105
103
  - lib/cocoapods-tdf-bin/command/bin/spec/create.rb
106
104
  - lib/cocoapods-tdf-bin/command/bin/spec/push.rb
107
- - lib/cocoapods-tdf-bin/command/bin/update.rb
108
105
  - lib/cocoapods-tdf-bin/config/config.rb
109
106
  - lib/cocoapods-tdf-bin/config/config_asker.rb
110
107
  - lib/cocoapods-tdf-bin/config/config_builder.rb
@@ -123,6 +120,7 @@ files:
123
120
  - lib/cocoapods-tdf-bin/helpers/spec_creator.rb
124
121
  - lib/cocoapods-tdf-bin/helpers/spec_files_helper.rb
125
122
  - lib/cocoapods-tdf-bin/helpers/spec_source_creator.rb
123
+ - lib/cocoapods-tdf-bin/helpers/string_helper.rb
126
124
  - lib/cocoapods-tdf-bin/helpers/upload_helper.rb
127
125
  - lib/cocoapods-tdf-bin/native.rb
128
126
  - lib/cocoapods-tdf-bin/native/acknowledgements.rb
@@ -1,46 +0,0 @@
1
- require 'cocoapods-tdf-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
- 如二进制私有源地址、源码私有源地址等。
11
- DESC
12
-
13
- self.arguments = [
14
- CLAide::Argument.new('1', false)
15
- ]
16
-
17
- def self.options
18
- [
19
- ].concat(super)
20
- end
21
-
22
- def initialize(argv)
23
- @hot_key = argv.shift_argument || '1'
24
- super
25
- end
26
-
27
- def run
28
- CBin.config_hot_key.set_hot_key_index(@hot_key)
29
- UI.puts "cd #{CBin.config_hot_key.hot_key_dir}".yellow
30
-
31
- if Dir.exist?(CBin.config_hot_key.hot_key_dir)
32
- Dir.chdir(CBin.config_hot_key.hot_key_dir) do
33
- UI.puts " #{CBin.config_hot_key.hot_key_cmd}".yellow
34
- system CBin.config_hot_key.hot_key_cmd
35
- end
36
- else
37
- raise "配置项中文件目录不存在 #{CBin.config_hot_key.hot_key_dir}"
38
- end
39
-
40
-
41
- end
42
-
43
- end
44
- end
45
- end
46
- end
@@ -1,70 +0,0 @@
1
-
2
- require 'cocoapods-tdf-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,44 +0,0 @@
1
-
2
- require 'cocoapods-tdf-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 拦截器,会加载本地Podfile_local文件,DSL加载到原始Podfile文件中。'
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
@@ -1,157 +0,0 @@
1
-
2
- require 'cocoapods'
3
- require 'cocoapods-tdf-bin/native/podfile_env'
4
- require 'cocoapods-tdf-bin/native/podfile'
5
-
6
- module Pod
7
- class Command
8
- class Bin < Command
9
- class Update < Bin
10
- include Pod
11
- include Pod::Podfile::DSL
12
-
13
- self.summary = 'pod update 拦截器,会加载本地Podfile_local文件,DSL加载到原始Podfile文件中。'
14
-
15
- self.description = <<-DESC
16
- pod update 拦截器,会加载本地Podfile_local文件
17
- 会通过DSL加载到原始Podfile文件中
18
- 支持 pod 'xxx' 各种写法
19
- 支持 post_install/pre_install钩子,采用覆盖做法
20
- DESC
21
- def self.options
22
- [
23
- ["--sources=#{Pod::TrunkSource::TRUNK_REPO_URL}", 'The sources from which to update dependent pods. ' \
24
- 'Multiple sources must be comma-delimited'],
25
- ['--exclude-pods=podName', 'Pods to exclude during update. Multiple pods must be comma-delimited'],
26
- ['--clean-install', 'Ignore the contents of the project cache and force a full pod installation. This only ' \
27
- 'applies to projects that have enabled incremental installation'],
28
- ['--project-directory=/project/dir/', 'The path to the root of the project directory'],
29
- ['--no-repo-update', 'Skip running `pod repo update` before install']
30
- ].concat(super)
31
- end
32
-
33
- def initialize(argv)
34
- @update = argv.flag?('update')
35
- super
36
- @additional_args = argv.remainder!
37
- end
38
-
39
- def run
40
- Update.load_local_podfile
41
-
42
- argvs = [
43
- *@additional_args
44
- ]
45
-
46
- gen = Pod::Command::Update.new(CLAide::ARGV.new(argvs))
47
- gen.validate!
48
- gen.run
49
- end
50
-
51
- def self.load_local_podfile
52
- # 同步 Podfile_local 文件
53
- project_root = Pod::Config.instance.project_root
54
- path = File.join(project_root.to_s, 'Podfile_local')
55
- unless File.exist?(path)
56
- path = File.join(project_root.to_s, 'Podfile_local')
57
- end
58
-
59
- if File.exist?(path)
60
- contents = File.open(path, 'r:utf-8', &:read)
61
-
62
- podfile = Pod::Config.instance.podfile
63
- local_podfile = Podfile.from_file(path)
64
-
65
- if local_podfile
66
- local_pre_install_callback = nil
67
- local_post_install_callback = nil
68
- local_podfile.instance_eval do
69
- local_pre_install_callback = @pre_install_callback
70
- local_post_install_callback = @post_install_callback
71
- end
72
- end
73
-
74
- podfile.instance_eval do
75
- begin
76
-
77
- # podfile HASH_KEYS才有plugins字段,否则会被限制
78
- if local_podfile.plugins.any?
79
- hash_plugins = podfile.plugins || {}
80
- hash_plugins = hash_plugins.merge(local_podfile.plugins)
81
- set_hash_value(%w[plugins].first, hash_plugins)
82
-
83
- # 加入源码白名单,避免本地库被二进制了
84
- podfile.set_use_source_pods(local_podfile.use_source_pods) if local_podfile.use_source_pods
85
- podfile.use_binaries!(local_podfile.use_binaries?)
86
- end
87
-
88
- # 在target把local-target中到dependencies值删除了,再设置
89
- # 把本地和原始到dependencies 合并,设置dependencies
90
- local_podfile&.target_definition_list&.each do |local_target|
91
- next if local_target.name == 'Pods'
92
-
93
- target_definition_list.each do |target|
94
-
95
- unless target.name == local_target.name &&
96
- (local_target.to_hash['dependencies'] &&local_target.to_hash['dependencies'].any?)
97
- next
98
- end
99
-
100
-
101
-
102
- target.instance_exec do
103
- # 在target把local-target中到dependencies值删除了,再设置
104
-
105
- local_dependencies = local_target.to_hash['dependencies']
106
- target_dependencies = target.to_hash['dependencies']
107
-
108
- local_dependencies.each do |local_dependency|
109
- unless local_dependency.is_a?(Hash) && local_dependency.keys.first
110
- next
111
- end
112
-
113
- target_dependencies.each do |target_dependency|
114
- dp_hash_equal = target_dependency.is_a?(Hash) &&
115
- target_dependency.keys.first &&
116
- target_dependency.keys.first == local_dependency.keys.first
117
- dp_str_equal = target_dependency.is_a?(String) &&
118
- target_dependency == local_dependency.keys.first
119
- next unless dp_hash_equal || dp_str_equal
120
-
121
- target_dependencies.delete target_dependency
122
- break
123
- end
124
- end
125
- # 把本地和原始到dependencies 合并,设置dependencies
126
- local_dependencies.each do |d|
127
- UI.message "Development Pod #{d.to_yaml}"
128
- if podfile.plugins.keys.include?('cocoapods-tdf-bin')
129
- podfile.set_use_source_pods(d.keys.first) if (d.is_a?(Hash) && d.keys.first)
130
- end
131
- end
132
- new_dependencies = target_dependencies + local_dependencies
133
- set_hash_value(%w[dependencies].first, new_dependencies)
134
-
135
- end
136
- end
137
-
138
- end
139
-
140
- if local_pre_install_callback
141
- @pre_install_callback = local_pre_install_callback
142
- end
143
- if local_post_install_callback
144
- @post_install_callback = local_post_install_callback
145
- end
146
- rescue Exception => e
147
- message = "Invalid `#{path}` file: #{e.message}"
148
- raise Pod::DSLError.new(message, path, e, contents)
149
- end
150
- end
151
-
152
- end
153
- end
154
- end
155
- end
156
- end
157
- end