Class: Compass::Commands::CSSLintProject
- Inherits:
-
ProjectBase
- Object
- ProjectBase
- Compass::Commands::CSSLintProject
- Includes:
- CSSLint
- Defined in:
- lib/compass-csslint.rb
Class Method Summary collapse
- .description(command) ⇒ Object
- .option_parser(arguments) ⇒ Object
- .parse!(arguments) ⇒ Object
- .parse_arguments!(parser, arguments) ⇒ Object
- .usage ⇒ Object
Instance Method Summary collapse
-
#initialize(working_path, options) ⇒ CSSLintProject
constructor
A new instance of CSSLintProject.
- #perform ⇒ Object
Constructor Details
#initialize(working_path, options) ⇒ CSSLintProject
Returns a new instance of CSSLintProject.
71 72 73 74 |
# File 'lib/compass-csslint.rb', line 71 def initialize(working_path, ) super assert_project_directory_exists! end |
Class Method Details
.description(command) ⇒ Object
132 133 134 |
# File 'lib/compass-csslint.rb', line 132 def description(command) "Run CSS Lint against your generated css." end |
.option_parser(arguments) ⇒ Object
122 123 124 125 126 |
# File 'lib/compass-csslint.rb', line 122 def option_parser(arguments) parser = Compass::Exec::CommandOptionParser.new(arguments) parser.extend(Compass::Exec::ProjectOptionsParser) parser.extend(CSSLintOptionsParser) end |
.parse!(arguments) ⇒ Object
136 137 138 139 140 141 |
# File 'lib/compass-csslint.rb', line 136 def parse!(arguments) parser = option_parser(arguments) parser.parse! parse_arguments!(parser, arguments) parser. end |
.parse_arguments!(parser, arguments) ⇒ Object
143 144 145 146 147 148 149 150 151 |
# File 'lib/compass-csslint.rb', line 143 def parse_arguments!(parser, arguments) if arguments.size == 1 parser.[:project_name] = arguments.shift elsif arguments.size == 0 # default to the current directory. else raise Compass::Error, "Too many arguments were specified." end end |
.usage ⇒ Object
128 129 130 |
# File 'lib/compass-csslint.rb', line 128 def usage option_parser([]).to_s end |
Instance Method Details
#perform ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/compass-csslint.rb', line 76 def perform @options_str = '' if [:format] @options_str << '--format=' + [:format] + ' ' end if [:list_rules] @options_str << '--list-rules' end if [:quiet] @options_str << '--quiet ' end if [:errors] @options_str << '--errors=' + [:errors] + ' ' end if [:warnings] @options_str << '--warnings=' + [:warnings] + ' ' end if [:ignore] @options_str << '--ignore=' + [:ignore] + ' ' end if [:exclude_list] @options_str << '--exclude-list=' + [:exclude_list] + ' ' end if [:version] @options_str << '--version' end if not([:nocompile]) UpdateProject.new(working_path, ).perform end Dir.chdir Compass.configuration.project_path do Lint.new(project_css_subdirectory).execute(@options_str) end end |