merbjedi-compass 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest +178 -0
- data/README.markdown +17 -0
- data/Rakefile +125 -0
- data/VERSION +1 -0
- data/bin/compass +8 -0
- data/compass.gemspec +37 -0
- data/examples/blueprint_default/index.html +73 -0
- data/examples/blueprint_default/parts/elements.html +246 -0
- data/examples/blueprint_default/parts/forms.html +100 -0
- data/examples/blueprint_default/parts/grid.html +206 -0
- data/examples/blueprint_default/parts/test-small.jpg +0 -0
- data/examples/blueprint_default/parts/test.jpg +0 -0
- data/examples/blueprint_default/parts/valid.png +0 -0
- data/examples/blueprint_default/stylesheets/ie.sass +3 -0
- data/examples/blueprint_default/stylesheets/images/grid.png +0 -0
- data/examples/blueprint_default/stylesheets/print.sass +3 -0
- data/examples/blueprint_default/stylesheets/screen.sass +8 -0
- data/examples/blueprint_plugins/index.html +60 -0
- data/examples/blueprint_plugins/parts/fancy_type.html +84 -0
- data/examples/blueprint_plugins/parts/test-small.jpg +0 -0
- data/examples/blueprint_plugins/parts/test.jpg +0 -0
- data/examples/blueprint_plugins/parts/valid.png +0 -0
- data/examples/blueprint_plugins/stylesheets/ie.sass +3 -0
- data/examples/blueprint_plugins/stylesheets/images/grid.png +0 -0
- data/examples/blueprint_plugins/stylesheets/print.sass +3 -0
- data/examples/blueprint_plugins/stylesheets/screen.sass +11 -0
- data/examples/blueprint_scoped/stylesheets/ie.sass +3 -0
- data/examples/blueprint_scoped/stylesheets/print.sass +3 -0
- data/examples/blueprint_scoped/stylesheets/screen.sass +4 -0
- data/examples/blueprint_scoped_form/stylesheets/ie.sass +3 -0
- data/examples/blueprint_scoped_form/stylesheets/print.sass +3 -0
- data/examples/blueprint_scoped_form/stylesheets/screen.sass +10 -0
- data/examples/blueprint_semantic/index.html +68 -0
- data/examples/blueprint_semantic/parts/fancy_type.html +84 -0
- data/examples/blueprint_semantic/parts/liquid.html +84 -0
- data/examples/blueprint_semantic/parts/test-small.jpg +0 -0
- data/examples/blueprint_semantic/parts/test.jpg +0 -0
- data/examples/blueprint_semantic/parts/valid.png +0 -0
- data/examples/blueprint_semantic/stylesheets/ie.sass +3 -0
- data/examples/blueprint_semantic/stylesheets/images/grid.png +0 -0
- data/examples/blueprint_semantic/stylesheets/liquid.sass +70 -0
- data/examples/blueprint_semantic/stylesheets/print.sass +3 -0
- data/examples/blueprint_semantic/stylesheets/screen.sass +69 -0
- data/examples/compass/compass.html +19 -0
- data/examples/compass/sticky_footer.html.haml +14 -0
- data/examples/compass/stylesheets/compass.sass +47 -0
- data/examples/compass/stylesheets/images/blue_arrow.gif +0 -0
- data/examples/compass/stylesheets/sticky_footer.sass +11 -0
- data/examples/compass/stylesheets/utilities.sass +69 -0
- data/examples/compass/utilities.html.haml +141 -0
- data/examples/yui/divisions.html.haml +179 -0
- data/examples/yui/index.html.haml +19 -0
- data/examples/yui/stylesheets/screen.sass +13 -0
- data/examples/yui/sub_divisions.html.haml +169 -0
- data/examples/yui/templates.html.haml +54 -0
- data/examples/yui/test.jpg +0 -0
- data/examples/yui/typography.html.haml +132 -0
- data/frameworks/blueprint.rb +2 -0
- data/frameworks/blueprint/lib/blueprint/constants.rb +17 -0
- data/frameworks/blueprint/lib/blueprint/grid_builder.rb +54 -0
- data/frameworks/blueprint/stylesheets/_blueprint.sass +3 -0
- data/frameworks/blueprint/stylesheets/blueprint/_ie.sass +49 -0
- data/frameworks/blueprint/stylesheets/blueprint/_print.sass +82 -0
- data/frameworks/blueprint/stylesheets/blueprint/_screen.sass +15 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass +30 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass +9 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass +81 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass +43 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass +141 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass +58 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass +137 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass +46 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass +154 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass +37 -0
- data/frameworks/blueprint/templates/project/grid.png +0 -0
- data/frameworks/blueprint/templates/project/ie.sass +3 -0
- data/frameworks/blueprint/templates/project/manifest.rb +5 -0
- data/frameworks/blueprint/templates/project/print.sass +3 -0
- data/frameworks/blueprint/templates/project/screen.sass +8 -0
- data/frameworks/compass.rb +2 -0
- data/frameworks/compass/stylesheets/_compass.sass +1 -0
- data/frameworks/compass/stylesheets/compass/_layout.sass +1 -0
- data/frameworks/compass/stylesheets/compass/_reset.sass +3 -0
- data/frameworks/compass/stylesheets/compass/_utilities.sass +5 -0
- data/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass +17 -0
- data/frameworks/compass/stylesheets/compass/utilities/_general.sass +4 -0
- data/frameworks/compass/stylesheets/compass/utilities/_links.sass +3 -0
- data/frameworks/compass/stylesheets/compass/utilities/_lists.sass +3 -0
- data/frameworks/compass/stylesheets/compass/utilities/_print.sass +24 -0
- data/frameworks/compass/stylesheets/compass/utilities/_tables.sass +3 -0
- data/frameworks/compass/stylesheets/compass/utilities/_text.sass +2 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.sass +11 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_inline_block.sass +6 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass +56 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_tabs.sass +0 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass +19 -0
- data/frameworks/compass/stylesheets/compass/utilities/links/_hover_link.sass +5 -0
- data/frameworks/compass/stylesheets/compass/utilities/links/_link_colors.sass +24 -0
- data/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass +5 -0
- data/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.sass +21 -0
- data/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass +20 -0
- data/frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass +29 -0
- data/frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass +20 -0
- data/frameworks/compass/stylesheets/compass/utilities/tables/_borders.sass +27 -0
- data/frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.sass +9 -0
- data/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass +3 -0
- data/frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass +10 -0
- data/frameworks/compass/templates/project/ie.sass +6 -0
- data/frameworks/compass/templates/project/manifest.rb +3 -0
- data/frameworks/compass/templates/project/print.sass +6 -0
- data/frameworks/compass/templates/project/screen.sass +7 -0
- data/frameworks/yui.rb +2 -0
- data/frameworks/yui/COPYRIGHT +15 -0
- data/frameworks/yui/stylesheets/_yui.sass +7 -0
- data/frameworks/yui/stylesheets/yui/modules/_base.sass +60 -0
- data/frameworks/yui/stylesheets/yui/modules/_fonts.sass +38 -0
- data/frameworks/yui/stylesheets/yui/modules/_grids.sass +341 -0
- data/frameworks/yui/templates/project/manifest.rb +1 -0
- data/frameworks/yui/templates/project/screen.sass +4 -0
- data/lib/compass.rb +39 -0
- data/lib/compass/actions.rb +92 -0
- data/lib/compass/commands/base.rb +29 -0
- data/lib/compass/commands/create_project.rb +41 -0
- data/lib/compass/commands/list_frameworks.rb +16 -0
- data/lib/compass/commands/print_version.rb +23 -0
- data/lib/compass/commands/project_base.rb +82 -0
- data/lib/compass/commands/update_project.rb +25 -0
- data/lib/compass/commands/watch_project.rb +53 -0
- data/lib/compass/commands/write_configuration.rb +37 -0
- data/lib/compass/compiler.rb +40 -0
- data/lib/compass/configuration.rb +167 -0
- data/lib/compass/core_ext.rb +12 -0
- data/lib/compass/errors.rb +7 -0
- data/lib/compass/exec.rb +184 -0
- data/lib/compass/frameworks.rb +29 -0
- data/lib/compass/installers.rb +5 -0
- data/lib/compass/installers/base.rb +135 -0
- data/lib/compass/installers/manifest.rb +57 -0
- data/lib/compass/installers/rails.rb +118 -0
- data/lib/compass/installers/stand_alone.rb +76 -0
- data/lib/compass/logger.rb +34 -0
- data/lib/compass/merb.rb +45 -0
- data/lib/compass/test_case.rb +37 -0
- data/lib/compass/validate.rb +13 -0
- data/lib/compass/validate/COPYRIGHT.html +93 -0
- data/lib/compass/validate/JIGSAW_COPYRIGHT +64 -0
- data/lib/compass/validate/README.html +83 -0
- data/lib/compass/validate/XERCES_COPYING.txt +56 -0
- data/lib/compass/validate/css-validator-javadoc.jar +0 -0
- data/lib/compass/validate/css-validator.jar +0 -0
- data/lib/compass/validate/jigsaw.jar +0 -0
- data/lib/compass/validate/xerces.jar +0 -0
- data/lib/compass/validator.rb +59 -0
- data/lib/compass/version.rb +66 -0
- data/lib/sass_extensions.rb +13 -0
- data/test/command_line_test.rb +147 -0
- data/test/compass_test.rb +148 -0
- data/test/configuration_test.rb +29 -0
- data/test/fixtures/stylesheets/blueprint/css/typography.css +159 -0
- data/test/fixtures/stylesheets/blueprint/sass/ie.sass +3 -0
- data/test/fixtures/stylesheets/blueprint/sass/print.sass +3 -0
- data/test/fixtures/stylesheets/blueprint/sass/screen.sass +17 -0
- data/test/fixtures/stylesheets/blueprint/sass/typography.sass +3 -0
- data/test/fixtures/stylesheets/compass/css/layout.css +14 -0
- data/test/fixtures/stylesheets/compass/css/print.css +19 -0
- data/test/fixtures/stylesheets/compass/css/reset.css +66 -0
- data/test/fixtures/stylesheets/compass/css/utilities.css +23 -0
- data/test/fixtures/stylesheets/compass/sass/layout.sass +3 -0
- data/test/fixtures/stylesheets/compass/sass/print.sass +5 -0
- data/test/fixtures/stylesheets/compass/sass/reset.sass +1 -0
- data/test/fixtures/stylesheets/compass/sass/utilities.sass +5 -0
- data/test/fixtures/stylesheets/yui/css/mixins.css +16 -0
- data/test/fixtures/stylesheets/yui/sass/base.sass +3 -0
- data/test/fixtures/stylesheets/yui/sass/fonts.sass +3 -0
- data/test/fixtures/stylesheets/yui/sass/grids.sass +3 -0
- data/test/fixtures/stylesheets/yui/sass/mixins.sass +16 -0
- data/test/sass_extensions_test.rb +26 -0
- data/test/test_helper.rb +47 -0
- metadata +295 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'sass'
|
2
|
+
|
3
|
+
module Sass::Script::Functions
|
4
|
+
COMMA_SEPARATOR = /\s*,\s*/
|
5
|
+
def nest(*arguments)
|
6
|
+
nested = arguments.map{|a| a.value}.inject do |memo,arg|
|
7
|
+
ancestors = memo.split(COMMA_SEPARATOR)
|
8
|
+
descendants = arg.split(COMMA_SEPARATOR)
|
9
|
+
ancestors.map{|a| descendants.map{|d| "#{a} #{d}"}.join(", ")}.join(", ")
|
10
|
+
end
|
11
|
+
Sass::Script::String.new(nested)
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,147 @@
|
|
1
|
+
require File.dirname(__FILE__)+'/test_helper'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'compass'
|
4
|
+
require 'compass/exec'
|
5
|
+
require 'timeout'
|
6
|
+
|
7
|
+
class CommandLineTest < Test::Unit::TestCase
|
8
|
+
include Compass::TestCaseHelper
|
9
|
+
|
10
|
+
def teardown
|
11
|
+
Compass.configuration.reset!
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_basic_install
|
15
|
+
within_tmp_directory do
|
16
|
+
compass "basic"
|
17
|
+
assert File.exists?("basic/src/screen.sass")
|
18
|
+
assert File.exists?("basic/stylesheets/screen.css")
|
19
|
+
assert_action_performed :directory, "basic/"
|
20
|
+
assert_action_performed :create, "basic/src/screen.sass"
|
21
|
+
assert_action_performed :compile, "basic/src/screen.sass"
|
22
|
+
assert_action_performed :create, "basic/stylesheets/screen.css"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_framework_installs
|
27
|
+
Compass::Frameworks::ALL.each do |framework|
|
28
|
+
within_tmp_directory do
|
29
|
+
compass *%W(--framework #{framework.name} #{framework.name}_project)
|
30
|
+
assert File.exists?("#{framework.name}_project/src/screen.sass")
|
31
|
+
assert File.exists?("#{framework.name}_project/stylesheets/screen.css")
|
32
|
+
assert_action_performed :directory, "#{framework.name}_project/"
|
33
|
+
assert_action_performed :create, "#{framework.name}_project/src/screen.sass"
|
34
|
+
assert_action_performed :compile, "#{framework.name}_project/src/screen.sass"
|
35
|
+
assert_action_performed :create, "#{framework.name}_project/stylesheets/screen.css"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_basic_update
|
41
|
+
within_tmp_directory do
|
42
|
+
compass "basic"
|
43
|
+
Dir.chdir "basic" do
|
44
|
+
compass
|
45
|
+
assert_action_performed :compile, "src/screen.sass"
|
46
|
+
assert_action_performed :identical, "stylesheets/screen.css"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_rails_install
|
52
|
+
within_tmp_directory do
|
53
|
+
generate_rails_app("compass_rails")
|
54
|
+
Dir.chdir "compass_rails" do
|
55
|
+
compass("--rails", ".") do |responder|
|
56
|
+
responder.respond_to "Is this OK? (Y/n) ", :with => "Y"
|
57
|
+
responder.respond_to "Emit compiled stylesheets to public/stylesheets/compiled/? (Y/n) ", :with => "Y"
|
58
|
+
end
|
59
|
+
# puts @last_result
|
60
|
+
assert_action_performed :create, "./app/stylesheets/screen.sass"
|
61
|
+
assert_action_performed :create, "./config/initializers/compass.rb"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
rescue LoadError
|
65
|
+
puts "Skipping rails test. Couldn't Load rails"
|
66
|
+
end
|
67
|
+
|
68
|
+
protected
|
69
|
+
def compass(*arguments)
|
70
|
+
if block_given?
|
71
|
+
responder = Responder.new
|
72
|
+
yield responder
|
73
|
+
IO.popen("-", "w+") do |io|
|
74
|
+
if io
|
75
|
+
#parent process
|
76
|
+
output = ""
|
77
|
+
while !io.eof?
|
78
|
+
timeout(1) do
|
79
|
+
output << io.readpartial(512)
|
80
|
+
end
|
81
|
+
prompt = output.split("\n").last
|
82
|
+
if response = responder.response_for(prompt)
|
83
|
+
io.puts response
|
84
|
+
end
|
85
|
+
end
|
86
|
+
@last_result = output
|
87
|
+
else
|
88
|
+
#child process
|
89
|
+
execute *arguments
|
90
|
+
end
|
91
|
+
end
|
92
|
+
else
|
93
|
+
@last_result = capture_output do
|
94
|
+
execute *arguments
|
95
|
+
end
|
96
|
+
end
|
97
|
+
rescue Timeout::Error
|
98
|
+
fail "Read from child process timed out"
|
99
|
+
end
|
100
|
+
|
101
|
+
class Responder
|
102
|
+
def initialize
|
103
|
+
@responses = []
|
104
|
+
end
|
105
|
+
def respond_to(prompt, options = {})
|
106
|
+
@responses << [prompt, options[:with]]
|
107
|
+
end
|
108
|
+
def response_for(prompt)
|
109
|
+
pair = @responses.detect{|r| r.first == prompt}
|
110
|
+
pair.last if pair
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def assert_action_performed(action, path)
|
115
|
+
@last_result.split("\n").each do |line|
|
116
|
+
line = line.split
|
117
|
+
return if line.first == action.to_s && line.last == path
|
118
|
+
end
|
119
|
+
fail "Action #{action.inspect} was not performed on: #{path}"
|
120
|
+
end
|
121
|
+
|
122
|
+
def within_tmp_directory(dir = "tmp")
|
123
|
+
d = absolutize(dir)
|
124
|
+
FileUtils.mkdir_p(d)
|
125
|
+
Dir.chdir(d) do
|
126
|
+
yield
|
127
|
+
end
|
128
|
+
ensure
|
129
|
+
FileUtils.rm_r(d)
|
130
|
+
end
|
131
|
+
|
132
|
+
def capture_output
|
133
|
+
real_stdout, $stdout = $stdout, StringIO.new
|
134
|
+
yield
|
135
|
+
$stdout.string
|
136
|
+
ensure
|
137
|
+
$stdout = real_stdout
|
138
|
+
end
|
139
|
+
|
140
|
+
def execute(*arguments)
|
141
|
+
Compass::Exec::Compass.new(arguments).run!
|
142
|
+
end
|
143
|
+
|
144
|
+
def generate_rails_app(name)
|
145
|
+
`rails #{name}`
|
146
|
+
end
|
147
|
+
end
|
@@ -0,0 +1,148 @@
|
|
1
|
+
require File.dirname(__FILE__)+'/test_helper'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'compass'
|
4
|
+
|
5
|
+
class CompassTest < Test::Unit::TestCase
|
6
|
+
include Compass::TestCaseHelper
|
7
|
+
def setup
|
8
|
+
setup_fixtures :blueprint, :yui, :empty
|
9
|
+
@original_options = Sass::Plugin.options
|
10
|
+
end
|
11
|
+
|
12
|
+
def setup_fixtures(*folders)
|
13
|
+
folders.each do |folder|
|
14
|
+
FileUtils.mkdir_p stylesheet_fixtures(folder)
|
15
|
+
mkdir_clean tempfile_loc(folder)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def teardown
|
20
|
+
teardown_fixtures :blueprint, :yui, :empty
|
21
|
+
Sass::Plugin.options = @original_options
|
22
|
+
end
|
23
|
+
|
24
|
+
def teardown_fixtures(*folders)
|
25
|
+
folders.each do |folder|
|
26
|
+
FileUtils.rm_rf tempfile_loc(folder)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_blueprint_generates_no_files
|
31
|
+
with_templates(:empty) do
|
32
|
+
Dir.new(tempfile_loc(:empty)).each do |f|
|
33
|
+
fail "This file should not have been generated: #{f}" unless f == "." || f == ".."
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_blueprint
|
39
|
+
with_templates(:blueprint) do
|
40
|
+
each_css_file(tempfile_loc(:blueprint)) do |css_file|
|
41
|
+
assert_no_errors css_file, :blueprint
|
42
|
+
end
|
43
|
+
assert_renders_correctly :typography
|
44
|
+
end
|
45
|
+
end
|
46
|
+
def test_yui
|
47
|
+
with_templates('yui') do
|
48
|
+
each_css_file(tempfile_loc('yui')) do |css_file|
|
49
|
+
assert_no_errors css_file, 'yui'
|
50
|
+
end
|
51
|
+
assert_renders_correctly :mixins
|
52
|
+
end
|
53
|
+
end
|
54
|
+
def test_compass
|
55
|
+
with_templates('compass') do
|
56
|
+
each_css_file(tempfile_loc('compass')) do |css_file|
|
57
|
+
assert_no_errors css_file, 'compass'
|
58
|
+
end
|
59
|
+
assert_renders_correctly :reset, :layout, :utilities
|
60
|
+
end
|
61
|
+
end
|
62
|
+
private
|
63
|
+
def assert_no_errors(css_file, folder)
|
64
|
+
file = css_file[(tempfile_loc(folder).size+1)..-1]
|
65
|
+
msg = "Syntax Error found in #{file}. Results saved into #{save_loc(folder)}/#{file}"
|
66
|
+
assert_equal 0, open(css_file).readlines.grep(/Sass::SyntaxError/).size, msg
|
67
|
+
end
|
68
|
+
def assert_renders_correctly(*arguments)
|
69
|
+
options = arguments.last.is_a?(Hash) ? arguments.pop : {}
|
70
|
+
for name in arguments
|
71
|
+
actual_result_file = "#{tempfile_loc(@current_template_folder)}/#{name}.css"
|
72
|
+
expected_result_file = "#{result_loc(@current_template_folder)}/#{name}.css"
|
73
|
+
actual_lines = File.read(actual_result_file).split("\n")
|
74
|
+
expected_lines = File.read(expected_result_file).split("\n")
|
75
|
+
expected_lines.zip(actual_lines).each_with_index do |pair, line|
|
76
|
+
message = "template: #{name}\nline: #{line + 1}"
|
77
|
+
assert_equal(pair.first, pair.last, message)
|
78
|
+
end
|
79
|
+
if expected_lines.size < actual_lines.size
|
80
|
+
assert(false, "#{actual_lines.size - expected_lines.size} Trailing lines found in #{actual_result_file}.css: #{actual_lines[expected_lines.size..-1].join('\n')}")
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
def with_templates(folder)
|
85
|
+
old_template_loc = Sass::Plugin.options[:template_location]
|
86
|
+
Sass::Plugin.options[:template_location] = if old_template_loc.is_a?(Hash)
|
87
|
+
old_template_loc.dup
|
88
|
+
else
|
89
|
+
Hash.new
|
90
|
+
end
|
91
|
+
@current_template_folder = folder
|
92
|
+
begin
|
93
|
+
Sass::Plugin.options[:template_location][template_loc(folder)] = tempfile_loc(folder)
|
94
|
+
Compass::Frameworks::ALL.each do |framework|
|
95
|
+
Sass::Plugin.options[:template_location][framework.stylesheets_directory] = tempfile_loc(folder)
|
96
|
+
end
|
97
|
+
Sass::Plugin.update_stylesheets
|
98
|
+
yield
|
99
|
+
ensure
|
100
|
+
@current_template_folder = nil
|
101
|
+
Sass::Plugin.options[:template_location] = old_template_loc
|
102
|
+
end
|
103
|
+
rescue
|
104
|
+
save_output(folder)
|
105
|
+
raise
|
106
|
+
end
|
107
|
+
|
108
|
+
def each_css_file(dir)
|
109
|
+
Dir.glob("#{dir}/**/*.css").each do |css_file|
|
110
|
+
yield css_file
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def save_output(dir)
|
115
|
+
FileUtils.rm_rf(save_loc(dir))
|
116
|
+
FileUtils.cp_r(tempfile_loc(dir), save_loc(dir))
|
117
|
+
end
|
118
|
+
|
119
|
+
def mkdir_clean(dir)
|
120
|
+
begin
|
121
|
+
FileUtils.mkdir dir
|
122
|
+
rescue Errno::EEXIST
|
123
|
+
FileUtils.rm_r dir
|
124
|
+
FileUtils.mkdir dir
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def stylesheet_fixtures(folder)
|
129
|
+
absolutize("fixtures/stylesheets/#{folder}")
|
130
|
+
end
|
131
|
+
|
132
|
+
def tempfile_loc(folder)
|
133
|
+
"#{stylesheet_fixtures(folder)}/tmp"
|
134
|
+
end
|
135
|
+
|
136
|
+
def template_loc(folder)
|
137
|
+
"#{stylesheet_fixtures(folder)}/sass"
|
138
|
+
end
|
139
|
+
|
140
|
+
def result_loc(folder)
|
141
|
+
"#{stylesheet_fixtures(folder)}/css"
|
142
|
+
end
|
143
|
+
|
144
|
+
def save_loc(folder)
|
145
|
+
"#{stylesheet_fixtures(folder)}/saved"
|
146
|
+
end
|
147
|
+
|
148
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require File.dirname(__FILE__)+'/test_helper'
|
2
|
+
require 'compass'
|
3
|
+
|
4
|
+
class ConfigurationTest < Test::Unit::TestCase
|
5
|
+
def test_parse_and_serialize
|
6
|
+
contents = <<-CONFIG
|
7
|
+
require 'compass'
|
8
|
+
require 'sass'
|
9
|
+
# Require any additional compass plugins here.
|
10
|
+
|
11
|
+
css_dir = "css"
|
12
|
+
sass_dir = "sass"
|
13
|
+
images_dir = "img"
|
14
|
+
javascripts_dir = "js"
|
15
|
+
CONFIG
|
16
|
+
|
17
|
+
Compass.configuration.parse_string(contents, "test_parse")
|
18
|
+
|
19
|
+
assert_equal 'sass', Compass.configuration.sass_dir
|
20
|
+
assert_equal 'css', Compass.configuration.css_dir
|
21
|
+
assert_equal 'img', Compass.configuration.images_dir
|
22
|
+
assert_equal 'js', Compass.configuration.javascripts_dir
|
23
|
+
|
24
|
+
expected_lines = contents.split("\n").map{|l|l.strip}
|
25
|
+
actual_lines = Compass.configuration.serialize.split("\n").map{|l|l.strip}
|
26
|
+
assert_equal expected_lines, actual_lines
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,159 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
body {
|
4
|
+
line-height: 1.5;
|
5
|
+
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
|
6
|
+
color: #333333;
|
7
|
+
font-size: 75%; }
|
8
|
+
|
9
|
+
h1 {
|
10
|
+
font-weight: normal;
|
11
|
+
color: #222222;
|
12
|
+
font-size: 3em;
|
13
|
+
line-height: 1;
|
14
|
+
margin-bottom: 0.5em; }
|
15
|
+
h1 img {
|
16
|
+
margin: 0; }
|
17
|
+
|
18
|
+
h2 {
|
19
|
+
font-weight: normal;
|
20
|
+
color: #222222;
|
21
|
+
font-size: 2em;
|
22
|
+
margin-bottom: 0.75em; }
|
23
|
+
|
24
|
+
h3 {
|
25
|
+
font-weight: normal;
|
26
|
+
color: #222222;
|
27
|
+
font-size: 1.5em;
|
28
|
+
line-height: 1;
|
29
|
+
margin-bottom: 1em; }
|
30
|
+
|
31
|
+
h4 {
|
32
|
+
font-weight: normal;
|
33
|
+
color: #222222;
|
34
|
+
font-size: 1.2em;
|
35
|
+
line-height: 1.25;
|
36
|
+
margin-bottom: 1.25em;
|
37
|
+
height: 1.25em; }
|
38
|
+
|
39
|
+
h5 {
|
40
|
+
font-weight: normal;
|
41
|
+
color: #222222;
|
42
|
+
font-size: 1em;
|
43
|
+
font-weight: bold;
|
44
|
+
margin-bottom: 1.5em; }
|
45
|
+
|
46
|
+
h6 {
|
47
|
+
font-weight: normal;
|
48
|
+
color: #222222;
|
49
|
+
font-size: 1em;
|
50
|
+
font-weight: bold; }
|
51
|
+
|
52
|
+
h2 img, h3 img, h4 img, h5 img, h6 img {
|
53
|
+
margin: 0; }
|
54
|
+
|
55
|
+
p {
|
56
|
+
margin: 0 0 1.5em; }
|
57
|
+
p img {
|
58
|
+
float: left;
|
59
|
+
margin: 1.5em 1.5em 1.5em 0;
|
60
|
+
padding: 0; }
|
61
|
+
p img.right {
|
62
|
+
float: right;
|
63
|
+
margin: 1.5em 0 1.5em 1.5em; }
|
64
|
+
|
65
|
+
a {
|
66
|
+
text-decoration: underline;
|
67
|
+
color: #000099; }
|
68
|
+
a:visited {
|
69
|
+
color: #000066; }
|
70
|
+
a:focus {
|
71
|
+
color: black; }
|
72
|
+
a:hover {
|
73
|
+
color: black; }
|
74
|
+
a:active {
|
75
|
+
color: #cc0099; }
|
76
|
+
|
77
|
+
blockquote {
|
78
|
+
margin: 1.5em;
|
79
|
+
color: #666;
|
80
|
+
font-style: italic; }
|
81
|
+
|
82
|
+
strong {
|
83
|
+
font-weight: bold; }
|
84
|
+
|
85
|
+
em {
|
86
|
+
font-style: italic; }
|
87
|
+
|
88
|
+
dfn {
|
89
|
+
font-style: italic;
|
90
|
+
font-weight: bold; }
|
91
|
+
|
92
|
+
sup, sub {
|
93
|
+
line-height: 0; }
|
94
|
+
|
95
|
+
abbr, acronym {
|
96
|
+
border-bottom: 1px dotted #666; }
|
97
|
+
|
98
|
+
address {
|
99
|
+
margin: 0 0 1.5em;
|
100
|
+
font-style: italic; }
|
101
|
+
|
102
|
+
del {
|
103
|
+
color: #666; }
|
104
|
+
|
105
|
+
pre, code {
|
106
|
+
margin: 1.5em 0;
|
107
|
+
white-space: pre;
|
108
|
+
font: 1em 'andale mono', 'lucida console', monospace;
|
109
|
+
line-height: 1.5; }
|
110
|
+
|
111
|
+
tt {
|
112
|
+
font: 1em 'andale mono', 'lucida console', monospace;
|
113
|
+
line-height: 1.5; }
|
114
|
+
|
115
|
+
li ul, li ol {
|
116
|
+
margin: 0 1.5em; }
|
117
|
+
|
118
|
+
ul {
|
119
|
+
margin: 0 1.5em 1.5em 1.5em;
|
120
|
+
list-style-type: disc; }
|
121
|
+
|
122
|
+
ol {
|
123
|
+
margin: 0 1.5em 1.5em 1.5em;
|
124
|
+
list-style-type: decimal; }
|
125
|
+
|
126
|
+
dl {
|
127
|
+
margin: 0 0 1.5em 0; }
|
128
|
+
dl dt {
|
129
|
+
font-weight: bold; }
|
130
|
+
|
131
|
+
dd {
|
132
|
+
margin-left: 1.5em; }
|
133
|
+
|
134
|
+
table {
|
135
|
+
margin-bottom: 1.4em;
|
136
|
+
width: 100%; }
|
137
|
+
|
138
|
+
th {
|
139
|
+
font-weight: bold;
|
140
|
+
background: #C3D9FF;
|
141
|
+
padding: 4px 10px 4px 5px; }
|
142
|
+
|
143
|
+
td {
|
144
|
+
padding: 4px 10px 4px 5px; }
|
145
|
+
|
146
|
+
tr.even td {
|
147
|
+
background: #E5ECF9; }
|
148
|
+
|
149
|
+
tfoot {
|
150
|
+
font-style: italic; }
|
151
|
+
|
152
|
+
caption {
|
153
|
+
background: #eee; }
|
154
|
+
|
155
|
+
.quiet {
|
156
|
+
color: #666666; }
|
157
|
+
|
158
|
+
.loud {
|
159
|
+
color: #111111; }
|