Sha256: 195b40546a2238b16fa31a94d65ed15d4a283e734a05427ac5bfb3cd12378a39

Contents?: true

Size: 1.49 KB

Versions: 5

Compression:

Stored size: 1.49 KB

Contents

require_relative '../source/core/create_helper'

module OrmDev
  class Command
    class Create < Command
      self.summary = '创建Orm插件模板工程。'

      self.description = <<-DESC
          新建 iOS => Application => Single View Application 工程,工程名为`NAME`
      DESC

      self.arguments = [
          CLAide::Argument.new('NAME', true)
      ]

      def self.options
        [
            ['--template-url=URL', 'Orm插件模板git地址'],
            ['--fast', '快速创建Orm插件模板工程(带测试用例)'],
            ['--prefix=XXX', 'Orm插件模板工程前缀(fast有效)'],
            ['--skip', '跳过打开Orm插件模板工程(fast有效)'],
        ].concat(super)
      end

      def initialize(argv)
        @name = argv.shift_argument
        @template_url = argv.option('template-url')
        @prefix = argv.option('prefix', '')
        @fast = argv.flag?('fast', false)
        @skip = argv.flag?('skip', false)
        super
      end

      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] == '.'
      end

      def run
        create = OrmDev::CreateHelper.new(@name, @fast, @prefix, @template_url)
        create.setup(@skip)
        OrmDev::LogUtil.info "【create】Success!!! "
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ormdev-0.0.7 lib/ormdev/command/create.rb
ormdev-0.0.6 lib/ormdev/command/create.rb
ormdev-0.0.5 lib/ormdev/command/create.rb
ormdev-0.0.4 lib/ormdev/command/create.rb
ormdev-0.0.3 lib/ormdev/command/create.rb