Class: OrmDev::CreateHelper

Inherits:
Object
  • Object
show all
Extended by:
Pod::Executable
Defined in:
lib/ormdev/source/core/create_helper.rb

Constant Summary collapse

ORMDEV_TEMPLATE_URL =
'https://gitee.com/mvn/pod-template.git'.freeze
ORMDEV_FAST_TEMPLATE_URL =
'https://gitee.com/mvn/pod-fast-template.git'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, fast = false, prefix = '', template_url = nil) ⇒ CreateHelper

Returns a new instance of CreateHelper.



18
19
20
21
22
23
24
25
26
27
# File 'lib/ormdev/source/core/create_helper.rb', line 18

def initialize(name, fast = false, prefix = '', template_url = nil)
  @project_name  = name
  @class_prefix  = prefix
  @fast_build = fast
  if @fast_build then
    @template_url = template_url || ORMDEV_FAST_TEMPLATE_URL
  else
    @template_url = template_url || ORMDEV_TEMPLATE_URL
  end
end

Instance Attribute Details

#class_prefixObject (readonly)

Returns the value of attribute class_prefix.



15
16
17
# File 'lib/ormdev/source/core/create_helper.rb', line 15

def class_prefix
  @class_prefix
end

#fast_buildObject (readonly)

ORMDEV_PLUGIN_TEMPLATE_URL = ‘gitee.com/mvn/pod-plugin-template.git’.freeze ORMDEV_PLUGIN_FAST_TEMPLATE_URL = ‘gitee.com/mvn/pod-plugin-fast-template.git’.freeze



13
14
15
# File 'lib/ormdev/source/core/create_helper.rb', line 13

def fast_build
  @fast_build
end

#project_nameObject (readonly)

Returns the value of attribute project_name.



14
15
16
# File 'lib/ormdev/source/core/create_helper.rb', line 14

def project_name
  @project_name
end

#template_urlObject (readonly)

Returns the value of attribute template_url.



16
17
18
# File 'lib/ormdev/source/core/create_helper.rb', line 16

def template_url
  @template_url
end

Instance Method Details

#setup(skip = false) ⇒ Object



29
30
31
32
33
34
35
36
37
38
# File 'lib/ormdev/source/core/create_helper.rb', line 29

def setup(skip= false)
  if @fast_build then
    clone_template
    configure_template(skip)
    print_info
  else
    create_command = "pod lib create #{@project_name} --template-url=#{@template_url}"
    OrmDev::SHUtil.run_command(create_command,'创建ORM插件工程')
  end
end