cocoapods-tdf-bin 0.0.21 → 0.0.25

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: bfea2311ea4e2995ab9b416f7b7dee4cabf04228255ac3412f41bedd31563fc6
4
- data.tar.gz: f7b77c4dc7d711472080d13dab237e3c76c1415dab6631f7855bb90bf3e42330
3
+ metadata.gz: 791a58d07bcd6abf68f6b1c8b03880555070ce1e8f3fc53beeb35305d6560b87
4
+ data.tar.gz: 9dbd4643830bffb28819d663b3f00d6587e39493e5382e45d73bfb7261780089
5
5
  SHA512:
6
- metadata.gz: 2b1d5866284cf17a891b61e775db54c84242d6631f1e545c4bff1674dee3aada2d7fb32c0e3dcb38721c8045ee1c2ff1d0c0b6a5f7e0e6596972f0b98f3eddb8
7
- data.tar.gz: c27895d1a9a506f6bd6888939c8d13959158bb67f8b6f6964651e8e4d54cd78dc8c279cfa1e012a53668c8d70137caa79a81446d7c6a902e9f27aa2500b660c2
6
+ metadata.gz: fc1e341b60778a600c7fd1232de3485df72af05eeac6daa00c3cca13df5efb2f584dcf8b589a0feac90af2058cbbf35226d00a097aa60f855ba4ca39a6930881
7
+ data.tar.gz: ed9feba4701f605e4b83b9d3b1c8f1360c604561e1cd740df55ddc80067e8540079e232e2822e892004c4570a141749e08477ee955eca8b5793dc3dd34b4dc05
@@ -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
@@ -65,11 +65,14 @@ module Pod
65
65
  podfile_instance.get_batch_local_pods.each_value do |value|
66
66
  path = value[0][:path]
67
67
  arg = @arguments.map do |v|
68
- new_str = v.dup.gsub! /\s/, '_'
69
- new_str == nil ? v : new_str
68
+ match_str = /\s/.match(v)
69
+ if nil != match_str
70
+ v = "\"#{v}\""
71
+ end
72
+ v
70
73
  end
71
74
  arg = arg.join(" ")
72
- puts "============== #{path} 开始执行 git #{arg} 命令 ==============".blue
75
+ puts "============== #{path} 开始执行 git #{arg} 命令 ==============".tdf_blue
73
76
  puts `git -C #{path} #{arg}`
74
77
  end
75
78
  end
@@ -80,12 +83,10 @@ module Pod
80
83
  group_map = {}
81
84
  local_pods.each_key do |name|
82
85
  path = local_pods[name][0][:path]
83
- git_url = `git -C #{path} remote get-url --push origin`
84
86
  current_branch = `git -C #{path} branch --show-current`.delete!("\n")
85
- group_name = get_group_with_repo(git_url)
86
- puts "============== #{name} 当前分支 #{current_branch} 当前组 #{group_name} ==============".blue
87
+ puts "============== #{name} 当前分支 #{current_branch} ==============".tdf_blue
87
88
 
88
- group_key = "#{group_name}&&#{current_branch}"
89
+ group_key = "#{current_branch}"
89
90
  repo_arr = group_map[group_key]
90
91
  if repo_arr.is_a? Array
91
92
  repo_arr << name
@@ -103,23 +104,34 @@ module Pod
103
104
  pod_names.each do |name|
104
105
  pod_remote_str << " \"#{name}\",\n"
105
106
  end
106
- group = key.split("&&")[0]
107
- branch = key.split("&&")[1]
108
- pod_remote_str << " ], \"#{branch}\", \"#{group}\"\n\n"
107
+ branch = key
108
+ pod_remote_str << " ], \"#{branch}\" \n"
109
109
  end
110
- puts "将 local_batch 依赖 替换为 \n#{pod_remote_str}".blue
110
+ puts "将 local_batch 依赖 替换为 \n#{pod_remote_str}".tdf_blue
111
111
 
112
112
  # 替换 podfile 中的local batch
113
+ re = / *batch_pod_local *\[([^\].]*)\], *".*"/
113
114
  podfile = File.join(Pathname.pwd, "Podfile")
114
- 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)
115
127
  File.open(podfile, "r+") do |podfile|
116
128
  podfile << podfile_str
117
129
  end
118
- puts "替换成功".blue
130
+ puts "替换成功".tdf_blue
119
131
  end
120
132
 
121
- def find_repo_with_pod(pod_name)
122
- sources = config.sources_manager.all
133
+ def self.find_repo_with_pod(pod_name)
134
+ sources = Config.instance.sources_manager.all
123
135
  sources = sources.select do |s|
124
136
  s.name == "2dfire-cocoapods-spec"
125
137
  end
@@ -136,18 +148,7 @@ module Pod
136
148
  git_url
137
149
  end
138
150
 
139
- def get_group_with_repo(repo_url)
140
- if repo_url.start_with?("http")
141
- re = Regexp.new("git.2dfire.net/.*/")
142
- repo_group = repo_url.match(re)[0][15..-2]
143
- else
144
- re = Regexp.new("git.2dfire.net:.*/")
145
- repo_group = repo_url.match(re)[0][15..-2]
146
- end
147
- repo_group
148
- end
149
-
150
- private :clone_all, :run_git, :find_repo_with_pod, :done_all, :get_group_with_repo
151
+ private :clone_all, :run_git, :done_all
151
152
 
152
153
  end
153
154
  end
@@ -1,6 +1,6 @@
1
1
 
2
2
  module CBin
3
- VERSION = '0.0.21'
3
+ VERSION = '0.0.25'
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.21
4
+ version: 0.0.25
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-24 00:00:00.000000000 Z
11
+ date: 2021-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel