Class: Compass::Commands::CreateProject

Inherits:
ProjectBase show all
Includes:
Installers
Defined in:
lib/compass/commands/create_project.rb

Instance Attribute Summary collapse

Attributes inherited from ProjectBase

#options, #project_name

Attributes inherited from Base

#options, #working_path

Attributes included from Actions

#logger

Instance Method Summary collapse

Methods included from Actions

#basename, #compile, #copy, #directory, #relativize, #separate, #strip_trailing_separator, #write_file

Constructor Details

#initialize(working_path, options) ⇒ CreateProject

Returns a new instance of CreateProject.



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/compass/commands/create_project.rb', line 14

def initialize(working_path, options)
  super(working_path, options)
  installer_args = [project_template_directory, project_directory, self.options]
  @installer = case options[:project_type]
  when :stand_alone
    StandAloneInstaller.new *installer_args
  when :rails
    RailsInstaller.new *installer_args
  else
    raise "Unknown project type: #{project_type}"
  end
end

Instance Attribute Details

#installerObject

Returns the value of attribute installer.



12
13
14
# File 'lib/compass/commands/create_project.rb', line 12

def installer
  @installer
end

Instance Method Details

#performObject

all commands must implement perform



28
29
30
31
32
33
# File 'lib/compass/commands/create_project.rb', line 28

def perform
  installer.init
  installer.run(:skip_finalization => true)
  UpdateProject.new(working_path, options).perform if installer.compilation_required?
  installer.finalize(:create => true)
end

#project_template_directoryObject



35
36
37
# File 'lib/compass/commands/create_project.rb', line 35

def project_template_directory
  File.join(framework.templates_directory, "project")
end