Class: Compass::Commands::ValidateProject

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

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, #failed!, register, #successful?

Methods included from Actions

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

Constructor Details

#initialize(working_path, options) ⇒ ValidateProject

Returns a new instance of ValidateProject.



26
27
28
29
# File 'lib/compass/commands/validate_project.rb', line 26

def initialize(working_path, options)
  super
  assert_project_directory_exists!
end

Class Method Details

.description(command) ⇒ Object



52
53
54
# File 'lib/compass/commands/validate_project.rb', line 52

def description(command)
  "Validate your generated css."
end

.option_parser(arguments) ⇒ Object



41
42
43
44
45
46
# File 'lib/compass/commands/validate_project.rb', line 41

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

.parse!(arguments) ⇒ Object



56
57
58
59
60
61
# File 'lib/compass/commands/validate_project.rb', line 56

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

.parse_arguments!(parser, arguments) ⇒ Object



63
64
65
66
67
68
69
70
71
# File 'lib/compass/commands/validate_project.rb', line 63

def parse_arguments!(parser, arguments)
  if arguments.size == 1
    parser.options[:project_name] = arguments.shift
  elsif arguments.size == 0
    # default to the current directory.
  else
    raise Compass::Error, "Too many arguments were specified."
  end
end

.usageObject



48
49
50
# File 'lib/compass/commands/validate_project.rb', line 48

def usage
  option_parser([]).to_s
end

Instance Method Details

#performObject



31
32
33
34
35
36
37
# File 'lib/compass/commands/validate_project.rb', line 31

def perform
  require 'compass/validator'
  UpdateProject.new(working_path, options).perform
  Dir.chdir Compass.configuration.project_path do
    Validator.new(project_css_subdirectory).validate()
  end
end