class OrmDev::Command::Create
Public Class Methods
new(argv)
click to toggle source
Calls superclass method
# File lib/ormdev/command/create.rb, line 28 def initialize(argv) @name = argv.shift_argument @template_url = argv.option('template-url') @fast = argv.flag?('fast', false) @skip = argv.flag?('skip', false) super end
options()
click to toggle source
Calls superclass method
# File lib/ormdev/command/create.rb, line 20 def self.options [ ['--template-url=URL', 'Orm插件模板git地址,或者zip地址'], ['--fast', '通过Orm插件模板工程zip地址快速创建'], ['--skip', '跳过打开Orm插件模板工程'], ].concat(super) end
Public Instance Methods
run()
click to toggle source
# File lib/ormdev/command/create.rb, line 47 def run create = OrmDev::CreateHelper.new(@name, @fast, @template_url) create.setup(@skip) OrmDev::LogUtil.info '【创建插件工程】Success!!!,编写插件逻辑代码,添加版本控制' OrmDev::LogUtil.info " cd #{@name}".magenta OrmDev::LogUtil.info 'and' OrmDev::LogUtil.info " ormdev run".magenta end
validate!()
click to toggle source
Calls superclass method
# File lib/ormdev/command/create.rb, line 36 def validate! super help! 'A name for the Pod is required.' unless @name help! 'The Pod name cannot contain spaces.' if @name =~ /\s/ help! 'The Pod name cannot contain plusses.' if @name =~ /\+/ help! "The Pod name cannot begin with a '.'" if @name[0, 1] == '.' unless @template_url.nil? then help! '模板地址只能是以[git|zip]结尾的地址.' if !(@template_url.downcase.end_with?('.git') || @template_url.downcase.end_with?('.zip')) end end