Class: Pod::Command::Tag::SpecPush

Inherits:
Pod::Command::Tag show all
Defined in:
lib/cocoapods-tag/command/tag/spec_push.rb

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ SpecPush

Returns a new instance of SpecPush.



18
19
20
21
22
# File 'lib/cocoapods-tag/command/tag/spec_push.rb', line 18

def initialize(argv)
  @repo = argv.shift_argument
  @podspec = argv.shift_argument
  super
end

Instance Method Details

#runObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/cocoapods-tag/command/tag/spec_push.rb', line 24

def run
  require 'cocoapods-tag/native/validator'

  unless @repo
    raise Informative, "请输入spec repo"
  end
  unless @podspec
    raise Informative, "请输入要上传的podspec"
  end
  UI.title "推送`#{@podspec}`到`#{@repo}`仓库".yellow do
    argvs = [
      @repo,
      @podspec,
      '--allow-warnings'
    ]
    begin
      push = Pod::Command::Repo::Push.new(CLAide::ARGV.new(argvs))
      push.validate!
      push.run
    rescue Pod::StandardError => e
      @error = e
      print "推送`#{@podspec}`到`#{@repo}`仓库失败!#{e}".red
    end
  end
end