cocoapods-tdf-bin 0.0.13 → 0.0.17

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: 2f584efcaa5fce2694fa3bdde6a5ce4cf5a18745d06055e0ad870b9948e09754
4
- data.tar.gz: 0f9d71596e836b1987735a786e89cff83874121dfd4c27efd66a40e3ff03491f
3
+ metadata.gz: 3f577bfd3e7fcecd47e17b0e1bcbcde05f610607a643bb17108cf302ee3d380c
4
+ data.tar.gz: e716d34c5ffbd2dba9b565fbd62f6c84b4e5013278f3e1d0f46733ace03377ac
5
5
  SHA512:
6
- metadata.gz: 0a41d7810eb69e176ae95a94aecb7cc7678a5dd1d4c65245d58e29f5beabbd17cb537e2a5a9f032748a0d17475ea0b49a692eef6c1cceed2188134576ca619df
7
- data.tar.gz: e30094879a24405c7efd89cb4f51b9210d478f272e620bb3017b2a0e6445fff719125251d0aa07036371a424b20ced402897366e5776de8031eb12f3168ee66e
6
+ metadata.gz: 913994c6be4e81d2bc8a9678f288b2b9b3496d128a081cd174f0b2838bad714f4fc2dd4adbf2616f075e031c0e44566c04104faf7c3ec25dcf3c89e26873b58e
7
+ data.tar.gz: b74dcc1705407ada38305239078378f22b3a379e14a2065ebd6895a2f43608773c828fb427a0e55c67bf17fc35c824174004db3b6c3bb6eb1029742dab2e24d2
@@ -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.13'
3
+ VERSION = '0.0.17'
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,43 @@ 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
+ requirements = remote_pod_hash[name].nil? ? requirements : remote_pod_hash[name];
47
+ requirements = local_pod_hash[name].nil? ? requirements : local_pod_hash[name];
48
+
49
+ current_target_definition.store_pod(name, *requirements)
50
+ end
51
+
15
52
  def use_binaries!(flag = true)
16
53
  set_internal_hash_value(USE_BINARIES, flag)
17
54
  end
@@ -61,6 +98,14 @@ module Pod
61
98
  get_internal_hash_value(USE_BINARIES, false) || ENV[USE_BINARIES] == 'true'
62
99
  end
63
100
 
101
+ def get_batch_local_pods
102
+ get_internal_hash_value(BATCH_POD_LOCAL)
103
+ end
104
+
105
+ def get_batch_remote_pods
106
+ get_internal_hash_value(BATCH_POD_REMOTE)
107
+ end
108
+
64
109
  def use_source_pods
65
110
  get_internal_hash_value(USE_SOURCE_PODS, []) + String(ENV[USE_SOURCE_PODS]).split('|').uniq
66
111
  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,14 +175,13 @@ 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
- if use_binary
178
+ if rspec.source != false
167
179
  rspec = if Pod.match_version?('~> 1.4.0')
168
180
  ResolverSpecification.new(specification, used_by_only)
169
181
  else
170
182
  ResolverSpecification.new(specification, used_by_only, source)
171
183
  end
172
184
  UI.message "组装新的 rspec ,替换原 rspec #{rspec.root.name} #{spec_version} \r\n specification =#{specification} \r\n #{rspec} "
173
-
174
185
  end
175
186
 
176
187
  rescue Pod::StandardError => e
@@ -186,6 +197,10 @@ module Pod
186
197
  end.compact
187
198
  end
188
199
 
200
+ unless @@build_dependencies_bin
201
+ return specs_by_target
202
+ end
203
+
189
204
  if missing_binary_specs.any?
190
205
  missing_binary_specs.uniq.each do |spec|
191
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.13
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - gaijiaofan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-25 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