cocoapods-tdf-bin 0.0.14 → 0.0.18

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: d58cea5d61fb520ad758e073c7a48ae4aa12e671ddbd5a37d9986dd6a95bb48c
4
- data.tar.gz: b624142d0d1188145253d0dae5a92b7ebfc8330ed473638f626d748f25bf4406
3
+ metadata.gz: e942896253a1d129115b23c8d16e0e8a48132ca908fd55c65418d8a5bc2eb852
4
+ data.tar.gz: f21420c824eccac318f510e969b2283e0dd84719dc4b2f119365c0ca4b402701
5
5
  SHA512:
6
- metadata.gz: c60b46825ec13f889eeeee0082e5963fba468a7ad6f62bde80bf1d0277cb3a2505c30a8920e198082cb89c6827d25ef1ae2c18c0a07b196149c57d69fd78184e
7
- data.tar.gz: de6cca9c41748e410a7b865ce4b90a5fbc2340b04dbf566abe17eeeaf0889e961ca87cb410681dc30f59bdfbd9447a375aea8bb7b0828f89710115e9ed1894c0
6
+ metadata.gz: 1e4ba88019303f1233cf55550f68b29393211c8f722c6e3de943d4c8f7049eb9f265d61f298de6e15397994a64f655ef71c74881dd2117b9e45b5cbc50b1174d
7
+ data.tar.gz: deb0038838eb9790bc855469bc738c589d5025592a411d4b6851b5db0f56f4f3958b6240706f4dc9df024d36edf325eaadcda28e4341167e04ec90f049b5615d
@@ -50,6 +50,7 @@ module Pod
50
50
  @additional_args = argv.remainder!
51
51
 
52
52
  Pod::Resolver.build_dependencies_only_build(@only_build)
53
+ Pod::Resolver.build_dependencies_bin(true)
53
54
 
54
55
  super
55
56
  end
@@ -0,0 +1,51 @@
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
+ ['pull', '本地库全部拉取'],
19
+ ['push', '本地库全部推送'],
20
+ ['chenckout {分支名}', '切换指定分支'],
21
+ ['chenckout -b {分支名}', '切出指定分支'],
22
+ ]
23
+ end
24
+
25
+ def initialize(argv)
26
+ @arguments = argv.arguments
27
+ super
28
+ end
29
+
30
+ def run
31
+ podfile = File.join(Pathname.pwd, "Podfile")
32
+ podfile_instance = Pod::Podfile.from_file(podfile)
33
+ podfile_instance.get_batch_local_pods.each_value do |value|
34
+ path = value[0][:path]
35
+ arg = @arguments.join(" ")
36
+ puts "============== #{path} 开始执行 git #{arg} 命令 ==============".blue
37
+ puts `git -C #{path} #{arg}`
38
+ end
39
+ end
40
+
41
+ def validate!
42
+ git = `which git`
43
+ if git.empty?
44
+ help! "没有安装 git 命令"
45
+ end
46
+ end
47
+
48
+ end
49
+ end
50
+ end
51
+ end
@@ -7,6 +7,7 @@ require 'cocoapods-tdf-bin/command/bin/code'
7
7
  require 'cocoapods-tdf-bin/command/bin/update'
8
8
  require 'cocoapods-tdf-bin/command/bin/install'
9
9
  require 'cocoapods-tdf-bin/command/bin/imy'
10
+ require 'cocoapods-tdf-bin/command/bin/batch'
10
11
 
11
12
  require 'cocoapods-tdf-bin/helpers'
12
13
 
@@ -1,6 +1,6 @@
1
1
 
2
2
  module CBin
3
- VERSION = '0.0.14'
3
+ VERSION = '0.0.18'
4
4
  end
5
5
 
6
6
  module Pod
@@ -258,8 +258,17 @@ module CBin
258
258
  resources.each do |source|
259
259
  escape_resource << Shellwords.join(source)
260
260
  end
261
- UI.message "Copying resources #{escape_resource}"
262
- `cp -rp #{escape_resource.join(' ')} #{resource_target_dir}`
261
+
262
+ escape_resource_str = escape_resource.join(' ')
263
+ escape_resource_arr = escape_resource_str.split(' ')
264
+
265
+ escape_resource_arr = escape_resource_arr.select do | source |
266
+ suffix = File.extname(source)
267
+ not expand_suffix(suffix)
268
+ end
269
+
270
+ UI.message "Copying resources #{escape_resource_arr}"
271
+ `cp -rp #{escape_resource_arr.join(' ')} #{resource_target_dir}`
263
272
  end
264
273
  end
265
274
 
@@ -269,6 +278,17 @@ module CBin
269
278
  end
270
279
  end
271
280
 
281
+ def expand_suffix(suffix)
282
+ case suffix
283
+ when '.storyboard' then true
284
+ when '.xib' then true
285
+ when '.xcdatamodel' then true
286
+ when '.xcdatamodeld' then true
287
+ when '.xcmappingmodel' then true
288
+ else false
289
+ end
290
+ end
291
+
272
292
  def framework
273
293
  @framework ||= begin
274
294
  framework = Framework.new(@spec.name, @platform.name.to_s)
@@ -119,8 +119,6 @@ module CBin
119
119
 
120
120
  @spec.resources = binary_resources if @spec.attributes_hash.keys.include?("resources")
121
121
 
122
-
123
-
124
122
  @spec
125
123
  end
126
124
 
@@ -133,7 +131,7 @@ module CBin
133
131
  end
134
132
 
135
133
  def framework_contents(name)
136
- ["#{code_spec.root.name}.framework", "#{code_spec.root.name}.framework/Versions/A"].map { |path| "#{path}/#{name}" }
134
+ ["#{code_spec.root.name}.framework"].map { |path| "#{path}/#{name}" }
137
135
  end
138
136
 
139
137
  def binary_source_files
@@ -140,8 +140,15 @@ module CBin
140
140
  if code_spec_consumer.resources.any?
141
141
  extnames += code_spec_consumer.resources.map { |r| File.basename(r) }
142
142
  end
143
+
144
+ extnames = extnames.select do | extname |
145
+ not expand_suffix(extname)
146
+ end
147
+
143
148
  if extnames.any?
144
- @spec.resources = framework_contents('Resources').flat_map { |r| extnames.map { |e| "#{r}/#{e}" } }
149
+ resources = framework_contents('Resources').flat_map { |r| extnames.map { |e| "#{r}/#{e}" } }
150
+ resources << "#{code_spec.root.name}.framework/*.{storyboardc,nib,mom,momd,cdm}"
151
+ @spec.resources = resources
145
152
  end
146
153
 
147
154
  # Source Location
@@ -182,6 +189,16 @@ module CBin
182
189
  @spec
183
190
  end
184
191
 
192
+ def expand_suffix(suffix)
193
+ if suffix.end_with?('.storyboard') ||
194
+ suffix.end_with?('.xib') ||
195
+ suffix.end_with?('.xcdatamodel') ||
196
+ suffix.end_with?('.xcdatamodeld') ||
197
+ suffix.end_with?('.xcmappingmodel')
198
+ return true
199
+ end
200
+ false
201
+ end
185
202
 
186
203
  def binary_source
187
204
  { http: format(CBin.config.binary_download_url, code_spec.root.name, code_spec.version), type: CBin.config.download_file_type }
@@ -192,7 +209,6 @@ module CBin
192
209
  end
193
210
 
194
211
  def framework_contents(name)
195
- # ["#{code_spec.root.name}.framework", "#{code_spec.root.name}.framework/Versions/A"].map { |path| "#{path}/#{name}" }
196
212
  ["#{code_spec.root.name}.framework"].map { |path| "#{path}/#{name}" }
197
213
  end
198
214
 
@@ -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)
@@ -11,8 +11,12 @@ require 'cocoapods-tdf-bin/command/bin/archive'
11
11
  module Pod
12
12
  class Resolver
13
13
 
14
+ # 仅仅只是编译出产物,不上传
14
15
  @@build_dependencies_only_build = false
15
16
 
17
+ # 是否是在进行二进制打包处理,没有的话一些步奏需要省略掉
18
+ @@build_dependencies_bin = false
19
+
16
20
  if Pod.match_version?('~> 1.6')
17
21
  # 其实不用到 resolver_specs_by_target 再改 spec
18
22
  # 在这个方法里面,通过修改 dependency 的 source 应该也可以
@@ -97,6 +101,11 @@ module Pod
97
101
  def Resolver.build_dependencies_only_build(only_build)
98
102
  @@build_dependencies_only_build = only_build
99
103
  end
104
+
105
+ def Resolver.build_dependencies_bin(bin)
106
+ @@build_dependencies_bin = bin
107
+ end
108
+
100
109
  end
101
110
 
102
111
  # >= 1.4.0 才有 resolver_specs_by_target 以及 ResolverSpecification
@@ -138,8 +147,11 @@ module Pod
138
147
  source = use_binary ? sources_manager.binary_source : sources_manager.code_source
139
148
 
140
149
  spec_version = rspec.spec.version
141
- UI.message 'cocoapods-tdf-bin 插件'
142
- UI.message "- 开始处理 #{rspec.spec.name} #{spec_version} 组件."
150
+
151
+ if use_binary
152
+ UI.message 'cocoapods-tdf-bin 插件'
153
+ UI.message "- 开始处理 #{rspec.spec.name} #{spec_version} 组件."
154
+ end
143
155
 
144
156
  if @@build_dependencies_only_build
145
157
  missing_binary_specs << rspec.spec
@@ -163,12 +175,14 @@ module Pod
163
175
  end
164
176
  # used_by_only = rspec.respond_to?(:used_by_tests_only) ? rspec.used_by_tests_only : rspec.used_by_non_library_targets_only
165
177
  # 组装新的 rspec ,替换原 rspec
166
- rspec = if Pod.match_version?('~> 1.4.0')
167
- ResolverSpecification.new(specification, used_by_only)
168
- else
169
- ResolverSpecification.new(specification, used_by_only, source)
170
- end
171
- UI.message "组装新的 rspec ,替换原 rspec #{rspec.root.name} #{spec_version} \r\n specification =#{specification} \r\n #{rspec} "
178
+ if rspec.source != false
179
+ rspec = if Pod.match_version?('~> 1.4.0')
180
+ ResolverSpecification.new(specification, used_by_only)
181
+ else
182
+ ResolverSpecification.new(specification, used_by_only, source)
183
+ end
184
+ UI.message "组装新的 rspec ,替换原 rspec #{rspec.root.name} #{spec_version} \r\n specification =#{specification} \r\n #{rspec} "
185
+ end
172
186
 
173
187
  rescue Pod::StandardError => e
174
188
  # 没有从新的 source 找到对应版本组件,直接返回原 rspec
@@ -183,6 +197,10 @@ module Pod
183
197
  end.compact
184
198
  end
185
199
 
200
+ unless @@build_dependencies_bin
201
+ return specs_by_target
202
+ end
203
+
186
204
  if missing_binary_specs.any?
187
205
  missing_binary_specs.uniq.each do |spec|
188
206
  UI.message "【#{spec.name} | #{spec.version}】组件无对应二进制版本 , 将采用源码依赖."
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.14
4
+ version: 0.0.18
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-05 00:00:00.000000000 Z
11
+ date: 2021-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel
@@ -95,6 +95,7 @@ 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
100
  - lib/cocoapods-tdf-bin/command/bin/imy.rb
100
101
  - lib/cocoapods-tdf-bin/command/bin/init.rb
@@ -123,6 +124,7 @@ files:
123
124
  - lib/cocoapods-tdf-bin/helpers/spec_creator.rb
124
125
  - lib/cocoapods-tdf-bin/helpers/spec_files_helper.rb
125
126
  - lib/cocoapods-tdf-bin/helpers/spec_source_creator.rb
127
+ - lib/cocoapods-tdf-bin/helpers/string_helper.rb
126
128
  - lib/cocoapods-tdf-bin/helpers/upload_helper.rb
127
129
  - lib/cocoapods-tdf-bin/native.rb
128
130
  - lib/cocoapods-tdf-bin/native/acknowledgements.rb