Class: ProjectBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/marmalade/project_builder.rb

Overview

Builds a project scaffolding TODO: Currently Ruby 1.9-only – make this work with 1.8

Instance Method Summary collapse

Instance Method Details

#create(project_name) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/marmalade/project_builder.rb', line 7

def create(project_name)
  template_path = File.join(File.expand_path('../../../', __FILE__), 'templates')

  # Create project directory
  puts "Creating directory #{project_name}"
  Dir.mkdir(project_name)

  # Copy all template files into it
  main_file = File.join(project_name, "#{project_name}.rb")
  copy_file(File.join(template_path, 'main.rb'), main_file)
  copy_file(File.join(template_path, 'main_spec.rb'), File.join(project_name, "#{project_name}_spec.rb"))
  copy_file(File.join(template_path, 'Rakefile'), File.join(project_name, 'Rakefile'))
end