Class: Escalator::Command::Combine

Inherits:
Escalator::Command show all
Defined in:
lib/escalator/command/combine.rb

Defined Under Namespace

Classes: Help

Constant Summary

Constants inherited from Escalator::Command

DEFAULT_OPTIONS, DEFAULT_ROOT_OPTIONS

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Combine

Returns a new instance of Combine.



76
77
78
79
80
81
82
# File 'lib/escalator/command/combine.rb', line 76

def initialize argv
  @commands = argv.arguments!
  @config_path = argv.option "config-path", ""
  @input_path = argv.option "input-path", ""
  @work_path = argv.option "work-path", ""
  super
end

Instance Attribute Details

#commandsObject (readonly)

Returns the value of attribute commands.



18
19
20
# File 'lib/escalator/command/combine.rb', line 18

def commands
  @commands
end

#config_pathObject (readonly)

Returns the value of attribute config_path.



20
21
22
# File 'lib/escalator/command/combine.rb', line 20

def config_path
  @config_path
end

#input_pathObject (readonly)

Returns the value of attribute input_path.



22
23
24
# File 'lib/escalator/command/combine.rb', line 22

def input_path
  @input_path
end

#work_pathObject (readonly)

Returns the value of attribute work_path.



24
25
26
# File 'lib/escalator/command/combine.rb', line 24

def work_path
  @work_path
end

Class Method Details

.optionsObject



68
69
70
71
72
73
74
# File 'lib/escalator/command/combine.rb', line 68

def self.options
  [
    ["--config-path=path", "path 为任务流需要的配置参数 ConfigInfo.plist 文件路径, 执行 #{"escalator setup".ansi.green} 获取配置模版"],
    ["--input-path=path", "path 为初始命令需要的输入根目录, 会自动检测需要的输入文件"],
    ["--work-path=path", "path 为脚本工作的根目录"]
  ].concat super
end

Instance Method Details

#help!(error_message = nil) ⇒ Object



104
105
106
# File 'lib/escalator/command/combine.rb', line 104

def help!(error_message = nil)
  invoked_command_class.help!(error_message, Help)
end

#runObject



108
109
110
# File 'lib/escalator/command/combine.rb', line 108

def run
  Escalator::Combine.run self
end

#validate!Object



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/escalator/command/combine.rb', line 84

def validate!
  super
  if commands.empty?
    help! "未检测到 COMMAND 参数"
  end
  cmds = (commands - (%w(confuse archive resign upload) & commands))
  if !cmds.empty?
    help! "检测到 非法参数: #{cmds.join ", "}"
  end
  if config_path.empty?
    help! "未检测到 --config-path 参数"
  end
  if input_path.empty?
    help! "未检测到 --input-path 参数"
  end
  if work_path.empty?
    help! "未检测到 --work-path 参数"
  end
end