cocoapods-tdf-bin 0.0.22 → 0.0.26

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: 5a9056382c20f2100f7822d00940ccbdd7b39f9cb3c351fef8972afd299e06e6
4
- data.tar.gz: a64bc11f1037ba6213fe2796009848ae210ddbf29d75cbbffaab078447e2a446
3
+ metadata.gz: 87ed9c79da19168d3d799acb3e10665686872ea5f7b5d0180da27a1176f7f8d2
4
+ data.tar.gz: 40d395b273425c1e8e24e71938635f092c784dec1678723ed280707639328847
5
5
  SHA512:
6
- metadata.gz: df99a6379cd2e1f20914ec71986404ff8c516ae8ad484004989f51c2f6ce2593fc73598a9d66bc01731eb4805784ab8188ecbd339e07cefae63a99d85bf93fc7
7
- data.tar.gz: 66783cc41156b058cc4766c480b1b0edb978ebba9fb1307081d7d6e12af58dc135c024fa69b3bea0d5ae8ccd8d0244c74d040c9509b7b938423425b012fae9e9
6
+ metadata.gz: 4cb6a3cce2436e03b7010e5c5f94f286c342da9d6ee68dca686b86c80e8f74f6e2766d64bdc8d9585405c0bd0cf72677820078fe22671d44b36fbcbe962ac695
7
+ data.tar.gz: 1f308b97e69f2a6fec68967ae563fcf5ba6cdd6326c538e7212c19acb22facf17a131bc25ee0997148c6303b9ba623328af92c93890d2482bd09cc0bd0e2ba3d
@@ -22,7 +22,7 @@ module Pod
22
22
  end
23
23
 
24
24
  def initialize(argv)
25
- @arguments = argv.arguments.map
25
+ @arguments = argv.arguments
26
26
  super
27
27
  end
28
28
 
@@ -55,8 +55,8 @@ module Pod
55
55
  local_pods = podfile_instance.get_batch_local_pods
56
56
  local_pods.each_key do |name|
57
57
  path = local_pods[name][0][:path]
58
- repo_url = find_repo_with_pod(name)
59
- puts "============== #{name} 开始 clone 到 #{path}==============".blue
58
+ repo_url = Batch.find_repo_with_pod(name)
59
+ puts "============== #{name} 开始 clone 到 #{path}==============".tdf_blue
60
60
  puts `git clone #{repo_url} #{path}`
61
61
  end
62
62
  end
@@ -72,7 +72,7 @@ module Pod
72
72
  v
73
73
  end
74
74
  arg = arg.join(" ")
75
- puts "============== #{path} 开始执行 git #{arg} 命令 ==============".blue
75
+ puts "============== #{path} 开始执行 git #{arg} 命令 ==============".tdf_blue
76
76
  puts `git -C #{path} #{arg}`
77
77
  end
78
78
  end
@@ -83,12 +83,10 @@ module Pod
83
83
  group_map = {}
84
84
  local_pods.each_key do |name|
85
85
  path = local_pods[name][0][:path]
86
- git_url = `git -C #{path} remote get-url --push origin`
87
86
  current_branch = `git -C #{path} branch --show-current`.delete!("\n")
88
- group_name = get_group_with_repo(git_url)
89
- puts "============== #{name} 当前分支 #{current_branch} 当前组 #{group_name} ==============".blue
87
+ puts "============== #{name} 当前分支 #{current_branch} ==============".tdf_blue
90
88
 
91
- group_key = "#{group_name}&&#{current_branch}"
89
+ group_key = "#{current_branch}"
92
90
  repo_arr = group_map[group_key]
93
91
  if repo_arr.is_a? Array
94
92
  repo_arr << name
@@ -106,23 +104,34 @@ module Pod
106
104
  pod_names.each do |name|
107
105
  pod_remote_str << " \"#{name}\",\n"
108
106
  end
109
- group = key.split("&&")[0]
110
- branch = key.split("&&")[1]
111
- pod_remote_str << " ], \"#{branch}\", \"#{group}\"\n\n"
107
+ branch = key
108
+ pod_remote_str << " ], \"#{branch}\" \n"
112
109
  end
113
- puts "将 local_batch 依赖 替换为 \n#{pod_remote_str}".blue
110
+ puts "将 local_batch 依赖 替换为 \n#{pod_remote_str}".tdf_blue
114
111
 
115
112
  # 替换 podfile 中的local batch
113
+ re = / *batch_pod_local *\[([^\].]*)\], *".*"/
116
114
  podfile = File.join(Pathname.pwd, "Podfile")
117
- podfile_str = File.read(podfile).gsub(/ *batch_pod_local *\[([^\].]*)\], *".*"/, pod_remote_str)
115
+ podfile_str = File.read(podfile)
116
+
117
+ local_pod_str = podfile_str.match(re).to_s
118
+ local_pod_lines = local_pod_str.to_s.split("\n")
119
+ local_pod_lines = local_pod_lines.map do |s|
120
+ "# #{s}"
121
+ end
122
+ local_pod_str = local_pod_lines.join("\n")
123
+ local_pod_str << "\n"
124
+ pod_remote_str.insert(0, local_pod_str)
125
+
126
+ podfile_str = podfile_str.gsub(re, pod_remote_str)
118
127
  File.open(podfile, "r+") do |podfile|
119
128
  podfile << podfile_str
120
129
  end
121
- puts "替换成功".blue
130
+ puts "替换成功".tdf_blue
122
131
  end
123
132
 
124
- def find_repo_with_pod(pod_name)
125
- sources = config.sources_manager.all
133
+ def self.find_repo_with_pod(pod_name)
134
+ sources = Config.instance.sources_manager.all
126
135
  sources = sources.select do |s|
127
136
  s.name == "2dfire-cocoapods-spec"
128
137
  end
@@ -139,18 +148,7 @@ module Pod
139
148
  git_url
140
149
  end
141
150
 
142
- def get_group_with_repo(repo_url)
143
- if repo_url.start_with?("http")
144
- re = Regexp.new("git.2dfire.net/.*/")
145
- repo_group = repo_url.match(re)[0][15..-2]
146
- else
147
- re = Regexp.new("git.2dfire.net:.*/")
148
- repo_group = repo_url.match(re)[0][15..-2]
149
- end
150
- repo_group
151
- end
152
-
153
- private :clone_all, :run_git, :find_repo_with_pod, :done_all, :get_group_with_repo
151
+ private :clone_all, :run_git, :done_all
154
152
 
155
153
  end
156
154
  end
@@ -12,8 +12,8 @@ module CBin
12
12
  def template_hash
13
13
  {
14
14
  'configuration_env' => { description: '编译环境', default: 'dev', selection: %w[dev debug_iphoneos release_iphoneos] },
15
- 'code_repo_url' => { description: '源码私有源 Git 地址', default: 'git@git.2dfire.net:ios/cocoapods-spec.git' },
16
- 'binary_repo_url' => { description: '二进制私有源 Git 地址', default: 'git@git.2dfire.net:ios/cocoapods-spec-binary.git' },
15
+ 'code_repo_url' => { description: '源码私有源 Git 地址', default: 'git@git.2dfire.net:app/cocoapods-spec/cocoapods-spec.git' },
16
+ 'binary_repo_url' => { description: '二进制私有源 Git 地址', default: 'git@git.2dfire.net:app/cocoapods-spec-binary/cocoapods-spec-binary.git' },
17
17
  'binary_download_url' => { description: '二进制下载地址,内部会依次传入组件名称与版本,替换字符串中的 %s ', default: 'http://iosframeworkserver-shopkeeperclient.app.2dfire.com/download/%s/%s.zip' },
18
18
  'binary_upload_url' => { description: '二进制下载地址,内部会依次传入组件名称与版本,替换字符串中的 %s ', default: 'http://iosframeworkserver-shopkeeperclient.app.2dfire.com/upload/%s/%s.zip' },
19
19
  # 'binary_type' => { description: '二进制打包类型', default: 'framework', selection: %w[framework library] },
@@ -1,6 +1,6 @@
1
1
 
2
2
  module CBin
3
- VERSION = '0.0.22'
3
+ VERSION = '0.0.26'
4
4
  end
5
5
 
6
6
  module Pod
@@ -1,30 +1,30 @@
1
1
  class String
2
2
  # colorization
3
- def colorize(color_code)
3
+ def tdf_colorize(color_code)
4
4
  "\e[#{color_code}m#{self}\e[0m"
5
5
  end
6
6
 
7
- def red
8
- colorize(31)
7
+ def tdf_red
8
+ tdf_colorize(31)
9
9
  end
10
10
 
11
- def green
12
- colorize(32)
11
+ def tdf_green
12
+ tdf_colorize(32)
13
13
  end
14
14
 
15
- def yellow
16
- colorize(33)
15
+ def tdf_yellow
16
+ tdf_colorize(33)
17
17
  end
18
18
 
19
- def blue
20
- colorize(34)
19
+ def tdf_blue
20
+ tdf_colorize(34)
21
21
  end
22
22
 
23
- def pink
24
- colorize(35)
23
+ def tdf_pink
24
+ tdf_colorize(35)
25
25
  end
26
26
 
27
- def light_blue
28
- colorize(36)
27
+ def tdf_light_blue
28
+ tdf_colorize(36)
29
29
  end
30
30
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'cocoapods'
4
4
  require 'cocoapods-tdf-bin/native/podfile_env'
5
+ require 'cocoapods-tdf-bin/command/bin/batch'
5
6
 
6
7
  module Pod
7
8
  class Podfile
@@ -24,10 +25,11 @@ module Pod
24
25
  end
25
26
  end
26
27
 
27
- def batch_pod_remote(pods, branch , group = 'ios')
28
+ def batch_pod_remote(pods, branch)
28
29
  pod_hash = Hash.new
29
30
  pods.each do |name|
30
- pod_hash[name] = [ :git => "git@git.2dfire.net:#{group}/#{name}.git", :branch => "#{branch}" ]
31
+ git_url = Pod::Command::Bin::Batch.find_repo_with_pod(name)
32
+ pod_hash[name] = [ :git => git_url, :branch => "#{branch}" ]
31
33
  end
32
34
  if get_batch_remote_pods.nil?
33
35
  set_internal_hash_value(BATCH_POD_REMOTE, pod_hash)
@@ -135,5 +137,6 @@ module Pod
135
137
  def get_internal_hash_value(key, default = nil)
136
138
  internal_hash.fetch(key, default)
137
139
  end
140
+
138
141
  end
139
142
  end
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.22
4
+ version: 0.0.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - gaijiaofan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-25 00:00:00.000000000 Z
11
+ date: 2022-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel