Module: Codeland::Starter

Defined in:
lib/codeland/starter.rb,
lib/codeland/starter/cli.rb,
lib/codeland/starter/version.rb,
lib/codeland/starter/configuration.rb,
lib/codeland/starter/integrations/heroku.rb

Defined Under Namespace

Modules: Integrations Classes: CLI, Configuration, MissingYAML

Constant Summary collapse

ROOT_PATH =
File.join(File.dirname(__FILE__), '..', '..')
VERSION =
'0.1.0'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.nameObject (readonly)

Returns the value of attribute name.



13
14
15
# File 'lib/codeland/starter.rb', line 13

def name
  @name
end

Class Method Details

.configObject



15
16
17
# File 'lib/codeland/starter.rb', line 15

def config
  @config ||= Configuration.new
end

.create_integrationsObject



37
38
39
40
41
42
43
44
45
# File 'lib/codeland/starter.rb', line 37

def create_integrations
  config.integrations && config.integrations.each do |integration|
    integration_class_name = integration.capitalize
    if have_integration?(integration_class_name)
      client = Integrations.const_get(integration_class_name).new
      client.perform
    end
  end
end

.create_project(name, yaml_file) ⇒ Object



19
20
21
22
23
24
# File 'lib/codeland/starter.rb', line 19

def create_project(name, yaml_file)
  @name = name
  @config = Configuration.new(yaml_file)
  create_rails_project
  create_integrations
end

.create_rails_projectObject



26
27
28
29
30
31
32
33
34
35
# File 'lib/codeland/starter.rb', line 26

def create_rails_project
  options = [
    '--database=postgresql',
    "--template=#{File.join(ROOT_PATH, 'template', 'codeland.rb')}",
    '--skip-bundle',
    '--skip-test-unit'
  ]
  system("rails new #{name} #{options.join(' ')}")
  Dir.chdir(name)
end