Class: Bytedance::BytedanceManager::Lib::Create
- Inherits:
-
Bytedance::BytedanceManager::Lib
- Object
- CLAide::Command
- Bytedance::BytedanceManager
- Bytedance::BytedanceManager::Lib
- Bytedance::BytedanceManager::Lib::Create
- Defined in:
- lib/command/lib/create.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params) ⇒ Create
constructor
A new instance of Create.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(params) ⇒ Create
Returns a new instance of Create.
13 14 15 16 17 18 19 |
# File 'lib/command/lib/create.rb', line 13 def initialize(params) @projectName = params.shift_argument @components = params.option('components','optional') @prefix = params.option('prefix','TT') @platform = params.flag?('platform',true) super end |
Class Method Details
.options ⇒ Object
7 8 9 10 11 |
# File 'lib/command/lib/create.rb', line 7 def self. [['--platform', '是否引入平台基础库,默认引入,不引入使用--no-platform'], ['--components=[none|optional|all]', 'none 不引入任何组件,optional 选择自己想要的(default), all 引入全部组件,于平台一致'], ['--prefix', '可选,默认 prefix = TT']].concat(super) end |
Instance Method Details
#run ⇒ Object
33 34 35 36 37 38 |
# File 'lib/command/lib/create.rb', line 33 def run super parameter = [@projectName,'--components='+ @components,'--prefix=' + @prefix, @platform ? '--platform' : '--no-platform', '[email protected]:TTIOS/pod-template.git','--createlib'] finalParams = CLAide::ARGV.new(parameter) Pod::Command::Lib::Create.new(finalParams).run end |
#validate! ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/command/lib/create.rb', line 21 def validate! super if @components && !%w(none optional all).include?(@components) help! "`#{@components}' 参数无效,components = none 或 optional 或 all " end if !@projectName help! "参数错误,需要输入项目名称,bytedance lib create projectName" end end |