Class: Pod::Command::Binary::Publish
Class Method Summary
collapse
Instance Method Summary
collapse
#binary_config, #first_podspec, #private_sources
Constructor Details
#initialize(argv) ⇒ Publish
Returns a new instance of Publish.
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/cocoapods-tdfire-binary/command/publish.rb', line 25
def initialize(argv)
spec_file = argv.shift_argument
@commit = argv.option('commit')
@sources = argv.option('sources')
spec_file = first_podspec if spec_file.nil?
@spec_file = spec_file
@binary_first = argv.flag?('binary-first')
super
end
|
Class Method Details
.options ⇒ Object
17
18
19
20
21
22
23
|
# File 'lib/cocoapods-tdfire-binary/command/publish.rb', line 17
def self.options
[
['--commit="Fix some bugs"', '发布的 commit 信息'],
['--binary-first', '二进制优先'],
['--sources', '私有源地址']
].concat(super)
end
|
Instance Method Details
#run ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/cocoapods-tdfire-binary/command/publish.rb', line 41
def run
spec = Specification.from_file(@spec_file)
if @binary_first
Pod::Tdfire::BinaryStateStore.unpublished_pods = Pod::Tdfire::BinaryStateStore.unpublished_pods + Array(spec.name)
Pod::Tdfire::BinaryStateStore.set_use_binary
end
UI.section("Tdfire: start publishing #{spec.name} ...") do
argvs = [
private_sources.first.name,
@spec_file,
"--sources=#{@sources || Pod::Tdfire::BinaryUrlManager.private_cocoapods_url}",
'--allow-warnings',
'--use-libraries',
'--verbose'
]
argvs << %Q[--commit-message=#{commit_prefix(spec) + "\n" + @commit}] unless @commit.to_s.empty?
push = Pod::Command::Repo::Push.new(CLAide::ARGV.new(argvs))
push.validate!
push.run
raise Pod::StandardError, "执行 pod repo push 失败,错误信息 #{$?}" if $?.exitstatus != 0
end
end
|
#validate! ⇒ Object
36
37
38
39
|
# File 'lib/cocoapods-tdfire-binary/command/publish.rb', line 36
def validate!
super
help! "当前目录下找不到有效的 podspec 文件" if @spec_file.nil?
end
|