Class: Pod::Command::Bdtransform::ToLog

Inherits:
Pod::Command::Bdtransform show all
Defined in:
lib/cocoapods-BDTransform/command/BDTransform/ToLog.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ ToLog

Returns a new instance of ToLog.



62
63
64
65
66
# File 'lib/cocoapods-BDTransform/command/BDTransform/ToLog.rb', line 62

def initialize(argv)
  
  @bd_transform_pod = argv.arguments
  @dev_path = argv.option('dev_path')
end

Class Method Details

.optionsObject



55
56
57
58
59
60
# File 'lib/cocoapods-BDTransform/command/BDTransform/ToLog.rb', line 55

def self.options
  [
    ['--dev_path=',     'Mbox 专属,用于将转化后的 组件 移动到指定的目录下,以此无需pod install 即可进行 dev 开发']
    
  ]
end

Instance Method Details

#runObject



78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/cocoapods-BDTransform/command/BDTransform/ToLog.rb', line 78

def run
  cdir = $WORK_DIR_Source
  if !@bd_transform_pod.empty?
    if $WORK_DIR_Log == Dir.home() + '/.cocoapods-BDTransform'
      $LOAD_PATH << "#{$WORK_DIR_Log}"
      require "#{$WORK_DIR_Log}/AweToLog.rb"
    else
      require 'cocoapods-BDTransform/command/BDTransform/AweToLog.rb'
    end
    log = BDAwesomeTransmit::BDPodsTransLog.new(@bd_transform_pod[0],@dev_path)
    log.run
  end
end

#validate!Object



68
69
70
71
72
73
74
75
76
# File 'lib/cocoapods-BDTransform/command/BDTransform/ToLog.rb', line 68

def validate!

  help! 'A Pod name is required.' unless @bd_transform_pod.count > 0
  targetDir = Dir::pwd + '/Pods/' + @bd_transform_pod[0]
  help! "目录 #{targetDir} 不存在,请在 Podfile 同级目录下执行" unless File::exist?(Dir::pwd + '/Pods/' + @bd_transform_pod[0])
  if @dev_path
    raise "#{@dev_path} 不存在" unless File.exist? @dev_path
  end
end