Class: Pod::Command::Bin::Spec::Create
Class Method Summary
collapse
Instance Method Summary
collapse
#validate!
#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) ⇒ Create
Returns a new instance of Create.
22
23
24
25
26
27
28
29
|
# File 'lib/cocoapods-tj/command/bin/spec/create.rb', line 22
def initialize(argv)
@platforms = argv.option('platforms', 'ios')
@binary_source = argv.option('binary_source', '')
@allow_overwrite = argv.flag?('overwrite', true)
@template_podspec = argv.option('template-podspec')
@podspec = argv.shift_argument
super
end
|
Class Method Details
.options ⇒ Object
13
14
15
16
17
18
19
20
|
# File 'lib/cocoapods-tj/command/bin/spec/create.rb', line 13
def self.options
[
['--platforms=ios', '生成二进制 spec 支持的平台'],
['--template-podspec=A.binary-template.podspec', '生成拥有 subspec 的二进制 spec 需要的模版 podspec, 插件会更改 version 和 source'],
['--no-overwrite', '不允许覆盖'],
['--binary_source', '生成的二进制podspec的source地址']
].concat(super)
end
|
Instance Method Details
#run ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/cocoapods-tj/command/bin/spec/create.rb', line 31
def run
code_spec = Pod::Specification.from_file(spec_file)
if template_spec_file
template_spec = Pod::Specification.from_file(template_spec_file)
end
if binary_spec && !@allow_overwrite
else
spec_file = create_binary_spec_file(code_spec,@binary_source, template_spec)
end
end
|
#spec_file ⇒ Object
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/cocoapods-tj/command/bin/spec/create.rb', line 53
def spec_file
@spec_file ||= begin
if @podspec
find_spec_file(@podspec)
else
if code_spec_files.empty?
raise Informative, '当前目录下没有找到可用源码 podspec.'
end
code_spec_files.first
end
end
end
|
#template_spec_file ⇒ Object
43
44
45
46
47
48
49
50
51
|
# File 'lib/cocoapods-tj/command/bin/spec/create.rb', line 43
def template_spec_file
@template_spec_file ||= begin
if @template_podspec
find_spec_file(@template_podspec)
else
binary_template_spec_file
end
end
end
|