Sha256: 180aecf0ff3aefbdbe28278d5eca454c739a306cac9494d882d3aa1f8ff8ee60

Contents?: true

Size: 833 Bytes

Versions: 16

Compression:

Stored size: 833 Bytes

Contents

class New::Project
  include New::Version

  # Create all variables and run new project creation methods
  #
  def initialize template, name
    @project_dir = File.join(Dir.pwd, name.to_s) # the newly created project directory
    @template = New::Template.new template, name

    copy_template
    create_config_file
  end

private

  # Create the new project by copying the template directory
  #
  def copy_template
    FileUtils.cp_r @template.dir, @project_dir

    # cleanup tmp
    FileUtils.rm_rf @template.dir
  end

  # Create the .new configuration file in the new project
  #
  def create_config_file
    new_config = File.join(@project_dir, New::CONFIG_FILE)
    File.open new_config, 'w' do |f|
      yaml_options = @template.options.deep_dup.deep_stringify_keys!.to_yaml
      f.write(yaml_options)
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
new-0.1.1 lib/new/project.rb
new-0.0.15 lib/new/project.rb
new-0.0.14 lib/new/project.rb
new-0.0.13 lib/new/project.rb
new-0.0.12 lib/new/project.rb
new-0.0.11 lib/new/project.rb
new-0.0.10 lib/new/project.rb
new-0.0.9 lib/new/project.rb
new-0.0.8 lib/new/project.rb
new-0.0.7 lib/new/project.rb
new-0.0.6 lib/new/project.rb
new-0.0.5 lib/new/project.rb
new-0.0.4 lib/new/project.rb
new-0.0.3 lib/new/project.rb
new-0.0.2 lib/new/project.rb
new-0.0.0 lib/new/project.rb