Class: Compass::Commands::UpdateProject

Inherits:
ProjectBase show all
Defined in:
lib/compass/commands/update_project.rb

Direct Known Subclasses

ProjectStats, WatchProject

Instance Attribute Summary

Attributes inherited from ProjectBase

#options, #project_name

Attributes inherited from Base

#options, #working_path

Attributes included from Actions

#logger

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ProjectBase

#execute

Methods inherited from Base

#execute, register

Methods included from Actions

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

Constructor Details

#initialize(working_path, options) ⇒ UpdateProject

Returns a new instance of UpdateProject.



25
26
27
28
# File 'lib/compass/commands/update_project.rb', line 25

def initialize(working_path, options)
  super
  assert_project_directory_exists! unless dry_run?
end

Class Method Details

.description(command) ⇒ Object



67
68
69
# File 'lib/compass/commands/update_project.rb', line 67

def description(command)
  "Compile Sass stylesheets to CSS"
end

.option_parser(arguments) ⇒ Object



54
55
56
57
58
59
# File 'lib/compass/commands/update_project.rb', line 54

def option_parser(arguments)
  parser = Compass::Exec::CommandOptionParser.new(arguments)
  parser.extend(Compass::Exec::GlobalOptionsParser)
  parser.extend(Compass::Exec::ProjectOptionsParser)
  parser.extend(CompileProjectOptionsParser)
end

.parse!(arguments) ⇒ Object



71
72
73
74
75
76
# File 'lib/compass/commands/update_project.rb', line 71

def parse!(arguments)
  parser = option_parser(arguments)
  parser.parse!
  parse_arguments!(parser, arguments)
  parser.options
end

.parse_arguments!(parser, arguments) ⇒ Object



78
79
80
81
82
83
84
# File 'lib/compass/commands/update_project.rb', line 78

def parse_arguments!(parser, arguments)
  if arguments.size == 1
    parser.options[:project_name] = arguments.shift
  elsif arguments.size > 1
    raise Compass::Error, "Too many arguments were specified."
  end
end

.primaryObject



65
# File 'lib/compass/commands/update_project.rb', line 65

def primary; true; end

.usageObject



61
62
63
# File 'lib/compass/commands/update_project.rb', line 61

def usage
  option_parser([]).to_s
end

Instance Method Details

#dry_run?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/compass/commands/update_project.rb', line 41

def dry_run?
  options[:dry_run]
end

#new_compiler_instance(additional_options = {}) ⇒ Object



45
46
47
48
49
50
51
# File 'lib/compass/commands/update_project.rb', line 45

def new_compiler_instance(additional_options = {})
  Compass::Compiler.new(working_path,
    projectize(Compass.configuration.sass_dir),
    projectize(Compass.configuration.css_dir),
    Compass.sass_engine_options.merge(:quiet => options[:quiet],
                                      :force => options[:force]).merge(additional_options))
end

#performObject



30
31
32
33
34
35
36
37
38
39
# File 'lib/compass/commands/update_project.rb', line 30

def perform
  compiler = new_compiler_instance
  if compiler.sass_files.empty? && !dry_run?
    message = "Nothing to compile. If you're trying to start a new project, you have left off the directory argument.\n"
    message << "Run \"compass -h\" to get help."
    raise Compass::Error, message
  else
    compiler.run
  end
end