Class: Pod::Command::Bin::Batch
Class Method Summary
collapse
Instance Method Summary
collapse
#binary_spec, #binary_spec_files, #binary_template_spec, #binary_template_spec_file, #binary_template_spec_files, #clear_binary_spec_file_if_needed, #code_spec, #code_spec_files, #create_binary_spec_file, #find_spec_file, #spec_files
#binary_source, #code_source, #sources_manager, #sources_option, #valid_sources
Constructor Details
#initialize(argv) ⇒ Batch
Returns a new instance of Batch.
29
30
31
32
|
# File 'lib/cocoapods-tdf-bin/command/bin/batch.rb', line 29
def initialize(argv)
@arguments = argv.arguments
super
end
|
Class Method Details
.find_repo_with_pod(pod_name) ⇒ Object
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
# File 'lib/cocoapods-tdf-bin/command/bin/batch.rb', line 176
def self.find_repo_with_pod(pod_name)
sources = Config.instance.sources_manager.all
sources = sources.select do |s|
s.name == "2dfire-cocoapods-spec"
end
source = sources[0]
repo_path = source.repo.to_s + "/#{pod_name}"
versions = `ls #{repo_path}`.split("\n")
versions = versions.sort do |x ,y|
y<=>x
end
last_version = versions[0]
spec_file = `ls #{repo_path}/#{last_version}`.split("\n")[0]
spec = Pod::Spec.from_file("#{repo_path}/#{last_version}/#{spec_file}")
git_url = spec.attributes_hash["source"]["git"]
git_url
end
|
.find_repo_with_pods(pod_names) ⇒ Object
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
# File 'lib/cocoapods-tdf-bin/command/bin/batch.rb', line 161
def self.find_repo_with_pods(pod_names)
if pod_names.include?(",")
split_array = pod_names.split(',')
pod_array = []
for pod_name in split_array
pod_array.append(find_repo_with_pod(pod_name))
end
return pod_array
else
return find_repo_with_pod(pod_names)
end
end
|
.options ⇒ Object
21
22
23
24
25
26
27
|
# File 'lib/cocoapods-tdf-bin/command/bin/batch.rb', line 21
def self.options
[
['clone', '本地库全部 clone 到指定本地目录'],
['done', '完成本地库,自动将本地的 local 依赖改为remote依赖'],
['{ git 命令 }', '本地库全部执行 git 命令,比如 pod bin batch pull, pod bin batch checkout -b feature/***'],
]
end
|
Instance Method Details
#run ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/cocoapods-tdf-bin/command/bin/batch.rb', line 34
def run
if @arguments.size == 2 && @arguments[0] == "find"
res = Batch.find_repo_with_pods(@arguments[1])
if res.is_a? Array
puts res.join(",")
return
else
puts res
return
end
end
podfile = File.join(Pathname.pwd, "Podfile")
podfile_instance = Pod::Podfile.from_file(podfile)
if podfile_instance.get_batch_local_pods == nil
help! "没有本地依赖的组件"
end
if @arguments.size == 1 && @arguments[0] == "clone"
clone_all(podfile_instance)
elsif @arguments.size == 1 && @arguments[0] == "done"
done_all(podfile_instance)
else
run_git(podfile_instance)
end
end
|
#validate! ⇒ Object
61
62
63
64
65
66
67
68
69
|
# File 'lib/cocoapods-tdf-bin/command/bin/batch.rb', line 61
def validate!
if @arguments.size < 1
help! "命令参数不够"
end
git = `which git`
if git.empty?
help! "没有安装 git 命令"
end
end
|