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.0.1"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject (readonly)

Returns the value of attribute config.



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

def config
  @config
end

.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

.create_integrationsObject



33
34
35
36
37
38
39
40
41
# File 'lib/codeland/starter.rb', line 33

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



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

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

.create_rails_projectObject



22
23
24
25
26
27
28
29
30
31
# File 'lib/codeland/starter.rb', line 22

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