Class: Compass::Commands::CsscssProject
- Inherits:
-
ProjectBase
- Object
- ProjectBase
- Compass::Commands::CsscssProject
- Includes:
- Csscss
- Defined in:
- lib/compass-csscss.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) ⇒ CsscssProject
constructor
A new instance of CsscssProject.
- #perform ⇒ Object
Constructor Details
#initialize(working_path, options) ⇒ CsscssProject
Returns a new instance of CsscssProject.
87 88 89 90 |
# File 'lib/compass-csscss.rb', line 87 def initialize(working_path, ) super assert_project_directory_exists! end |
Class Method Details
.description(command) ⇒ Object
183 184 185 |
# File 'lib/compass-csscss.rb', line 183 def description(command) "Run csscss against your sass or generated css." end |
.option_parser(arguments) ⇒ Object
173 174 175 176 177 |
# File 'lib/compass-csscss.rb', line 173 def option_parser(arguments) parser = Compass::Exec::CommandOptionParser.new(arguments) parser.extend(Compass::Exec::ProjectOptionsParser) parser.extend(CsscssOptionsParser) end |
.parse!(arguments) ⇒ Object
187 188 189 190 191 192 |
# File 'lib/compass-csscss.rb', line 187 def parse!(arguments) parser = option_parser(arguments) parser.parse! parse_arguments!(parser, arguments) parser. end |
.parse_arguments!(parser, arguments) ⇒ Object
194 195 196 197 198 199 200 201 202 |
# File 'lib/compass-csscss.rb', line 194 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
179 180 181 |
# File 'lib/compass-csscss.rb', line 179 def usage option_parser([]).to_s end |
Instance Method Details
#perform ⇒ Object
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 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/compass-csscss.rb', line 92 def perform @args = [] if ![:verbose].nil? @args << '--' + ([:verbose] ? '' : 'no-') + 'verbose' end if ![:color].nil? @args << '--' + ([:color] ? '' : 'no-') + 'color' end if [:num] @args << '--num' @args << [:num] end if ![:match_shorthand].nil? @args << '--' + ([:match_shorthand] ? '' : 'no-') + 'match-shorthand' end if ![:json].nil? @args << '--' + ([:json] ? '' : 'no-') + 'json' end if [:ignore_sass_mixins] @args << '--ignore-sass-mixins' end if [:file] @args << '--require' @args << [:file] end if [:ignored_properties] @args << '--ignore-properties' @args << [:ignored_properties] end if [:ignored_selectors] @args << '--ignore-selectors' @args << [:ignored_selectors] end if [:show_parser_errors] @args << '--show-parser-errors' end if [:version] @args << '--version' end if not([:nocompile] || [:sass]) UpdateProject.new(working_path, ).perform end Dir.chdir Compass.configuration.project_path do if [:sass] if Compass.configuration.inherited_data.name.nil? @args << '--compass' else @args << '--compass-with-config' @args << Compass.configuration.inherited_data.name end @args << Dir.glob(project_src_subdirectory+"/**/*.s{a,c}ss") elsif not([:nocompile]) @args << Dir.glob(project_css_subdirectory+"/**/*.css") end Csscss::CLI.run(@args.flatten) end end |