Class: Prek::PrekManager::Module::Create
- Inherits:
-
Prek::PrekManager::Module
- Object
- CLAide::Command
- Prek::PrekManager
- Prek::PrekManager::Module
- Prek::PrekManager::Module::Create
- Defined in:
- lib/command/module/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.
11 12 13 14 15 16 17 |
# File 'lib/command/module/create.rb', line 11 def initialize(params) @projectName = params.shift_argument @components = params.option('components','optional') @prefix = params.option('prefix','Prek') @platform = params.flag?('platform',true) super end |
Class Method Details
.options ⇒ Object
7 8 9 |
# File 'lib/command/module/create.rb', line 7 def self. [].concat(super) end |
Instance Method Details
#run ⇒ Object
31 32 33 34 35 36 |
# File 'lib/command/module/create.rb', line 31 def run super parameter = [@projectName,'--components='+ @components,'--prefix=' + @prefix, @platform ? '--platform' : '--no-platform', '[email protected]:prek/pod-template.git'] finalParams = CLAide::ARGV.new(parameter) Pod::Command::Lib::Create.new(finalParams).run end |
#validate! ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/command/module/create.rb', line 19 def validate! super if @components && !%w(none optional all).include?(@components) help! "`#{@components}' 参数无效,components = none 或 optional 或 all " end if !@projectName help! "参数错误,需要输入项目名称,bytedance project create projectName" end end |