Class: Pod::Command::Binary::Push
Constant Summary
collapse
- ZIP_SUBFFIX =
'.framework.zip'
Class Method Summary
collapse
Instance Method Summary
collapse
#binary_config, #first_podspec, #private_sources
Constructor Details
#initialize(argv) ⇒ Push
Returns a new instance of Push.
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/cocoapods-tdfire-binary/command/push.rb', line 28
def initialize(argv)
path = argv.shift_argument
name = argv.option('name')
version = argv.option('version')
commit = argv.option('commit')
unless first_podspec.nil?
if path.nil?
path = first_podspec.split('.').first
end
spec = Specification.from_file(Pathname.new(first_podspec))
version = spec.version if version.nil?
name = spec.name
end
path += ZIP_SUBFFIX unless path.end_with?(ZIP_SUBFFIX)
@path = path
@name = name || path.split('/').last - ZIP_SUBFFIX
@version = version
@commit = commit
super
end
|
Class Method Details
.options ⇒ Object
20
21
22
23
24
25
26
|
# File 'lib/cocoapods-tdfire-binary/command/push.rb', line 20
def self.options
[
['--name=组件名', '推送二进制的组件名'],
['--version=版本号', '推送二进制的版本号'],
['--commit=版本日志', '推送二进制的版本日志'],
].concat(super)
end
|
Instance Method Details
#run ⇒ Object
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/cocoapods-tdfire-binary/command/push.rb', line 60
def run
tag_log = `git tag -l -n #{@version}`
tag_log = tag_log.split(' ')[1..-1].join('') unless tag_log.empty?
hash_log = `git show-ref #{@version}`
hash_log = hash_log.split(' ').first unless hash_log.empty?
commit = @commit || tag_log || @version
UI.section("Tdfire: start pushing framework zip file ...") do
UI.puts "Tdfire: post argvs: name -> #{@name}, version -> #{@version}, path -> #{@path}, commit -> #{commit}, commit hash -> #{hash_log}"
Pod::Tdfire::BinaryUrlManager.post_push_url(@name, @version, @path, commit, hash_log)
end
end
|
#validate! ⇒ Object
54
55
56
57
58
|
# File 'lib/cocoapods-tdfire-binary/command/push.rb', line 54
def validate!
super
help! "指定目录下没有可推送文件: #{@path}" unless File.exist?(@path)
help! "必须为推送组件指定版本(--version)" if @version.nil?
end
|