Class: OrmDev::Command::Run

Inherits:
OrmDev::Command show all
Defined in:
lib/ormdev/command/run.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Run

Returns a new instance of Run.



30
31
32
33
34
35
# File 'lib/ormdev/command/run.rb', line 30

def initialize(argv)
  @podspec_file = argv.shift_argument
  @podspec_files = Pathname.pwd.children.select { |pn| pn.extname == '.podspec' }
  @no_version_control = argv.flag?('without-version-control')
  super
end

Class Method Details

.optionsObject



24
25
26
27
28
# File 'lib/ormdev/command/run.rb', line 24

def self.options
  [
      ['--without-version-control', '没有版本控制'],
  ].concat(super)
end

Instance Method Details

#runObject



50
51
52
53
54
55
56
57
58
# File 'lib/ormdev/command/run.rb', line 50

def run
  super
  OrmDev::LogUtil.info '[插件发布] '.green
  installer = OrmDev::RunHelper.new(@podspec_path)
  framework_zip = installer.setup(@no_version_control)
  framework_zip_path= File.expand_path('./', framework_zip)
  OrmDev::LogUtil.info "Success!!! 静态库编译完成:#{framework_zip_path}"
  OrmDev::LogUtil.info "   ormdev publish #{@podspec_path} --zip=#{framework_zip_path} --push-type=0".magenta
end

#validate!Object



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/ormdev/command/run.rb', line 37

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
end