Class: Pod::Command::Swordfish::Auto
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) ⇒ Auto
Returns a new instance of Auto.
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/swordfish/command/auto.rb', line 23
def initialize(argv)
@env = argv.option('env') || 'dev'
Ocean.config.set_configuration_env(@env)
@podspec = argv.shift_argument || find_podspec
@specification = Specification.from_file(@podspec)
@framework_output = argv.flag?('framework-output', false )
@all_make = argv.flag?('all-make', false )
@verbose = argv.flag?('verbose',true)
@config = argv.option('configuration', 'Debug')
@additional_args = argv.remainder!
super
end
|
Class Method Details
.options ⇒ Object
14
15
16
17
18
19
20
21
|
# File 'lib/swordfish/command/auto.rb', line 14
def self.options
[
['--framework-output', "输出framework文件"],
['--all-make', "对该组件的依赖库,全部制作为二进制组件"],
['--configuration', "Build the specified configuration (e.g. Release ). Defaults to Debug"],
['--env', "该组件上传的环境 %w[dev debug_iphoneos release_iphoneos]"]
].concat(Pod::Command::Gen.options).concat(super).uniq
end
|
Instance Method Details
#binary_podsepc_json ⇒ Object
132
133
134
|
# File 'lib/swordfish/command/auto.rb', line 132
def binary_podsepc_json
"#{@specification.name}.binary.podspec.json"
end
|
#binary_template_podsepc ⇒ Object
136
137
138
|
# File 'lib/swordfish/command/auto.rb', line 136
def binary_template_podsepc
"#{@specification.name}.binary-template.podspec"
end
|
#code_podsepc_extname ⇒ Object
128
129
130
|
# File 'lib/swordfish/command/auto.rb', line 128
def code_podsepc_extname
'.podsepc'
end
|
#find_podspec ⇒ Object
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
# File 'lib/swordfish/command/auto.rb', line 174
def find_podspec
name = nil
Pathname.pwd.children.each do |child|
puts child
if File.file?(child)
if child.extname == '.podspec'
name = File.basename(child)
unless name.include?("binary-template")
return name
end
end
end
end
return name
end
|
#run ⇒ Object
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/swordfish/command/auto.rb', line 49
def run
@specification = Specification.from_file(@podspec)
source_specs = run_archive
fail_push_specs = []
source_specs.uniq.each do |spec|
begin
fail_push_specs << spec unless Ocean::Upload::Helper.new(spec,@code_dependencies,@sources).upload(@framework_output)
rescue Object => exception
UI.puts exception
fail_push_specs << spec
end
end
if fail_push_specs.any?
fail_push_specs.uniq.each do |spec|
UI.warn "【#{spec.name} | #{spec.version}】组件spec push失败 ."
end
end
success_specs = source_specs - fail_push_specs
if success_specs.any?
auto_success = ""
success_specs.uniq.each do |spec|
auto_success += "#{spec.name} | #{spec.version}\n"
UI.warn "===【 #{spec.name} | #{spec.version} 】二进制组件制作完成 !!! "
end
puts "============== auto_success"
puts auto_success
ENV['auto_success'] = auto_success
end
UI.section("\nUpdating Spec Repositories\n".yellow) do
Pod::Command::Swordfish::Repo::Update.new(CLAide::ARGV.new([])).run
end
end
|
#run_archive ⇒ Object
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
# File 'lib/swordfish/command/auto.rb', line 89
def run_archive
_sources = Ocean::Config::Builder.instance.pod_source_list
argvs = [
"--sources=#{sources_option(@code_dependencies, _sources)}",
@additional_args
]
argvs << spec_file if spec_file
argvs.delete(Array.new)
if @code_dependencies
argvs += ['--code-dependencies']
end
if @verbose
argvs += ['--verbose']
end
if @framework_output
argvs += ['--framework-output']
end
if @all_make
argvs += ['--all-make']
end
if @env
argvs += ["--env=#{@env}"]
end
argvs += ["--configuration=#{@config}"]
archive = Pod::Command::Swordfish::Archive.new(CLAide::ARGV.new(argvs))
archive.validate!
source_specs = archive.run
source_specs
end
|
#spec_file ⇒ Object
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
# File 'lib/swordfish/command/auto.rb', line 150
def spec_file
@spec_file ||= begin
if @podspec
find_spec_file(@podspec) || @podspec
else
if code_spec_files.empty?
raise Informative, '当前目录下没有找到可用源码 podspec.'
end
spec_file = if @binary
code_spec = Pod::Specification.from_file(code_spec_files.first)
if template_spec_file
template_spec = Pod::Specification.from_file(template_spec_file)
end
create_binary_spec_file(code_spec, template_spec)
else
code_spec_files.first
end
spec_file
end
end
end
|
#template_spec_file ⇒ Object
140
141
142
143
144
145
146
147
148
|
# File 'lib/swordfish/command/auto.rb', line 140
def template_spec_file
@template_spec_file ||= begin
if @template_podspec
find_spec_file(@template_podspec)
else
binary_template_spec_file
end
end
end
|
#validate! ⇒ Object
44
45
46
47
|
# File 'lib/swordfish/command/auto.rb', line 44
def validate!
super
help! "未找到 podspec文件" unless @podspec
end
|