class OrmDev::Command::Publish

Public Class Methods

new(argv) click to toggle source
Calls superclass method
# File lib/ormdev/command/publish.rb, line 28
def initialize(argv)
  @podspec_file = argv.shift_argument
  @podspec_files = Pathname.pwd.children.select { |pn| pn.extname == '.podspec' }
  @account = argv.option('account')
  @password = argv.option('password')
  @changelog = argv.option('changelog', '')
  @push_type = argv.option('push-type').to_i
  @zip = argv.option('zip')
  super
end
options() click to toggle source
Calls superclass method
# File lib/ormdev/command/publish.rb, line 18
def self.options
  [
      ['--account=XXX', '发布第三方插件的账户名'],
      ['--password=XXX', '发布第三方插件的密码'],
      ['--changelog=xxxx', '更新说明'],
      ['--zip=xxx', '插件SDK本地地址,当push-type = 0,是必传'],
      ['--push-type=[0,1,2]', '发布类型:0、替换+push+录入;1、push+录入;2、直接录入'],
  ].concat(super)
end

Public Instance Methods

run() click to toggle source
Calls superclass method OrmDev::Command#run
# File lib/ormdev/command/publish.rb, line 57
def run
  super
  OrmDev::LogUtil.info '[插件发布] '.green
  info = OrmDev::HTTPUtil.send_pulish_plugin_http(@account, @password, @push_type, @podspec_path, @zip, @changelog)
  OrmDev::LogUtil.info "插件上传完成!!! #{info}"
  OrmDev::LogUtil.link(info['previewUrl'], '前往查看发布结果:')
end
validate!() click to toggle source
Calls superclass method
# File lib/ormdev/command/publish.rb, line 39
def validate!
  super
  # raise Pod::Informative, "No `Cimfile' found in the project directory." unless @cipfile_path.exist?
  if @podspec_file
    help! "podspec file at #{@podspec_file} does not exist" unless File.exist? @podspec_file
    @podspec_path = @podspec_file
  else
    raise Pod::Informative, 'No podspec file found, please specify one' unless @podspec_files.length > 0
    raise Pod::Informative, 'Multiple podspec file found, please specify one' unless @podspec_files.length == 1
    @podspec_path = @podspec_files.first
  end
  help! '发布类型传值错误' if @push_type < 0 || @push_type > 2
  if @push_type == 0 then
    help! '插件zip包地址不能为空' if @zip.nil?
    help! "插件zip包地址( #{@zip} )不存在" unless File.exist? @zip
  end
end