compass-edge 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +34 -1
- data/VERSION.yml +3 -2
- data/features/command_line.feature +219 -0
- data/features/step_definitions/command_line_steps.rb +199 -0
- data/lib/compass/app_integration/rails/installer.rb +3 -1
- data/lib/compass/app_integration/stand_alone/installer.rb +26 -11
- data/lib/compass/commands.rb +1 -1
- data/lib/compass/commands/create_project.rb +8 -1
- data/lib/compass/commands/installer_command.rb +6 -2
- data/lib/compass/commands/project_stats.rb +160 -0
- data/lib/compass/commands/update_project.rb +49 -1
- data/lib/compass/commands/validate_project.rb +56 -2
- data/lib/compass/commands/watch_project.rb +3 -1
- data/lib/compass/commands/write_configuration.rb +60 -2
- data/lib/compass/compiler.rb +4 -3
- data/lib/compass/configuration/helpers.rb +9 -0
- data/lib/compass/errors.rb +4 -1
- data/lib/compass/exec.rb +1 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass +2 -2
- data/lib/compass/installers.rb +1 -1
- data/lib/compass/installers/bare_installer.rb +62 -0
- data/lib/compass/installers/base.rb +7 -51
- data/lib/compass/installers/manifest_installer.rb +59 -0
- data/lib/compass/sass_extensions/monkey_patches.rb +2 -2
- data/lib/compass/sass_extensions/monkey_patches/traversal.rb +23 -0
- data/lib/compass/stats.rb +92 -0
- data/lib/compass/validator.rb +2 -3
- data/test/command_line_helper.rb +6 -2
- data/test/fixtures/stylesheets/compass/css/reset.css +1 -1
- data/test/io_helper.rb +18 -1
- data/test/rails_helper.rb +40 -0
- data/test/rails_integration_test.rb +2 -40
- data/test/test_helper.rb +1 -0
- metadata +12 -3
data/Rakefile
CHANGED
@@ -14,6 +14,7 @@ require 'rubygems'
|
|
14
14
|
require 'rake'
|
15
15
|
$:.unshift File.join(File.dirname(__FILE__), 'lib')
|
16
16
|
require 'compass'
|
17
|
+
require 'rcov/rcovtask'
|
17
18
|
|
18
19
|
# ----- Default: Testing ------
|
19
20
|
|
@@ -39,7 +40,7 @@ begin
|
|
39
40
|
require 'jeweler'
|
40
41
|
Jeweler::Tasks.new do |gemspec|
|
41
42
|
gemspec.rubyforge_project = "compass"
|
42
|
-
gemspec.name = "compass"
|
43
|
+
gemspec.name = "compass-edge"
|
43
44
|
gemspec.summary = "A Real Stylesheet Framework"
|
44
45
|
gemspec.email = "chris@eppsteins.net"
|
45
46
|
gemspec.homepage = "http://compass-style.org"
|
@@ -65,6 +66,7 @@ begin
|
|
65
66
|
gemspec.files -= Dir.glob("test/fixtures/stylesheets/*/saved/**/*.*")
|
66
67
|
gemspec.test_files = Dir.glob("test/**/*.*")
|
67
68
|
gemspec.test_files -= Dir.glob("test/fixtures/stylesheets/*/saved/**/*.*")
|
69
|
+
gemspec.test_files += Dir.glob("features/**/*.*")
|
68
70
|
end
|
69
71
|
rescue LoadError
|
70
72
|
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
@@ -129,3 +131,34 @@ namespace :git do
|
|
129
131
|
sh "git", "clean", "-fdx"
|
130
132
|
end
|
131
133
|
end
|
134
|
+
|
135
|
+
require 'cucumber/rake/task'
|
136
|
+
|
137
|
+
namespace :rcov do
|
138
|
+
Cucumber::Rake::Task.new(:cucumber) do |t|
|
139
|
+
t.rcov = true
|
140
|
+
t.rcov_opts = %w{--exclude osx\/objc,gems\/,spec\/,features\/ --aggregate coverage.data}
|
141
|
+
t.rcov_opts << %[-o "coverage"]
|
142
|
+
end
|
143
|
+
|
144
|
+
Rcov::RcovTask.new(:units) do |rcov|
|
145
|
+
rcov.libs << 'lib'
|
146
|
+
rcov.libs << 'haml/lib' if ENV["RUN_CODE_RUN"]
|
147
|
+
test_files = FileList['test/**/*_test.rb']
|
148
|
+
test_files.exclude('test/rails/*', 'test/haml/*')
|
149
|
+
rcov.pattern = test_files
|
150
|
+
rcov.output_dir = 'coverage'
|
151
|
+
rcov.verbose = true
|
152
|
+
rcov.rcov_opts = %w{--exclude osx\/objc,gems\/,spec\/,features\/ --aggregate coverage.data}
|
153
|
+
rcov.rcov_opts << %[-o "coverage" --sort coverage]
|
154
|
+
end
|
155
|
+
|
156
|
+
|
157
|
+
desc "Run both specs and features to generate aggregated coverage"
|
158
|
+
task :all do |t|
|
159
|
+
rm "coverage.data" if File.exist?("coverage.data")
|
160
|
+
Rake::Task["rcov:units"].invoke
|
161
|
+
Rake::Task["rcov:cucumber"].invoke
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
data/VERSION.yml
CHANGED
@@ -0,0 +1,219 @@
|
|
1
|
+
Feature: Command Line
|
2
|
+
In order to manage my stylesheets
|
3
|
+
As a user on the command line
|
4
|
+
I want to create a new project
|
5
|
+
|
6
|
+
Scenario: Install a project without a framework
|
7
|
+
When I create a project using: compass create my_project
|
8
|
+
Then a directory my_project/ is created
|
9
|
+
And a configuration file my_project/config.rb is created
|
10
|
+
And a sass file my_project/src/screen.sass is created
|
11
|
+
And a sass file my_project/src/print.sass is created
|
12
|
+
And a sass file my_project/src/ie.sass is created
|
13
|
+
And a sass file my_project/src/screen.sass is compiled
|
14
|
+
And a sass file my_project/src/print.sass is compiled
|
15
|
+
And a sass file my_project/src/ie.sass is compiled
|
16
|
+
And a css file my_project/stylesheets/screen.css is created
|
17
|
+
And a css file my_project/stylesheets/print.css is created
|
18
|
+
And a css file my_project/stylesheets/ie.css is created
|
19
|
+
And I am told how to link to /stylesheets/screen.css for media "screen, projection"
|
20
|
+
And I am told how to link to /stylesheets/print.css for media "print"
|
21
|
+
And I am told how to conditionally link "IE" to /stylesheets/ie.css for media "screen, projection"
|
22
|
+
|
23
|
+
Scenario: Install a project with blueprint
|
24
|
+
When I create a project using: compass create bp_project --using blueprint
|
25
|
+
Then a directory bp_project/ is created
|
26
|
+
And a configuration file bp_project/config.rb is created
|
27
|
+
And a sass file bp_project/src/screen.sass is created
|
28
|
+
And a sass file bp_project/src/print.sass is created
|
29
|
+
And a sass file bp_project/src/ie.sass is created
|
30
|
+
And a sass file bp_project/src/screen.sass is compiled
|
31
|
+
And a sass file bp_project/src/print.sass is compiled
|
32
|
+
And a sass file bp_project/src/ie.sass is compiled
|
33
|
+
And a css file bp_project/stylesheets/screen.css is created
|
34
|
+
And a css file bp_project/stylesheets/print.css is created
|
35
|
+
And a css file bp_project/stylesheets/ie.css is created
|
36
|
+
And an image file bp_project/images/grid.png is created
|
37
|
+
And I am told how to link to /stylesheets/screen.css for media "screen, projection"
|
38
|
+
And I am told how to link to /stylesheets/print.css for media "print"
|
39
|
+
And I am told how to conditionally link "lt IE 8" to /stylesheets/ie.css for media "screen, projection"
|
40
|
+
|
41
|
+
Scenario: Install a project with specific directories
|
42
|
+
When I create a project using: compass create custom_project --using blueprint --sass-dir sass --css-dir css --images-dir assets/imgs
|
43
|
+
Then a directory custom_project/ is created
|
44
|
+
And a directory custom_project/sass/ is created
|
45
|
+
And a directory custom_project/css/ is created
|
46
|
+
And a directory custom_project/assets/imgs/ is created
|
47
|
+
And a sass file custom_project/sass/screen.sass is created
|
48
|
+
And a css file custom_project/css/screen.css is created
|
49
|
+
And an image file custom_project/assets/imgs/grid.png is created
|
50
|
+
|
51
|
+
Scenario: Perform a dry run of creating a project
|
52
|
+
When I create a project using: compass create my_project --dry-run
|
53
|
+
Then a directory my_project/ is not created
|
54
|
+
But a configuration file my_project/config.rb is reported created
|
55
|
+
And a sass file my_project/src/screen.sass is reported created
|
56
|
+
And a sass file my_project/src/print.sass is reported created
|
57
|
+
And a sass file my_project/src/ie.sass is reported created
|
58
|
+
And I am told how to link to /stylesheets/screen.css for media "screen, projection"
|
59
|
+
And I am told how to link to /stylesheets/print.css for media "print"
|
60
|
+
And I am told how to conditionally link "IE" to /stylesheets/ie.css for media "screen, projection"
|
61
|
+
|
62
|
+
Scenario: Creating a bare project
|
63
|
+
When I create a project using: compass create bare_project --bare
|
64
|
+
Then a directory bare_project/ is created
|
65
|
+
And a configuration file bare_project/config.rb is created
|
66
|
+
And a directory bare_project/src/ is created
|
67
|
+
And a directory bare_project/stylesheets/ is not created
|
68
|
+
And I am congratulated
|
69
|
+
And I am told that I can place stylesheets in the src subdirectory
|
70
|
+
And I am told how to compile my sass stylesheets
|
71
|
+
|
72
|
+
Scenario: Creating a bare project with a framework
|
73
|
+
When I create a project using: compass create bare_project --using blueprint --bare
|
74
|
+
Then an error message is printed out: A bare project cannot be created when a framework is specified.
|
75
|
+
And the command exits with a non-zero error code
|
76
|
+
|
77
|
+
Scenario: Initializing a rails project
|
78
|
+
Given I'm in a newly created rails project: my_rails_project
|
79
|
+
When I initialize a project using: compass init rails --sass-dir app/stylesheets --css-dir public/stylesheets/compiled
|
80
|
+
Then a config file config/compass.config is reported created
|
81
|
+
Then a config file config/compass.config is created
|
82
|
+
And a ruby file config/compass.config is created
|
83
|
+
And a sass file config/initializers/compass.rb is created
|
84
|
+
And a sass file app/stylesheets/screen.sass is created
|
85
|
+
And a sass file app/stylesheets/print.sass is created
|
86
|
+
And a sass file app/stylesheets/ie.sass is created
|
87
|
+
|
88
|
+
Scenario: Compiling an existing project.
|
89
|
+
Given I am using the existing project in test/fixtures/stylesheets/compass
|
90
|
+
When I run: compass compile
|
91
|
+
Then a directory tmp/ is created
|
92
|
+
And a sass file sass/layout.sass is reported compiled
|
93
|
+
And a sass file sass/print.sass is reported compiled
|
94
|
+
And a sass file sass/reset.sass is reported compiled
|
95
|
+
And a sass file sass/utilities.sass is reported compiled
|
96
|
+
And a css file tmp/layout.css is created
|
97
|
+
And a css file tmp/print.css is created
|
98
|
+
And a css file tmp/reset.css is created
|
99
|
+
And a css file tmp/utilities.css is created
|
100
|
+
|
101
|
+
Scenario: Compiling an existing project with a specified project
|
102
|
+
Given I am using the existing project in test/fixtures/stylesheets/compass
|
103
|
+
And I am in the parent directory
|
104
|
+
When I run: compass compile tmp_compass
|
105
|
+
Then a directory tmp_compass/tmp/ is created
|
106
|
+
And a sass file tmp_compass/sass/layout.sass is reported compiled
|
107
|
+
And a sass file tmp_compass/sass/print.sass is reported compiled
|
108
|
+
And a sass file tmp_compass/sass/reset.sass is reported compiled
|
109
|
+
And a sass file tmp_compass/sass/utilities.sass is reported compiled
|
110
|
+
And a css file tmp_compass/tmp/layout.css is created
|
111
|
+
And a css file tmp_compass/tmp/print.css is created
|
112
|
+
And a css file tmp_compass/tmp/reset.css is created
|
113
|
+
And a css file tmp_compass/tmp/utilities.css is created
|
114
|
+
|
115
|
+
Scenario: Recompiling a project with no changes
|
116
|
+
Given I am using the existing project in test/fixtures/stylesheets/compass
|
117
|
+
When I run: compass compile
|
118
|
+
And I run: compass compile
|
119
|
+
Then a sass file sass/layout.sass is reported unchanged
|
120
|
+
And a sass file sass/print.sass is reported unchanged
|
121
|
+
And a sass file sass/reset.sass is reported unchanged
|
122
|
+
And a sass file sass/utilities.sass is reported unchanged
|
123
|
+
|
124
|
+
Scenario: Installing a pattern into a project
|
125
|
+
Given I am using the existing project in test/fixtures/stylesheets/compass
|
126
|
+
When I run: compass install blueprint/buttons
|
127
|
+
Then a sass file sass/buttons.sass is created
|
128
|
+
And an image file images/buttons/cross.png is created
|
129
|
+
And an image file images/buttons/key.png is created
|
130
|
+
And an image file images/buttons/tick.png is created
|
131
|
+
And a css file tmp/buttons.css is created
|
132
|
+
|
133
|
+
Scenario: Basic help
|
134
|
+
When I run: compass help
|
135
|
+
Then I should be shown a list of available commands
|
136
|
+
And the list of commands should describe the compile command
|
137
|
+
And the list of commands should describe the create command
|
138
|
+
And the list of commands should describe the grid-img command
|
139
|
+
And the list of commands should describe the help command
|
140
|
+
And the list of commands should describe the init command
|
141
|
+
And the list of commands should describe the install command
|
142
|
+
And the list of commands should describe the version command
|
143
|
+
|
144
|
+
Scenario: Recompiling a project with no material changes
|
145
|
+
Given I am using the existing project in test/fixtures/stylesheets/compass
|
146
|
+
When I run: compass compile
|
147
|
+
And I wait 1 second
|
148
|
+
And I touch sass/layout.sass
|
149
|
+
And I run: compass compile
|
150
|
+
Then a sass file sass/layout.sass is reported compiled
|
151
|
+
Then a css file tmp/layout.css is reported identical
|
152
|
+
And a sass file sass/print.sass is reported unchanged
|
153
|
+
And a sass file sass/reset.sass is reported unchanged
|
154
|
+
And a sass file sass/utilities.sass is reported unchanged
|
155
|
+
|
156
|
+
Scenario: Recompiling a project with changes
|
157
|
+
Given I am using the existing project in test/fixtures/stylesheets/compass
|
158
|
+
When I run: compass compile
|
159
|
+
And I wait 1 second
|
160
|
+
And I add some sass to sass/layout.sass
|
161
|
+
And I run: compass compile
|
162
|
+
Then a sass file sass/layout.sass is reported compiled
|
163
|
+
And a css file tmp/layout.css is reported overwritten
|
164
|
+
And a sass file sass/print.sass is reported unchanged
|
165
|
+
And a sass file sass/reset.sass is reported unchanged
|
166
|
+
And a sass file sass/utilities.sass is reported unchanged
|
167
|
+
|
168
|
+
Scenario: Watching a project for changes
|
169
|
+
Given I am using the existing project in test/fixtures/stylesheets/compass
|
170
|
+
When I run: compass compile
|
171
|
+
And I run in a separate process: compass watch
|
172
|
+
And I wait 1 second
|
173
|
+
And I touch sass/layout.sass
|
174
|
+
And I wait 2 seconds
|
175
|
+
And I shutdown the other process
|
176
|
+
Then a css file tmp/layout.css is reported identical
|
177
|
+
|
178
|
+
Scenario: Generating a grid image so that I can debug my grid alignments
|
179
|
+
Given I am using the existing project in test/fixtures/stylesheets/compass
|
180
|
+
When I run: compass grid-img 30+10x24
|
181
|
+
Then a png file images/grid.png is created
|
182
|
+
|
183
|
+
Scenario: Generating a grid image to a specified path with custom dimensions
|
184
|
+
Given I am using the existing project in test/fixtures/stylesheets/compass
|
185
|
+
When I run: compass grid-img 50+10x24 assets/wide_grid.png
|
186
|
+
Then a directory assets is created
|
187
|
+
Then a png file assets/wide_grid.png is created
|
188
|
+
|
189
|
+
Scenario: Generating a grid image with invalid dimensions
|
190
|
+
Given I am using the existing project in test/fixtures/stylesheets/compass
|
191
|
+
When I run: compass grid-img 50x24 assets/wide_grid.png
|
192
|
+
Then a directory assets is not created
|
193
|
+
And a png file assets/wide_grid.png is not created
|
194
|
+
|
195
|
+
Scenario: Generate a compass configuration file
|
196
|
+
When I run: compass config config/compass.rb --sass-dir sass --css-dir assets/css
|
197
|
+
Then a configuration file config/compass.rb is created
|
198
|
+
And the following configuration properties are set in config/compass.rb:
|
199
|
+
| property | value |
|
200
|
+
| sass_dir | sass |
|
201
|
+
| css_dir | assets/css |
|
202
|
+
|
203
|
+
Scenario: Validate the generated CSS
|
204
|
+
Given I am using the existing project in test/fixtures/stylesheets/compass
|
205
|
+
When I run: compass validate
|
206
|
+
Then my css is validated
|
207
|
+
And I am informed that my css is valid.
|
208
|
+
|
209
|
+
Scenario: Get stats for my project
|
210
|
+
Given I am using the existing project in test/fixtures/stylesheets/compass
|
211
|
+
When I run: compass stats
|
212
|
+
Then I am told statistics for each file:
|
213
|
+
| Filename | Rules | Properties | Mixins Defs | Mixins Used | CSS Rules | CSS Properties |
|
214
|
+
| sass/layout.sass | 0 | 0 | 0 | 1 | 5 | 9 |
|
215
|
+
| sass/print.sass | 0 | 0 | 0 | 2 | 61 | 61 |
|
216
|
+
| sass/reset.sass | 4 | 1 | 0 | 2 | 191 | 665 |
|
217
|
+
| sass/utilities.sass | 2 | 0 | 0 | 2 | 5 | 11 |
|
218
|
+
| Total.* | 6 | 1 | 0 | 7 | 262 | 746 |
|
219
|
+
|
@@ -0,0 +1,199 @@
|
|
1
|
+
require 'spec/expectations'
|
2
|
+
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), '../../test')))
|
3
|
+
|
4
|
+
require 'test_helper'
|
5
|
+
|
6
|
+
require 'compass/exec'
|
7
|
+
|
8
|
+
include Compass::CommandLineHelper
|
9
|
+
include Compass::IoHelper
|
10
|
+
include Compass::RailsHelper
|
11
|
+
|
12
|
+
Before do
|
13
|
+
Compass.reset_configuration!
|
14
|
+
@cleanup_directories = []
|
15
|
+
@original_working_directory = Dir.pwd
|
16
|
+
end
|
17
|
+
|
18
|
+
After do
|
19
|
+
Dir.chdir @original_working_directory
|
20
|
+
@cleanup_directories.each do |dir|
|
21
|
+
FileUtils.rm_rf dir
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# Given Preconditions
|
26
|
+
Given %r{^I am using the existing project in ([^\s]+)$} do |project|
|
27
|
+
tmp_project = "tmp_#{File.basename(project)}"
|
28
|
+
@cleanup_directories << tmp_project
|
29
|
+
FileUtils.cp_r project, tmp_project
|
30
|
+
Dir.chdir tmp_project
|
31
|
+
end
|
32
|
+
|
33
|
+
Given %r{^I am in the parent directory$} do
|
34
|
+
Dir.chdir ".."
|
35
|
+
end
|
36
|
+
|
37
|
+
Given /^I'm in a newly created rails project: (.+)$/ do |project_name|
|
38
|
+
@cleanup_directories << project_name
|
39
|
+
begin
|
40
|
+
generate_rails_app project_name
|
41
|
+
Dir.chdir project_name
|
42
|
+
rescue LoadError
|
43
|
+
pending "Missing Ruby-on-rails gems: sudo gem install rails"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# When Actions are performed
|
48
|
+
When /^I create a project using: compass create ([^\s]+) ?(.+)?$/ do |dir, args|
|
49
|
+
@cleanup_directories << dir
|
50
|
+
compass 'create', dir, *(args || '').split
|
51
|
+
end
|
52
|
+
|
53
|
+
When /^I initialize a project using: compass init ?(.+)?$/ do |args|
|
54
|
+
compass 'init', *(args || '').split
|
55
|
+
end
|
56
|
+
|
57
|
+
When /^I run: compass ([^\s]+) ?(.+)?$/ do |command, args|
|
58
|
+
compass command, *(args || '').split
|
59
|
+
end
|
60
|
+
|
61
|
+
When /^I run in a separate process: compass ([^\s]+) ?(.+)?$/ do |command, args|
|
62
|
+
unless @other_process = fork
|
63
|
+
@last_result = ''
|
64
|
+
@last_error = ''
|
65
|
+
Signal.trap("HUP") do
|
66
|
+
open('/tmp/last_result.compass_test.txt', 'w') do |file|
|
67
|
+
file.puts $stdout.string
|
68
|
+
end
|
69
|
+
open('/tmp/last_error.compass_test.txt', 'w') do |file|
|
70
|
+
file.puts @stderr.string
|
71
|
+
end
|
72
|
+
exit!
|
73
|
+
end
|
74
|
+
# this command will run forever
|
75
|
+
# we kill it with a HUP signal from the parent process.
|
76
|
+
args = (args || '').split
|
77
|
+
args << { :wait => 5 }
|
78
|
+
compass command, *args
|
79
|
+
exit!
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
When /^I shutdown the other process$/ do
|
84
|
+
Process.kill("HUP", @other_process)
|
85
|
+
Process.wait
|
86
|
+
@last_result = File.read('/tmp/last_result.compass_test.txt')
|
87
|
+
@last_error = File.read('/tmp/last_error.compass_test.txt')
|
88
|
+
end
|
89
|
+
|
90
|
+
When /^I touch ([^\s]+)$/ do |filename|
|
91
|
+
FileUtils.touch filename
|
92
|
+
end
|
93
|
+
|
94
|
+
When /^I wait ([\d.]+) seconds?$/ do |count|
|
95
|
+
sleep count.to_f
|
96
|
+
end
|
97
|
+
|
98
|
+
When /^I add some sass to ([^\s]+)$/ do |filename|
|
99
|
+
open(filename, "w+") do |file|
|
100
|
+
file.puts ".added .some .arbitrary"
|
101
|
+
file.puts " sass: code"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
# Then postconditions
|
106
|
+
Then /^a directory ([^ ]+) is (not )?created$/ do |directory, negated|
|
107
|
+
File.directory?(directory).should == !negated
|
108
|
+
end
|
109
|
+
|
110
|
+
Then /an? \w+ file ([^ ]+) is (not )?created/ do |filename, negated|
|
111
|
+
File.exists?(filename).should == !negated
|
112
|
+
end
|
113
|
+
|
114
|
+
Then /an? \w+ file ([^ ]+) is reported created/ do |filename|
|
115
|
+
@last_result.should =~ /create #{Regexp.escape(filename)}/
|
116
|
+
end
|
117
|
+
|
118
|
+
Then /a \w+ file ([^ ]+) is (?:reported )?compiled/ do |filename|
|
119
|
+
@last_result.should =~ /compile #{Regexp.escape(filename)}/
|
120
|
+
end
|
121
|
+
|
122
|
+
Then /a \w+ file ([^ ]+) is reported unchanged/ do |filename|
|
123
|
+
@last_result.should =~ /unchanged #{Regexp.escape(filename)}/
|
124
|
+
end
|
125
|
+
|
126
|
+
Then /a \w+ file ([^ ]+) is reported identical/ do |filename|
|
127
|
+
@last_result.should =~ /identical #{Regexp.escape(filename)}/
|
128
|
+
end
|
129
|
+
|
130
|
+
Then /a \w+ file ([^ ]+) is reported overwritten/ do |filename|
|
131
|
+
@last_result.should =~ /overwrite #{Regexp.escape(filename)}/
|
132
|
+
end
|
133
|
+
|
134
|
+
Then /I am told how to link to ([^ ]+) for media "([^"]+)"/ do |stylesheet, media|
|
135
|
+
@last_result.should =~ %r{<link href="#{stylesheet}" media="#{media}" rel="stylesheet" type="text/css" />}
|
136
|
+
end
|
137
|
+
|
138
|
+
Then /I am told how to conditionally link "([^"]+)" to ([^ ]+) for media "([^"]+)"/ do |condition, stylesheet, media|
|
139
|
+
@last_result.should =~ %r{<!--\[if #{condition}\]>\s+<link href="#{stylesheet}" media="#{media}" rel="stylesheet" type="text/css" />\s+<!\[endif\]-->}mi
|
140
|
+
end
|
141
|
+
|
142
|
+
Then /^an error message is printed out: (.+)$/ do |error_message|
|
143
|
+
@last_error.should =~ Regexp.new(Regexp.escape(error_message))
|
144
|
+
end
|
145
|
+
|
146
|
+
Then /^the command exits with a non\-zero error code$/ do
|
147
|
+
@last_exit_code.should_not == 0
|
148
|
+
end
|
149
|
+
|
150
|
+
|
151
|
+
Then /^I am congratulated$/ do
|
152
|
+
@last_result.should =~ /Congratulations!/
|
153
|
+
end
|
154
|
+
|
155
|
+
Then /^I am told that I can place stylesheets in the ([^\s]+) subdirectory$/ do |subdir|
|
156
|
+
@last_result.should =~ /You may now add sass stylesheets to the #{subdir} subdirectory of your project./
|
157
|
+
end
|
158
|
+
|
159
|
+
Then /^I am told how to compile my sass stylesheets$/ do
|
160
|
+
@last_result.should =~ /You must compile your sass stylesheets into CSS when they change.\nThis can be done in one of the following ways:/
|
161
|
+
end
|
162
|
+
|
163
|
+
Then /^I should be shown a list of available commands$/ do
|
164
|
+
@last_result.should =~ /^Available commands:$/
|
165
|
+
end
|
166
|
+
|
167
|
+
Then /^the list of commands should describe the ([^ ]+) command$/ do |command|
|
168
|
+
@last_result.should =~ /^\s+\* #{command}\s+- [A-Z].+$/
|
169
|
+
end
|
170
|
+
|
171
|
+
Then /^the following configuration properties are set in ([^ ]+):$/ do |config_file, table|
|
172
|
+
|
173
|
+
config = Compass::Configuration::Data.new_from_file(config_file)
|
174
|
+
table.hashes.each do |hash|
|
175
|
+
config.send(hash['property']).should == hash['value']
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
Then /^my css is validated$/ do
|
180
|
+
if @last_error =~ /The Compass CSS Validator could not be loaded/
|
181
|
+
pending "Missing Dependency: sudo gem install chriseppstein-compass-validator"
|
182
|
+
else
|
183
|
+
@last_result.should =~ /Compass CSS Validator/
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
Then /^I am informed that my css is valid.$/ do
|
188
|
+
@last_result.should =~ /Your CSS files are valid\./
|
189
|
+
end
|
190
|
+
|
191
|
+
Then /^I am told statistics for each file:$/ do |table|
|
192
|
+
# table is a Cucumber::Ast::Table
|
193
|
+
table.raw.each do |row|
|
194
|
+
re = Regexp.new row.join(' *\| *')
|
195
|
+
@last_result.should =~ re
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
|