Class: EasyCI::Command::Autobuild
- Inherits:
-
EasyCI::Command
- Object
- CLAide::Command
- EasyCI::Command
- EasyCI::Command::Autobuild
- Defined in:
- lib/easyci/command/autobuild.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Autobuild
constructor
A new instance of Autobuild.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ Autobuild
Returns a new instance of Autobuild.
16 17 18 19 20 21 22 |
# File 'lib/easyci/command/autobuild.rb', line 16 def initialize(argv) @project_path = argv.option('project-path') @build_target = argv.option('build-target', 'iOS') @output_path = argv.option('output') @version = argv.option('version', '1.0.0') super end |
Class Method Details
.options ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/easyci/command/autobuild.rb', line 7 def self. [ ['--project-path=PATH', '指定项目路径'], ['--build-target=TARGET', '构建目标平台 (iOS/Android/WebGL)'], ['--output=PATH', '构建输出路径'], ['--version=VERSION', '版本号'] ].concat(super) end |
Instance Method Details
#run ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/easyci/command/autobuild.rb', line 30 def run puts "开始构建项目: #{@project_path}" if @verbose puts "构建目标平台: #{@build_target}" puts "版本号: #{@version}" # 这里是实际执行自动构建的代码 puts "准备构建环境..." sleep(1) puts "执行构建..." sleep(2) output = @output_path || "./build/#{@build_target.downcase}" puts "构建完成,输出目录: #{output}" end |
#validate! ⇒ Object
24 25 26 27 28 |
# File 'lib/easyci/command/autobuild.rb', line 24 def validate! super help! '必须提供项目路径' unless @project_path help! '必须提供有效的构建目标' unless ['iOS', 'Android', 'WebGL'].include?(@build_target) end |