commit 88ed4591cce2d271c223a43e50ae3128acc35e87 Author: Chris Eppstein Date: Sat Aug 23 10:00:46 2008 -0700 Initial Checkin of Compass. Used to be Blueprint-Sass. diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..290627ca --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +*.DS_Store +tmp/* +built_examples/* +test/tmp +test/fixtures/*/saved +test/fixtures/*/tmp diff --git a/Rakefile b/Rakefile new file mode 100644 index 00000000..79106e91 --- /dev/null +++ b/Rakefile @@ -0,0 +1,80 @@ +require 'rubygems' +require 'rake' +require 'lib/compass' + +# ----- Default: Testing ------ + +task :default => :tests + +require 'rake/testtask' +require 'fileutils' + +Rake::TestTask.new :test do |t| + t.libs << 'lib' + test_files = FileList['test/**/*_test.rb'] + test_files.exclude('test/rails/*', 'test/haml/*') + t.test_files = test_files + t.verbose = true +end +Rake::Task[:test].send(:add_comment, < built_examples/#{example.sub(%r{.*/},'')}" + # compile any haml templates to html + FileList["#{example}/*.haml"].each do |haml_file| + basename = haml_file[9..-6] + engine = Haml::Engine.new(open(haml_file).read, :filename => haml_file) + target_dir = "built_examples/#{basename.sub(%r{/[^/]*$},'')}" + FileUtils.mkdir_p(target_dir) + output = open("built_examples/#{basename}",'w') + output.write(engine.render) + output.close + end + # compile any sass templates to css + FileList["#{example}/stylesheets/**/[^_]*.sass"].each do |sass_file| + basename = sass_file[9..-6] + css_filename = "built_examples/#{basename}.css" + compass_sass = File.dirname(__FILE__).sub(%r{.*/},'') + engine = Sass::Engine.new(open(sass_file).read, + :filename => sass_file, + :line_comments => true, + :css_filename => css_filename, + :load_paths => ["#{example}/stylesheets"] + Compass::Frameworks::ALL.map{|f| f.stylesheets_directory}) + target_dir = "built_examples/#{basename.sub(%r{/[^/]*$},'')}" + FileUtils.mkdir_p(target_dir) + output = open(css_filename,'w') + output.write(engine.render) + output.close + end + # copy any other non-haml and non-sass files directly over + target_dir = "built_examples/#{example.sub(%r{.*/},'')}" + other_files = FileList["#{example}/**/*"] + other_files.exclude "**/*.sass", "*.haml" + other_files.each do |file| + + if File.directory?(file) + FileUtils.mkdir_p(file) + elsif File.file?(file) + target_file = "#{target_dir}/#{file[(example.size+1)..-1]}" + # puts "mkdir -p #{File.dirname(target_file)}" + FileUtils.mkdir_p(File.dirname(target_file)) + # puts "cp #{file} #{target_file}" + FileUtils.cp(file, target_file) + end + end + end +end \ No newline at end of file diff --git a/VERSION b/VERSION new file mode 100644 index 00000000..6e8bf73a --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.1.0 diff --git a/bin/compass b/bin/compass new file mode 100755 index 00000000..a98225e1 --- /dev/null +++ b/bin/compass @@ -0,0 +1,8 @@ +#!/usr/bin/env ruby +# The compass command line utility + +require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'compass')) +require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'compass', 'exec')) + +command = Compass::Exec::Compass.new(ARGV) +command.run! diff --git a/examples/blueprint_default/index.html b/examples/blueprint_default/index.html new file mode 100644 index 00000000..fb3694c8 --- /dev/null +++ b/examples/blueprint_default/index.html @@ -0,0 +1,73 @@ + + + + + + Blueprint test pages + + + + + + + + + +
+

Blueprint test pages

+
+ +

Welcome to the Blueprint test pages. The HTML files below tests most HTML elements, and especially classes provided + by Blueprint.

+ + + + + + + + + + + + + + + + + + + + + + +
Test pageMain files testedDescription
Grid + grid.sass + Tests classes provided by the grid module.
Typography + typography.sass + Tests HTML elements which gets set in the typography module.
Forms + form.sass + Tests classes and default look provided by the form module.
+ +

Note about the css files: + These test files utilize the css files that are generated from + Sass templates. + In other words, if you change any of the source files, + you'll have to re-build them with rake examples to see any changes.

+ +
+

For more information and help, try these resources:

+ +
+ +

+ Valid HTML 4.01 Strict

+ +
+ + \ No newline at end of file diff --git a/examples/blueprint_default/parts/elements.html b/examples/blueprint_default/parts/elements.html new file mode 100644 index 00000000..431cb696 --- /dev/null +++ b/examples/blueprint_default/parts/elements.html @@ -0,0 +1,246 @@ + + + + + + Blueprint HTML Elements Tests + + + + + + + + + +
+

Tests for common HTML elements

+
+ +
PARAGRAPHS & BOXES
+ +
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor sub text ut labore et sup text magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+
+ +
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

+
+ +
+ +
+

Aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+
+
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

+
+ +
+
+ +
LISTS
+ +
+
    +
  • Unordered list test
  • +
  • Another list element. Lorem ipsum dolor sit amet, consectetur adipisicing elit.
  • +
  • Yet another element in the list
  • +
  • Some long text. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Lorem ipsum dolor sit amet, consectetur adipisicing elit.
  • +
+
    +
  1. Ordered list test
  2. +
  3. Another list element
  4. +
  5. Yet another element in the list
  6. +
+
+ +
+
    +
  1. Ordered list
  2. +
  3. Here's a nested unordered list +
      +
    • Nested Unordered list
    • +
    • Nested ordered list +
        +
      1. The first
      2. +
      3. And the second
      4. +
      +
    • +
    +
  4. +
  5. Ordered List item
  6. +
  7. Nested Ordered list +
      +
    1. Some point
    2. +
    3. Nested Unordered list +
        +
      • The first
      • +
      • And the second
      • +
      +
    4. +
    +
  8. +
+
+ +
+
+
definition list dt
+
definition list dd
+
definition list dt
+
definition list dd
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit adipisicing elit adipisicing elit
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit adipisicing elit adipisicing elit
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit adipisicing elit adipisicing elit
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit adipisicing elit adipisicing elit
+
+
+
+ +
HEADINGS
+ +
+

H1: Lorem ipsum dolor sit amet

+

H2: Lorem ipsum dolor sit amet, consectetur elit

+

H3: Lorem ipsum dolor sit amet, consectetur adipisicing elit

+

H4: Lorem ipsum dolor sit amet, consectetur adipisicing elit adipis

+
H5: Lorem ipsum dolor sit amet, consectetur adipisicing elit adipisicing elit adipisicing elit
+
H6: Lorem ipsum dolor sit amet, consectetur adipisicing elit adipisicing elit adipisicing elit
+
+ +
+

Heading 1


+

Heading 2


+

Heading 3


+

Heading 4


+
Heading 5

+
Heading 6
+
+ +
+

Heading 1

+

Heading 2

+

Heading 3

+

Heading 4

+
Heading 5
+
Heading 6
+
+
+ +
MISC ELEMENTS
+ +
+

+ <strong>
+ <del> deleted
+ <dfn> dfn
+ <em> emphasis +

+

+ <a> anchor
+ <a> a + href +

+

+ <abbr> abbr - extended text when mouseover.
+ <acronym> acronym - extended text when mouseover. +

+
+ <address>
+ Donald Duck
+ Box 555
+ Disneyland +
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore dolore.

+
+ +
+ + + + + + + + + + + + + +
A standard test table with a caption, tr, td elements
Table Header OneTable Header Two
TD OneTD Two
TD colspan 2
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
A test table with a thead, tfoot, and tbody elements
Table Header OneTable Header Two
tfoot footer
TD OneTD Two
TD OneTD Two
TD OneTD Two
TD OneTD Two
+
+ +
+ +
<pre>
+pre  space1
+pre  space1
+pre    space2
+pre    space2
+pre	tab
+pre	tab
+ +<code> +Not indented + indent1 + indent1 + indent2 + indent3 + + <tt> + This tt text should be monospaced + and + wrap as if + one line of text + even though the code has newlines, spaces, and tabs. + It should be the same size as <p> text. + +
+
+ +

+ Valid HTML 4.01 Strict

+ +
+ + diff --git a/examples/blueprint_default/parts/forms.html b/examples/blueprint_default/parts/forms.html new file mode 100644 index 00000000..e14f944a --- /dev/null +++ b/examples/blueprint_default/parts/forms.html @@ -0,0 +1,100 @@ + + + + + + Blueprint Forms Tests + + + + + + + + +
+

Forms

+
+ +
+ +
+ +
+ Simple sample form + +


+

+ +


+

+ +


+

+ +

+

+ +
+
+ +
+
+ +
+ This is a <div> with the class .error. Link. +
+
+ This is a <div> with the class .notice. Link. +
+
+ This is a <div> with the class .success. Link. +
+ +
+ Select, checkboxes, lists + +


+

+ +


+

+ +


+ Radio one
+ Radio two
+ Radio three

+ +


+ Check one
+ Check two
+ Check three

+ +
+ +
+
+ +

+ Valid HTML 4.01 Strict

+ +
+ + \ No newline at end of file diff --git a/examples/blueprint_default/parts/grid.html b/examples/blueprint_default/parts/grid.html new file mode 100644 index 00000000..ca88f482 --- /dev/null +++ b/examples/blueprint_default/parts/grid.html @@ -0,0 +1,206 @@ + + + + + + Blueprint Grid Tests + + + + + + + + +
+

Blueprint Tests: grid.css

+ + +
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit.

+
+
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit.

+
+
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit.

+
+ + +
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit.

+
+
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit.

+
+
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit.

+
+ + +
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit.

+
+
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit.

+
+
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit.

+
+
+ +
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+
+
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+
+
+ +

1

+

2

+

3

+

4

+

5

+

3

+ +

1

+

2

+

3

+

4

+

5

+

3

+ +

1

+

2

+

3

+

4

+

5

+

6

+

7

+

8

+

9

+

10

+

11

+

12

+

13

+

14

+

15

+

16

+

17

+

18

+

19

+

20

+

21

+

22

+

23

+

24

+ + +

1

+

2

+

3

+

4

+

5

+

6

+ + +

24

+ + +

2

+

23

+
+ +
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+
+ + +
+
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod.

+
+ +
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

+
+ +
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

+
+
+ +
+
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod.

+
+ +
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

+
+ +
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

+
+
+ + +
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

+
+
+ +
+
TESTING .PUSH-1 TO .PUSH-5
+ +
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

+ +
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

+ +
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

+ +
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

+ +
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

+ +
+ +
+
TESTING .PULL-1 TO .PULL-5
+ +

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

+
+ +

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

+
+ +

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

+
+ +

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

+
+ +

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

+
+ +
+ + + + + +
+

+ Valid HTML 4.01 Strict

+
+ +
+ + diff --git a/examples/blueprint_default/parts/test-small.jpg b/examples/blueprint_default/parts/test-small.jpg new file mode 100644 index 00000000..aa599d99 Binary files /dev/null and b/examples/blueprint_default/parts/test-small.jpg differ diff --git a/examples/blueprint_default/parts/test.jpg b/examples/blueprint_default/parts/test.jpg new file mode 100644 index 00000000..0107be27 Binary files /dev/null and b/examples/blueprint_default/parts/test.jpg differ diff --git a/examples/blueprint_default/parts/valid.png b/examples/blueprint_default/parts/valid.png new file mode 100644 index 00000000..dd20e497 Binary files /dev/null and b/examples/blueprint_default/parts/valid.png differ diff --git a/examples/blueprint_default/stylesheets/ie.sass b/examples/blueprint_default/stylesheets/ie.sass new file mode 100644 index 00000000..9bb82459 --- /dev/null +++ b/examples/blueprint_default/stylesheets/ie.sass @@ -0,0 +1,4 @@ +@import blueprint/ie + +body + +blueprint-ie \ No newline at end of file diff --git a/examples/blueprint_default/stylesheets/images/grid.png b/examples/blueprint_default/stylesheets/images/grid.png new file mode 100644 index 00000000..129d4a29 Binary files /dev/null and b/examples/blueprint_default/stylesheets/images/grid.png differ diff --git a/examples/blueprint_default/stylesheets/print.sass b/examples/blueprint_default/stylesheets/print.sass new file mode 100644 index 00000000..f825831b --- /dev/null +++ b/examples/blueprint_default/stylesheets/print.sass @@ -0,0 +1,4 @@ +@import blueprint/print + +body + +blueprint-print \ No newline at end of file diff --git a/examples/blueprint_default/stylesheets/screen.sass b/examples/blueprint_default/stylesheets/screen.sass new file mode 100644 index 00000000..57d3cf55 --- /dev/null +++ b/examples/blueprint_default/stylesheets/screen.sass @@ -0,0 +1,12 @@ +@import blueprint/screen +@import modules/scaffolding +@import compass/reset + +html + +reset-html + +body + +blueprint + // Remove the scaffolding when you're ready to start doing visual design. + // Or leave it in if you're happy with how blueprint looks out-of-the-box + +blueprint-scaffolding diff --git a/examples/blueprint_plugins/index.html b/examples/blueprint_plugins/index.html new file mode 100644 index 00000000..e1a19e22 --- /dev/null +++ b/examples/blueprint_plugins/index.html @@ -0,0 +1,60 @@ + + + + + + Blueprint test pages + + + + + + + + +
+

Blueprint test pages

+
+ +

Welcome to the Blueprint Plugin test pages. The HTML files below tests most HTML elements, and especially classes provided + by Blueprint.

+ + + + + + + + + + + + +
Test pageMain files testedDescription
Fancy Type + grid.sass, + typography.sass, + fancy_type.sass + A simple sample page, with common elements and fancy type.
+ +

Note about the css files: + These test files utilize the css files that are generated from + Sass templates. + In other words, if you change any of the source files, + you'll have to re-build them with rake examples to see any changes.

+ +
+

For more information and help, try these resources:

+ +
+ +

+ Valid HTML 4.01 Strict

+ +
+ + \ No newline at end of file diff --git a/examples/blueprint_plugins/parts/fancy_type.html b/examples/blueprint_plugins/parts/fancy_type.html new file mode 100644 index 00000000..8b3083a1 --- /dev/null +++ b/examples/blueprint_plugins/parts/fancy_type.html @@ -0,0 +1,84 @@ + + + + + + Blueprint Sample Page + + + + + + + + + +
+

A simple sample page

+
+

This sample page demonstrates a tiny fraction of what you get with Blueprint.

+
+ +
+
Here's a box
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip.

+
+ +
+
And another box
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat laboris nisi ut aliquip.

+
+ +
+
This box is aligned with the sidebar
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip.

+
+
+
+ +
+

testLorem ipsum dolor sit amet, consectetuer adipiscing elit. Nunc congue ipsum vestibulum libero. Aenean vitae justo. Nam eget tellus. Etiam convallis, est eu lobortis mattis, lectus tellus tempus felis, a ultricies erat ipsum at metus.

+

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi et risus. Aliquam nisl. Nulla facilisi. Cras accumsan vestibulum ante. Vestibulum sed tortor. Praesent SMALL CAPS tempus fringilla elit. Ut elit diam, sagittis in, nonummy in, gravida non, nunc. Ut orci. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Nam egestas, orci eu imperdiet malesuada, nisl purus fringilla odio, quis commodo est orci vitae justo. Aliquam placerat odio tincidunt nulla. Cras in libero. Aenean rutrum, magna non tristique posuere, erat odio eleifend nisl, non convallis est tortor blandit ligula. Nulla id augue.

+

Nullam mattis, odio ut tempus facilisis, metus nisl facilisis metus, auctor consectetuer felis ligula nec mauris. Vestibulum odio erat, fermentum at, commodo vitae, ultrices et, urna. Mauris vulputate, mi pulvinar sagittis condimentum, sem nulla aliquam velit, sed imperdiet mi purus eu magna. Nulla varius metus ut eros. Aenean aliquet magna eget orci. Class aptent taciti sociosqu ad litora.

+

Vivamus euismod. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Suspendisse vel nibh ut turpis dictum sagittis. Aliquam vel velit a elit auctor sollicitudin. Nam vel dui vel neque lacinia pretium. Quisque nunc erat, venenatis id, volutpat ut, scelerisque sed, diam. Mauris ante. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec mattis. Morbi dignissim sollicitudin libero. Nulla lorem.

+
+

Integer cursus ornare mauris. Praesent nisl arcu, imperdiet eu, ornare id, scelerisque ut, nunc. Praesent sagittis erat sed velit tempus imperdiet. Ut tristique, ante in interdum hendrerit, erat enim faucibus felis, quis rutrum mauris lorem quis sem. Vestibulum ligula nisi, mattis nec, posuere et, blandit eu, ligula. Nam suscipit placerat odio. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Pellentesque tortor libero, venenatis vitae, rhoncus eu, placerat ut, mi. Nulla nulla.

+
+

Maecenas vel metus quis magna pharetra fermentum. Integer sit amet tortor. Maecenas porttitor, pede sed gravida auctor, nulla augue aliquet elit, at pretium urna orci ut metus. Aliquam in dolor. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed aliquam, tellus id ornare posuere, quam nunc accumsan turpis, at convallis tellus orci et nisl. Phasellus congue neque a lorem.

+ +
+
+
This is a nested column
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

+
+
+
This is another nested column
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

+
+ +
+
+ +

A Simple Sidebar

+ +

Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Cras ornare mattis nunc. Mauris venenatis, pede sed aliquet vehicula, lectus tellus pulvinar neque, non cursus sem nisi vel augue.

+

Mauris a lectus. Aliquam erat volutpat. Phasellus ultrices mi a sapien. Nunc rutrum egestas lorem. Duis ac sem sagittis elit tincidunt gravida. Mauris a lectus. Aliquam erat volutpat. Phasellus ultrices mi a sapien. Nunc rutrum egestas lorem. Duis ac sem sagittis elit tincidunt gravida.

+

Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Cras ornare mattis nunc. Mauris venenatis, pede sed aliquet vehicula, lectus tellus pulvinar neque, non cursus sem nisi vel augue.

+ +
Incremental leading
+

Vestibulum ante ipsum primis in faucibus orci luctus vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Cras ornare mattis nunc. Mauris venenatis, pede sed aliquet vehicula, lectus tellus pulvinar neque, non cursus sem nisi vel augue. sed aliquet vehicula, lectus tellus.

+

Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Cras ornare mattis nunc. Mauris venenatis, pede sed aliquet vehicula, lectus tellus pulvinar neque, non cursus sem nisi vel augue. sed aliquet vehicula, lectus tellus pulvinar neque, non cursus sem nisi vel augue. ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Cras ornare mattis nunc. Mauris venenatis, pede sed aliquet vehicula, lectus tellus pulvinar neque, non cursus sem nisi vel augue. sed aliquet vehicula, lectus tellus pulvinar neque, non cursus sem nisi vel augue.

+ +
+ +
+

You may pick and choose amongst these and many more features, so be bold.

+
+ +

+ Valid HTML 4.01 Strict

+
+ + + diff --git a/examples/blueprint_plugins/parts/test-small.jpg b/examples/blueprint_plugins/parts/test-small.jpg new file mode 100644 index 00000000..aa599d99 Binary files /dev/null and b/examples/blueprint_plugins/parts/test-small.jpg differ diff --git a/examples/blueprint_plugins/parts/test.jpg b/examples/blueprint_plugins/parts/test.jpg new file mode 100644 index 00000000..0107be27 Binary files /dev/null and b/examples/blueprint_plugins/parts/test.jpg differ diff --git a/examples/blueprint_plugins/parts/valid.png b/examples/blueprint_plugins/parts/valid.png new file mode 100644 index 00000000..dd20e497 Binary files /dev/null and b/examples/blueprint_plugins/parts/valid.png differ diff --git a/examples/blueprint_plugins/stylesheets/ie.sass b/examples/blueprint_plugins/stylesheets/ie.sass new file mode 100644 index 00000000..9bb82459 --- /dev/null +++ b/examples/blueprint_plugins/stylesheets/ie.sass @@ -0,0 +1,4 @@ +@import blueprint/ie + +body + +blueprint-ie \ No newline at end of file diff --git a/examples/blueprint_plugins/stylesheets/images/grid.png b/examples/blueprint_plugins/stylesheets/images/grid.png new file mode 100644 index 00000000..129d4a29 Binary files /dev/null and b/examples/blueprint_plugins/stylesheets/images/grid.png differ diff --git a/examples/blueprint_plugins/stylesheets/print.sass b/examples/blueprint_plugins/stylesheets/print.sass new file mode 100644 index 00000000..f825831b --- /dev/null +++ b/examples/blueprint_plugins/stylesheets/print.sass @@ -0,0 +1,4 @@ +@import blueprint/print + +body + +blueprint-print \ No newline at end of file diff --git a/examples/blueprint_plugins/stylesheets/screen.sass b/examples/blueprint_plugins/stylesheets/screen.sass new file mode 100644 index 00000000..32a9edbf --- /dev/null +++ b/examples/blueprint_plugins/stylesheets/screen.sass @@ -0,0 +1,14 @@ +@import blueprint/screen +@import modules/fancy_type +@import modules/scaffolding +@import compass/reset + +html + +reset-html + +body + +blueprint + +fancy-type + // Remove the scaffolding when you're ready to start doing visual design. + // Or leave it in if you're happy with how blueprint looks out-of-the-box + +blueprint-scaffolding diff --git a/examples/blueprint_scoped/stylesheets/ie.sass b/examples/blueprint_scoped/stylesheets/ie.sass new file mode 100644 index 00000000..9bb82459 --- /dev/null +++ b/examples/blueprint_scoped/stylesheets/ie.sass @@ -0,0 +1,4 @@ +@import blueprint/ie + +body + +blueprint-ie \ No newline at end of file diff --git a/examples/blueprint_scoped/stylesheets/print.sass b/examples/blueprint_scoped/stylesheets/print.sass new file mode 100644 index 00000000..f825831b --- /dev/null +++ b/examples/blueprint_scoped/stylesheets/print.sass @@ -0,0 +1,4 @@ +@import blueprint/print + +body + +blueprint-print \ No newline at end of file diff --git a/examples/blueprint_scoped/stylesheets/screen.sass b/examples/blueprint_scoped/stylesheets/screen.sass new file mode 100644 index 00000000..7cb9440c --- /dev/null +++ b/examples/blueprint_scoped/stylesheets/screen.sass @@ -0,0 +1,8 @@ +@import blueprint/screen +@import compass/reset + +html + +reset-html + +body.bp + +blueprint \ No newline at end of file diff --git a/examples/blueprint_scoped_form/stylesheets/ie.sass b/examples/blueprint_scoped_form/stylesheets/ie.sass new file mode 100644 index 00000000..9bb82459 --- /dev/null +++ b/examples/blueprint_scoped_form/stylesheets/ie.sass @@ -0,0 +1,4 @@ +@import blueprint/ie + +body + +blueprint-ie \ No newline at end of file diff --git a/examples/blueprint_scoped_form/stylesheets/print.sass b/examples/blueprint_scoped_form/stylesheets/print.sass new file mode 100644 index 00000000..f825831b --- /dev/null +++ b/examples/blueprint_scoped_form/stylesheets/print.sass @@ -0,0 +1,4 @@ +@import blueprint/print + +body + +blueprint-print \ No newline at end of file diff --git a/examples/blueprint_scoped_form/stylesheets/screen.sass b/examples/blueprint_scoped_form/stylesheets/screen.sass new file mode 100644 index 00000000..cd74cef2 --- /dev/null +++ b/examples/blueprint_scoped_form/stylesheets/screen.sass @@ -0,0 +1,12 @@ +@import blueprint/screen +@import compass/reset + +html + +reset-html + +body + +blueprint-grid + +blueprint-typography + +blueprint-utilities + form.blueprint + +blueprint-form diff --git a/examples/blueprint_semantic/index.html b/examples/blueprint_semantic/index.html new file mode 100644 index 00000000..e34e2a38 --- /dev/null +++ b/examples/blueprint_semantic/index.html @@ -0,0 +1,59 @@ + + + + + + Blueprint test pages + + + + + + + + +
+

Blueprint Semantic Test Pages

+
+ +

Welcome to the Blueprint Semantic test pages. The HTML files below test the assignment of styles to semantic classes and ids using Sass mixins.

+ + + + + + + + + + + + +
Test pageMain files testedDescription
Fancy Type + grid.sass, + typography.sass, + fancy_type.sass + A simple sample page, with common elements and fancy type.
+ +

Note about the css files: + These test files utilize the css files that are generated from + Sass templates. + In other words, if you change any of the source files, + you'll have to re-build them with rake examples to see any changes.

+ +
+

For more information and help, try these resources:

+ +
+ +

+ Valid HTML 4.01 Strict

+ +
+ + \ No newline at end of file diff --git a/examples/blueprint_semantic/parts/fancy_type.html b/examples/blueprint_semantic/parts/fancy_type.html new file mode 100644 index 00000000..0b4ba6da --- /dev/null +++ b/examples/blueprint_semantic/parts/fancy_type.html @@ -0,0 +1,84 @@ + + + + + + Blueprint Semantic Sample Page + + + + + + + + + +
+

A simple sample page

+
+

This sample page demonstrates a tiny fraction of what you get with Blueprint.

+
+ +
+
Here's a box
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip.

+
+ +
+
And another box
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat laboris nisi ut aliquip.

+
+ +
+
This box is aligned with the sidebar
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip.

+
+
+
+ +
+

testLorem ipsum dolor sit amet, consectetuer adipiscing elit. Nunc congue ipsum vestibulum libero. Aenean vitae justo. Nam eget tellus. Etiam convallis, est eu lobortis mattis, lectus tellus tempus felis, a ultricies erat ipsum at metus.

+

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi et risus. Aliquam nisl. Nulla facilisi. Cras accumsan vestibulum ante. Vestibulum sed tortor. Praesent small caps tempus fringilla elit. Ut elit diam, sagittis in, nonummy in, gravida non, nunc. Ut orci. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Nam egestas, orci eu imperdiet malesuada, nisl purus fringilla odio, quis commodo est orci vitae justo. Aliquam placerat odio tincidunt nulla. Cras in libero. Aenean rutrum, magna non tristique posuere, erat odio eleifend nisl, non convallis est tortor blandit ligula. Nulla id augue.

+

Nullam mattis, odio ut tempus facilisis, metus nisl facilisis metus, auctor consectetuer felis ligula nec mauris. Vestibulum odio erat, fermentum at, commodo vitae, ultrices et, urna. Mauris vulputate, mi pulvinar sagittis condimentum, sem nulla aliquam velit, sed imperdiet mi purus eu magna. Nulla varius metus ut eros. Aenean aliquet magna eget orci. Class aptent taciti sociosqu ad litora.

+

Vivamus euismod. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Suspendisse vel nibh ut turpis dictum sagittis. Aliquam vel velit a elit auctor sollicitudin. Nam vel dui vel neque lacinia pretium. Quisque nunc erat, venenatis id, volutpat ut, scelerisque sed, diam. Mauris ante. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec mattis. Morbi dignissim sollicitudin libero. Nulla lorem.

+
+

Integer cursus ornare mauris. Praesent nisl arcu, imperdiet eu, ornare id, scelerisque ut, nunc. Praesent sagittis erat sed velit tempus imperdiet. Ut tristique, ante in interdum hendrerit, erat enim faucibus felis, quis rutrum mauris lorem quis sem. Vestibulum ligula nisi, mattis nec, posuere et, blandit eu, ligula. Nam suscipit placerat odio. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Pellentesque tortor libero, venenatis vitae, rhoncus eu, placerat ut, mi. Nulla nulla.

+
+

Maecenas vel metus quis magna pharetra fermentum. Integer sit amet tortor. Maecenas porttitor, pede sed gravida auctor, nulla augue aliquet elit, at pretium urna orci ut metus. Aliquam in dolor. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed aliquam, tellus id ornare posuere, quam nunc accumsan turpis, at convallis tellus orci et nisl. Phasellus congue neque a lorem.

+ +
+
+
This is a nested column
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

+
+
+
This is another nested column
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

+
+ +
+ + +
+

You may pick and choose amongst these and many more features, so be bold.

+
+ +

+ Valid HTML 4.01 Strict

+
+ + + \ No newline at end of file diff --git a/examples/blueprint_semantic/parts/test-small.jpg b/examples/blueprint_semantic/parts/test-small.jpg new file mode 100644 index 00000000..aa599d99 Binary files /dev/null and b/examples/blueprint_semantic/parts/test-small.jpg differ diff --git a/examples/blueprint_semantic/parts/test.jpg b/examples/blueprint_semantic/parts/test.jpg new file mode 100644 index 00000000..0107be27 Binary files /dev/null and b/examples/blueprint_semantic/parts/test.jpg differ diff --git a/examples/blueprint_semantic/parts/valid.png b/examples/blueprint_semantic/parts/valid.png new file mode 100644 index 00000000..dd20e497 Binary files /dev/null and b/examples/blueprint_semantic/parts/valid.png differ diff --git a/examples/blueprint_semantic/stylesheets/ie.sass b/examples/blueprint_semantic/stylesheets/ie.sass new file mode 100644 index 00000000..9bb82459 --- /dev/null +++ b/examples/blueprint_semantic/stylesheets/ie.sass @@ -0,0 +1,4 @@ +@import blueprint/ie + +body + +blueprint-ie \ No newline at end of file diff --git a/examples/blueprint_semantic/stylesheets/images/grid.png b/examples/blueprint_semantic/stylesheets/images/grid.png new file mode 100644 index 00000000..129d4a29 Binary files /dev/null and b/examples/blueprint_semantic/stylesheets/images/grid.png differ diff --git a/examples/blueprint_semantic/stylesheets/print.sass b/examples/blueprint_semantic/stylesheets/print.sass new file mode 100644 index 00000000..f825831b --- /dev/null +++ b/examples/blueprint_semantic/stylesheets/print.sass @@ -0,0 +1,4 @@ +@import blueprint/print + +body + +blueprint-print \ No newline at end of file diff --git a/examples/blueprint_semantic/stylesheets/screen.sass b/examples/blueprint_semantic/stylesheets/screen.sass new file mode 100644 index 00000000..d91d01be --- /dev/null +++ b/examples/blueprint_semantic/stylesheets/screen.sass @@ -0,0 +1,72 @@ +@import blueprint/screen +@import blueprint/modules/fancy_type +@import blueprint/modules/scaffolding +@import compass/reset + +html + +reset-html + +.container + +container + +body.blueprint + +blueprint-typography + html & + +body-margins + hr + +colruler + hr.space + +colspacer + img#w3c + :margin-top 0 + :padding-top 0 + +body#index + #page-header + +span(6) + #files-header + +span(8) + #description-header + +span(10) + #info + +box + ul + :margin-bottom 0 + :padding-bottom 0 + +body#sample + +fancy-paragraphs + h2 + +alt + #first-box + +column(7) + +colborder + #another-box + +column(8) + +colborder + #aligned-box + +column(7, last) + #main + +column(15) + +prepend(1) + +colborder + img#test + +pull(1) + :margin-top 0 + :padding-top 0 + em.caps + +reset + +caps + #nested-1 + +column(7) + +colborder + #nested-2 + +column(7, last) + #sidebar + +column(7, last) + h3 + em + +reset + +alt + #parting-thought + +alt \ No newline at end of file diff --git a/frameworks/blueprint/lib/blueprint/constants.rb b/frameworks/blueprint/lib/blueprint/constants.rb new file mode 100644 index 00000000..43b21af1 --- /dev/null +++ b/frameworks/blueprint/lib/blueprint/constants.rb @@ -0,0 +1,17 @@ +require 'fileutils' +module Blueprint + module Constants + # path to the root Blueprint directory + ROOT_PATH = File.expand_path(File.join(File.dirname(__FILE__), "../../")) + # path to where the Blueprint CSS files are stored + BLUEPRINT_ROOT_PATH = File.join(ROOT_PATH, 'blueprint') + # path to where the Blueprint CSS raw Sass files are stored + SOURCE_PATH = File.join(ROOT_PATH, 'src') + # path to where the Blueprint CSS generated test files are stored + EXAMPLES_PATH = File.join(ROOT_PATH, 'examples') + # path to the root of the Blueprint scripts + LIB_PATH = File.join(ROOT_PATH, 'lib', 'blueprint') + # path to validator jar file to validate generated CSS files + VALIDATOR_FILE = File.join(LIB_PATH, 'validate', 'css-validator.jar') + end +end diff --git a/frameworks/blueprint/lib/blueprint/grid_builder.rb b/frameworks/blueprint/lib/blueprint/grid_builder.rb new file mode 100644 index 00000000..4f0d688a --- /dev/null +++ b/frameworks/blueprint/lib/blueprint/grid_builder.rb @@ -0,0 +1,54 @@ +begin + require 'rubygems' + gem 'rmagick' + require 'rvg/rvg' +rescue Exception => e +end + +module Blueprint + # Uses ImageMagick and RMagick to generate grid.png file + class GridBuilder + begin + include Magick + rescue Exception => e + end + + attr_reader :column_width, :gutter_width, :output_path, :able_to_generate + + # ==== Options + # * options + # * :column_width -- Width (in pixels) of current grid column + # * :gutter_width -- Width (in pixels) of current grid gutter + # * :output_path -- Output path of grid.png file + def initialize(options={}) + @able_to_generate = Magick::Long_version rescue false + return unless @able_to_generate + @column_width = options[:column_width] || Blueprint::COLUMN_WIDTH + @gutter_width = options[:gutter_width] || Blueprint::GUTTER_WIDTH + @output_path = options[:output_path] || Blueprint::SOURCE_PATH + end + + # generates (overwriting if necessary) grid.png image to be tiled in background + def generate! + return false unless self.able_to_generate + total_width = self.column_width + self.gutter_width + height = 20 + RVG::dpi = 100 + + rvg = RVG.new((total_width.to_f/RVG::dpi).in, (height.to_f/RVG::dpi).in).viewbox(0, 0, total_width, height) do |canvas| + canvas.background_fill = 'white' + + canvas.g do |column| + column.rect(self.column_width, height).styles(:fill => "#e8effb") + end + + canvas.g do |baseline| + baseline.line(0, (height - 1), total_width, (height- 1)).styles(:fill => "#e9e9e9") + end + end + + FileUtils.mkdir self.output_path unless File.exists? self.output_path + rvg.draw.write(File.join(self.output_path, "grid.png")) + end + end +end \ No newline at end of file diff --git a/frameworks/blueprint/stylesheets/blueprint/_ie.sass b/frameworks/blueprint/stylesheets/blueprint/_ie.sass new file mode 100644 index 00000000..40f0b2dd --- /dev/null +++ b/frameworks/blueprint/stylesheets/blueprint/_ie.sass @@ -0,0 +1,19 @@ +// mix this into a body element +=blueprint-ie + :text-align center + .container + :text-align left + * html & + legend + :margin -18px -8px 16px 0 + :padding 0 + ol + :margin-left 2em + sup + :vertical-align text-top + sub + :vertical-align text-bottom + html>& p code + :*white-space normal + hr + :margin -8px auto 11px diff --git a/frameworks/blueprint/stylesheets/blueprint/_print.sass b/frameworks/blueprint/stylesheets/blueprint/_print.sass new file mode 100644 index 00000000..1a2ce620 --- /dev/null +++ b/frameworks/blueprint/stylesheets/blueprint/_print.sass @@ -0,0 +1,69 @@ +=blueprint-print + & + :line-height 1.5 + :font-family "Helvetica Neue", Helvetica, Arial, sans-serif + :color #000 + :background none + :font-size 10pt + .container + :background none + hr + :background #ccc + :color #ccc + :width 100% + :height 2px + :margin 2em 0 + :padding 0 + :border none + &.space + :background #fff + :color #fff + h1, h2, h3, h4, h5, h6 + :font-family "Helvetica Neue", Arial, "Lucida Grande", sans-serif + code + :font .9em "Courier New", Monaco, Courier, monospace + img + :float left + :margin 1.5em 1.5em 1.5em 0 + a + img + :border none + &:link + :background transparent + :font-weight 700 + :text-decoration underline + /* This style is in blueprint, but I think it's annoying and it doesn't work in all browsers. + &:after + :content " (" attr(href) ") " + :font-size 90% + p img.top + :margin-top 0 + blockquote + :margin 1.5em + :padding 1em + :font-style italic + :font-size .9em + .small + :font-size .9em + .large + :font-size 1.1em + .quiet + :color #999 + .hide, + .noprint, + .no-print + :display none + address, blockquote, center, dir, div, dd, dl, dt, fieldset, form, frameset, h1, h2, h3, h4, h5, h6, hr, isindex, li, menu, noframes, noscript, ol, p, pre, table, tbody, td, tfoot, th, thead, tr, ul + &.print-only + :display block + a, abbr, acronym, b, basefont, bdo, big, br, cite, code, dfn, em, font, i, img, input, kbd, label, q, s, samp, select, small, span, strike, strong, sub, sup, textarea, tt, u, var + &.print-only + :display inline + a:visited + :background transparent + :font-weight 700 + :text-decoration underline + /* + a:visited:after + :content " (" attr(href) ") " + :font-size 90% diff --git a/frameworks/blueprint/stylesheets/blueprint/_screen.sass b/frameworks/blueprint/stylesheets/blueprint/_screen.sass new file mode 100644 index 00000000..2a1eec7e --- /dev/null +++ b/frameworks/blueprint/stylesheets/blueprint/_screen.sass @@ -0,0 +1,16 @@ +@import modules/colors +@import modules/reset +@import modules/grid +@import modules/typography +@import modules/utilities +@import modules/form +@import modules/interaction +@import modules/debug + +=blueprint + +blueprint-grid + +blueprint-typography + +blueprint-utilities + +blueprint-debug + +blueprint-interaction + +blueprint-form diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass new file mode 100644 index 00000000..c069ea75 --- /dev/null +++ b/frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass @@ -0,0 +1,37 @@ +!font_color= #333 +!font_background= transparent +!quiet_color= !font_color + #333 +!loud_color= !font_color - #222 + +!header_color= !font_color - #111 + +// !link_color= #009 +// !link_hover_color= !link_color +!link_color= #457ac9 +!link_hover_color= #399999 +!link_focus_color= !link_color +!link_active_color= !link_color + #c00 +!link_visited_color= !link_color - #333 + +!success_color = #264409 +!success_bg_color = #E6EFC2 +!success_border_color = #C6D880 + +!notice_color = #514721 +!notice_bg_color = #FFF6BF +!notice_border_color = #FFD324 + +!error_color = #8a1f11 +!error_bg_color = #FBE3E4 +!error_border_color = #FBC2C4 + +=link-colors(!normal = !link_color, !hover = !link_hover_color, !active = !link_active_color, !visited = !link_visited_color, !focus = !link_focus_color) + :color= !normal + &:hover + :color= !hover + &:active + :color= !active + &:visited + :color= !visited + &:focus + :color= !focus diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass new file mode 100644 index 00000000..22d7893f --- /dev/null +++ b/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass @@ -0,0 +1,9 @@ +=showgrid(!image = images/grid.png) + :background= url(!image) + +=blueprint-debug(!grid_image = images/grid.png) + // Use this class on any div.span / container to see the grid. + // TODO: prefix this with the project path. + .showgrid + +showgrid(!grid_image) + \ No newline at end of file diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass new file mode 100644 index 00000000..4cfca072 --- /dev/null +++ b/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass @@ -0,0 +1,85 @@ +/* + To install the fancy type plugin: + 1. import the fancy_type module: + @import blueprint/modules/fancy_type + 2. mixin +fancy-type to your project's body: + body + +fancy-type + +/* Indentation instead of line shifts for sibling paragraphs. Mixin to a style like p + p +=sibling-indentation + :text-indent 2em + :margin-top -1.5em + /* Don't want this in forms. + form & + :text-indent 0 + +/* + For great looking type, use this code instead of asdf: + asdf + Best used on prepositions and ampersands. + +=alt + :color #666 + :font-family "Warnock Pro", "Goudy Old Style","Palatino","Book Antiqua", Georgia, serif + :font-style italic + :font-weight normal + +/* + For great looking quote marks in titles, replace "asdf" with: + asdf” + (That is, when the title starts with a quote mark). + (You may have to change this value depending on your font size). +=dquo + :margin-left -.5em + +/* + Reduced size type with incremental leading + (http://www.markboulton.co.uk/journal/comments/incremental_leading/) + + This could be used for side notes. For smaller type, you don't necessarily want to + follow the 1.5x vertical rhythm -- the line-height is too much. + + Using this class, it reduces your font size and line-height so that for + every four lines of normal sized type, there is five lines of the sidenote. eg: + + New type size in em's: + 10px (wanted side note size) / 12px (existing base size) = 0.8333 (new type size in ems) + + New line-height value: + 12px x 1.5 = 18px (old line-height) + 18px x 4 = 72px + 72px / 5 = 14.4px (new line height) + 14.4px / 10px = 1.44 (new line height in em's) +=incr + :font-size 10px + :line-height 1.44em + :margin-bottom 1.5em + +/* + Surround uppercase words and abbreviations with this class. + Based on work by Jørgen Arnor GÃ¥rdsø Lom [http://twistedintellect.com/] */ +=caps + :font-variant small-caps + :letter-spacing 1px + :text-transform lowercase + :font-size 1.2em + :line-height 1% + :font-weight bold + :padding 0 2px + +=fancy-paragraphs + p + p + +sibling-indentation + p.incr, + .incr p + +incr + +=fancy-type + +fancy-paragraphs + .caps + +caps + .dquo + +dquo + .alt + +alt diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass new file mode 100644 index 00000000..d2f1df2f --- /dev/null +++ b/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass @@ -0,0 +1,43 @@ +@import colors + +=blueprint-form + label + :font-weight bold + fieldset + :padding 1.4em + :margin 0 0 1.5em 0 + :border 1px solid #ccc + legend + :font-weight bold + :font-size 1.2em + input + &.text + :margin 0.5em 0 + :border 1px solid #bbb + :width 300px + :padding 5px + &:focus + :border 1px solid #666 + &.title + :font-size 1.5em + input.title + :margin 0.5em 0 + :border 1px solid #bbb + :width 300px + :padding 5px + &:focus + :border 1px solid #666 + textarea + :margin 0.5em 0 + :border 1px solid #bbb + &:focus + :border 1px solid #666 + select + :margin 0.5em 0 + :border 1px solid #bbb + &:focus + :border 1px solid #666 + textarea + :width 390px + :height 250px + :padding 5px diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass new file mode 100755 index 00000000..6d9a0e90 --- /dev/null +++ b/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass @@ -0,0 +1,148 @@ +// -------------------------------------------------------------- +// SASS Gridification +// * Author: Chris Eppstein +// A SASS adaptation of Blueprint CSS +// * Version: 0.7.1 (2008-02-25) +// * Website: http://code.google.com/p/blueprintcss/ +// Based on work by: +// * Lorin Tacket [lorintackett.com] +// * Olav Bjorkoy [bjorkoy.com] +// * Nathan Borror [playgroundblues.com] +// * Jeff Croft [jeffcroft.com] +// * Christian Metts [mintchaos.com] +// * Khoi Vinh [subtraction.com] +// Read more about using a grid here: +// * subtraction.com/archives/2007/0318_oh_yeeaahh.php +// -------------------------------------------------------------- + +@import compass/utilities + +// Main layout grid, edit these parameters to build your grid and container sizes. +!layout_grid_columns = 24 +!layout_grid_width = 30px +!layout_grid_margin = 10px + +// Do not edit below this line unless you really know what you're doing. +!layout_grid_outer_width = !layout_grid_width + !layout_grid_margin +!layout_grid_size = !layout_grid_width * !layout_grid_columns + (!layout_grid_margin * (!layout_grid_columns - 1)) + +// Columns +// Note: If you use this mixin without the class and want to support ie6 +// you must set text-align left on your container element in an IE stylesheet. +=container + :width = !layout_grid_size + :margin 0 auto + +clearfix + +// The last column in a row needs this mixin or it will end up on the next row. +// TODO add this to span mixin when we have optional arguments +=last + :margin + :right 0 + +=span(!n) + :width = !layout_grid_width * !n + (!layout_grid_margin * (!n - 1)) + +// Use this mixins to set the width of n columns. +=column(!n, !last = false) + :float left + +span(!n) + @if !last + +last + @if !!last + :margin-right = !layout_grid_margin + +// Mixin to a column to append n empty cols. +=append(!n) + :padding-right = (!layout_grid_outer_width) * !n + +// Mixin to a column to prepend n empty cols. +=prepend(!n) + :padding-left = (!layout_grid_outer_width) * !n + +// mixin to a column to move it n columns to the left +=pull(!n) + :float left + :position relative + :margin-left = -!layout_grid_outer_width * !n + +// mixin to a column to push it n columns to the right +=push(!n) + :float right + :position relative + :margin + :top 0 + :right = -!layout_grid_outer_width * !n + :bottom 1.5em + :left = -!layout_grid_outer_width * !n + +// Border on right hand side of a column. +=border + :padding-right = !layout_grid_margin / 2 - 1 + :margin-right = !layout_grid_margin / 2 + :border-right 1px solid #eee + +// Border with more whitespace, spans one column. +=colborder + :padding-right= !layout_grid_width - 0.5 * !layout_grid_margin - 1 + :margin-right= !layout_grid_width - 0.5 * !layout_grid_margin + :border-right 1px solid #eee + +// Mixin this to an hr to make a horizontal ruler across a column. +=colruler + :background #ddd + :color #ddd + :clear both + :float none + :width 100% + :height .1em + :margin 0 0 1.45em + :border none + +// Mixin this to an hr to make a horizontal spacer across a column. +=colspacer + +colruler + :background #fff + :color #fff + +=blueprint-grid + // A container should group all your columns + .container + +container + // Use these classes (or mixins) to set the width of a column. + @for !n from 1 to !layout_grid_columns + 1 + .span-#{!n} + +span(!n) + div + &.span-#{!n} + +column(!n, !n == !layout_grid_columns) + // The last column in a row needs this class (or mixin) or it will end up on the next row. + div.last + +last + // Add these to a column to append empty cols. + @for !n from 1 to !layout_grid_columns + .append-#{!n} + +append(!n) + // Add these to a column to prepend empty cols. + @for !n from 1 to !layout_grid_columns + .prepend-#{!n} + +prepend(!n) + // Use these classes on an element to push it into the + // next column, or to pull it into the previous column. + @for !n from 1 to !layout_grid_columns + 1 + .pull-#{!n} + +pull(!n) + @for !n from 1 to !layout_grid_columns + 1 + .push-#{!n} + +push(!n) + //*** The following classes are provided for convenience. You can comment them out if you don't want them. ***// + // Border on right hand side of a column. You can comment this out if you don't plan to use it. + div.border + +border + // Border with more whitespace, spans one column. + div.colborder + +colborder + hr + +colruler + hr.space + +colspacer diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass new file mode 100644 index 00000000..21277468 --- /dev/null +++ b/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass @@ -0,0 +1,55 @@ +=feedback-base + :padding .8em + :margin-bottom 1em + :border 2px solid #ddd + +=error + +feedback-base + :background= !error_bg_color + :color= !error_color + :border-color= !error_border_color + a + :color= !error_color + +=notice + +feedback-base + :background= !notice_bg_color + :color= !notice_color + :border-color= !notice_border_color + a + :color= !notice_color + +=success + +feedback-base + :background= !success_bg_color + :color= !success_color + :border-color= !success_border_color + a + :color= !success_color + +=highlight + :background #ff0 + +=added + :background #060 + :color #fff + +=removed + :background #900 + :color #fff + +=blueprint-interaction + .error + +error + .notice + +notice + .success + +success + .hide + :display none + .highlight + +highlight + .added + +added + .removed + +removed diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass new file mode 100644 index 00000000..e6f16da5 --- /dev/null +++ b/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass @@ -0,0 +1,18 @@ +/* + The styles contained here are meant to provide for an attractive experience out of the box + and are meant to be removed once custom visual design begins. + +=body-margins + :margin 1.5em 0 + +// Mixin +box to create a padded box inside a column. +=box + :padding 1.5em + :margin-bottom 1.5em + :background #E5ECF9 + +=blueprint-scaffolding + html & + +body-margins + .box + +box diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass new file mode 100644 index 00000000..5233d3ab --- /dev/null +++ b/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass @@ -0,0 +1,129 @@ +@import colors + +=normal-text + :font-family "Helvetica Neue", Helvetica, Arial, sans-serif + :color= !font_color + :background= !font_background + +=fixed-width-text + :font 1em 'andale mono', 'lucida console', monospace + :line-height 1.5 + +=header-text + :font-weight normal + :color= !header_color + +=quiet + :color= !quiet_color + +=loud + :color= !loud_color + +=blueprint-typography + html & + +normal-text + :font-size 75% + h1 + +header-text + :font-size 3em + :line-height 1 + :margin-bottom 0.5em + img + :margin 0 + h2 + +header-text + :font-size 2em + :margin-bottom 0.75em + h3 + +header-text + :font-size 1.5em + :line-height 1 + :margin-bottom 1em + h4 + +header-text + :font-size 1.2em + :line-height 1.25 + :margin-bottom 1.25em + :height 1.25em + h5 + +header-text + :font-size 1em + :font-weight bold + :margin-bottom 1.5em + h6 + +header-text + :font-size 1em + :font-weight bold + h2 img, h3 img, h4 img, h5 img, h6 img + :margin 0 + p + :margin 0 0 1.5em + img + :float left + :margin 1.5em 1.5em 1.5em 0 + :padding 0 + &.right + :float right + :margin 1.5em 0 1.5em 1.5em + a + :text-decoration underline + +link-colors + blockquote + :margin 1.5em + :color #666 + :font-style italic + strong + :font-weight bold + em + :font-style italic + dfn + :font-style italic + :font-weight bold + sup, sub + :line-height 0 + abbr, acronym + :border-bottom 1px dotted #666 + address + :margin 0 0 1.5em + :font-style italic + del + :color #666 + pre, code + :margin 1.5em 0 + :white-space pre + +fixed-width-text + tt + +fixed-width-text + li ul, li ol + :margin 0 1.5em + ul + :margin 0 1.5em 1.5em 1.5em + :list-style-type disc + ol + :margin 0 1.5em 1.5em 1.5em + :list-style-type decimal + dl + :margin 0 0 1.5em 0 + dt + :font-weight bold + dd + :margin-left 1.5em + table + :margin-bottom 1.4em + :width 100% + th + :font-weight bold + :background #C3D9FF + :padding 4px 10px 4px 5px + td + :padding 4px 10px 4px 5px + tr.even td + :background #E5ECF9 + tfoot + :font-style italic + caption + :background #eee + .quiet + +quiet + .loud + +loud diff --git a/frameworks/blueprint/templates/project/grid.png b/frameworks/blueprint/templates/project/grid.png new file mode 100644 index 00000000..129d4a29 Binary files /dev/null and b/frameworks/blueprint/templates/project/grid.png differ diff --git a/frameworks/blueprint/templates/project/ie.sass b/frameworks/blueprint/templates/project/ie.sass new file mode 100644 index 00000000..9bb82459 --- /dev/null +++ b/frameworks/blueprint/templates/project/ie.sass @@ -0,0 +1,4 @@ +@import blueprint/ie + +body + +blueprint-ie \ No newline at end of file diff --git a/frameworks/blueprint/templates/project/print.sass b/frameworks/blueprint/templates/project/print.sass new file mode 100644 index 00000000..f825831b --- /dev/null +++ b/frameworks/blueprint/templates/project/print.sass @@ -0,0 +1,4 @@ +@import blueprint/print + +body + +blueprint-print \ No newline at end of file diff --git a/frameworks/blueprint/templates/project/screen.sass b/frameworks/blueprint/templates/project/screen.sass new file mode 100644 index 00000000..a4a0bbb8 --- /dev/null +++ b/frameworks/blueprint/templates/project/screen.sass @@ -0,0 +1,12 @@ +@import blueprint/screen +@import blueprint/modules/scaffolding +@import compass/reset + +html + +reset-html + +body + +blueprint + // Remove the scaffolding when you're ready to start doing visual design. + // Or leave it in if you're happy with how blueprint looks out-of-the-box + +blueprint-scaffolding diff --git a/frameworks/compass/stylesheets/compass/_reset.sass b/frameworks/compass/stylesheets/compass/_reset.sass new file mode 100644 index 00000000..8f7f5975 --- /dev/null +++ b/frameworks/compass/stylesheets/compass/_reset.sass @@ -0,0 +1,73 @@ +=reset + :margin 0 + :padding 0 + :border 0 + :font + :weight inherit + :style inherit + :size 100% + :family inherit + :vertical-align baseline + +=reset-quotation + +reset + :quotes "" "" + &:before, + &:after + :content "" + +=reset-table-cell + +reset + :text-align left + :font-weight normal + :vertical-align middle + +=reset-table + +reset + :border-collapse separate + :border-spacing 0 + :vertical-align middle + +=reset-body-tag + +reset + :line-height 1.5 + +// Mix this into the html element of your application +// if you want a global reset (recommended). +=reset-html + +reset + div, span, object, iframe, h1, h2, h3, h4, h5, h6, p + +reset + body + +reset-body-tag + blockquote, q + +reset-quotation + pre, a, abbr, acronym, address, code, del, dfn, em, img + +reset + dl, dt, dd, ol, ul, li, fieldset, form, label, legend, caption, tbody, tfoot, thead, tr + +reset + th, td, caption + +reset-table-cell + table + +reset-table + a img + :border none + +// Mix this into the body element +// if you want a selective reset +=reset-body + +reset-body-tag + div, span, object, iframe, h1, h2, h3, h4, h5, h6, p + +reset + blockquote, q + +reset-quotation + pre, a, abbr, acronym, address, code, del, dfn, em, img + +reset + dl, dt, dd, ol, ul, li, fieldset, form, label, legend, caption, tbody, tfoot, thead, tr + +reset + th, td, caption + +reset-table-cell + table + +reset-table + a img + :border none \ No newline at end of file diff --git a/frameworks/compass/stylesheets/compass/_utilities.sass b/frameworks/compass/stylesheets/compass/_utilities.sass new file mode 100644 index 00000000..41fa60c9 --- /dev/null +++ b/frameworks/compass/stylesheets/compass/_utilities.sass @@ -0,0 +1,54 @@ +// Clearing floats without extra markup +// Based on How To Clear Floats Without Structural Markup by PiE +// [http://www.positioniseverything.net/easyclearing.html] +// The above article no longer recommends its approach instead +// This is recommended now: +// [http://www.sitepoint.com/examples/clearing_floats/example2.php] +=clearfix + :overflow auto + // This makes ie6 get layout + :display inline-block + // and this puts it back to block + & + :display block + +=nowrap + :white-space nowrap + + +// Most of these utility classes are not "semantic". If you use them, +// you are mixing your content and presentation. For shame! + +=blueprint-utilities + // Regular clearing apply to column that should drop below previous ones. + .clear + :clear both + // turn off text wrapping for the element. + .nowrap + +nowrap + // Apply to an element that has floated children to make the bottom + // of the element fall _below_ the floated children. + .clearfix + +clearfix + .small + :font-size .8em + :margin-bottom 1.875em + :line-height 1.875em + .large + :font-size 1.2em + :line-height 2.5em + :margin-bottom 1.25em + .first + :margin-left 0 + :padding-left 0 + .last + :margin-right 0 + :padding-right 0 + .top + :margin-top 0 + :padding-top 0 + .bottom + :margin-bottom 0 + :padding-bottom 0 + .print-only + :display none diff --git a/frameworks/compass/templates/project/grid.png b/frameworks/compass/templates/project/grid.png new file mode 100644 index 00000000..129d4a29 Binary files /dev/null and b/frameworks/compass/templates/project/grid.png differ diff --git a/frameworks/compass/templates/project/ie.sass b/frameworks/compass/templates/project/ie.sass new file mode 100644 index 00000000..dc805b49 --- /dev/null +++ b/frameworks/compass/templates/project/ie.sass @@ -0,0 +1,3 @@ +/* + Welcome to Compass. We'll show you the way, but you'll have to get there on your own. + Use this file to write IE specific override styles. diff --git a/frameworks/compass/templates/project/print.sass b/frameworks/compass/templates/project/print.sass new file mode 100644 index 00000000..54a7d9b5 --- /dev/null +++ b/frameworks/compass/templates/project/print.sass @@ -0,0 +1,4 @@ +/* + Welcome to Compass. We'll show you the way, but you'll have to get there on your own. + Use this file to define print styles. + diff --git a/frameworks/compass/templates/project/screen.sass b/frameworks/compass/templates/project/screen.sass new file mode 100644 index 00000000..fe6007a4 --- /dev/null +++ b/frameworks/compass/templates/project/screen.sass @@ -0,0 +1,7 @@ +/* + Welcome to Compass. We'll show you the way, but you'll have to get there on your own. + In this file you should write (or centralize your imports) the main styles. +@import compass/reset + +html + +reset-html diff --git a/lib/compass.rb b/lib/compass.rb new file mode 100644 index 00000000..bd8eac47 --- /dev/null +++ b/lib/compass.rb @@ -0,0 +1,13 @@ +['core_ext', 'version'].each do |file| + require File.join(File.dirname(__FILE__), 'compass', file) +end + +module Compass + extend Compass::Version + def base_directory + File.expand_path(File.join(File.dirname(__FILE__), '..')) + end + module_function :base_directory +end + +require File.join(File.dirname(__FILE__), 'compass', 'frameworks') diff --git a/lib/compass/commands/base.rb b/lib/compass/commands/base.rb new file mode 100644 index 00000000..996d14d5 --- /dev/null +++ b/lib/compass/commands/base.rb @@ -0,0 +1,78 @@ +module Compass + module Commands + class Base + attr_accessor :working_directory, :options + def initialize(working_directory, options) + self.working_directory = working_directory + self.options = options + end + + def perform + raise StandardError.new("Not Implemented") + end + + protected + + def projectize(path) + File.join(project_directory, separate(path)) + end + # create a directory and all the directories necessary to reach it. + def directory(subdir, options) + dir = subdir ? projectize(subdir) : project_directory + if File.exists?(dir) && File.directory?(dir) && options[:force] + print_action :exists, basename(dir) + File::SEPARATOR + elsif File.exists?(dir) && File.directory?(dir) + msg = "Directory #{basename(dir)} already exists. Run with --force to force project creation." + raise ::Compass::Exec::ExecError.new(msg) + elsif File.exists?(dir) + msg = "#{basename(dir)} already exists and is not a directory." + raise ::Compass::Exec::ExecError.new(msg) + else + print_action :directory, basename(dir) + File::SEPARATOR + FileUtils.mkdir_p(dir) unless options[:dry_run] + end + end + + # copy/process a template in the compass template directory to the project directory. + def template(from, to, options) + to = projectize(to) + from = File.join(templates_directory, separate(from)) + if File.exists?(to) && !options[:force] + #TODO: Detect differences & provide an overwrite prompt + msg = "#{basename(to)} already exists." + raise ::Compass::Exec::ExecError.new(msg) + elsif File.exists?(to) + print_action :remove, basename(to) + FileUtils.rm to unless options[:dry_run] + end + print_action :create, basename(to) + FileUtils.cp from, to unless options[:dry_run] + end + + # returns the path to the templates directory and caches it + def templates_directory + @templates_directory ||= File.expand_path(File.join(File.dirname(__FILE__), separate("../../../frameworks/#{options[:framework]}/templates"))) + end + + # Write paths like we're on unix and then fix it + def separate(path) + path.gsub(%r{/}, File::SEPARATOR) + end + + def basename(file, extra = 0) + if file.length > (working_directory.length + extra) + file[(working_directory.length + extra + 1)..-1] + else + File.basename(file) + end + end + + ACTIONS = [:directory, :exists, :remove, :create] + MAX_ACTION_LENGTH = ACTIONS.inject(0){|memo, a| [memo, a.to_s.length].max} + def print_action(action, extra) + puts "#{' ' * (MAX_ACTION_LENGTH - action.to_s.length)}#{action} #{extra}" if !options[:quiet] || options[:dry_run] + end + + end + end +end \ No newline at end of file diff --git a/lib/compass/commands/create_project.rb b/lib/compass/commands/create_project.rb new file mode 100644 index 00000000..ad3ef3d0 --- /dev/null +++ b/lib/compass/commands/create_project.rb @@ -0,0 +1,30 @@ +require 'fileutils' +require File.join(File.dirname(__FILE__), 'base') +require File.join(File.dirname(__FILE__), 'update_project') + +module Compass + module Commands + class CreateProject < Base + + attr_accessor :project_directory, :project_name + + def initialize(working_directory, options) + super(working_directory, options) + self.project_name = options[:project_name] + self.project_directory = File.expand_path File.join(working_directory, project_name) + end + + # all commands must implement perform + def perform + directory nil, options + directory 'stylesheets', options.merge(:force => true) + directory 'src', options.merge(:force => true) + template 'project/screen.sass', 'src/screen.sass', options + template 'project/print.sass', 'src/print.sass', options + template 'project/ie.sass', 'src/ie.sass', options + UpdateProject.new(working_directory, options).perform + end + + end + end +end \ No newline at end of file diff --git a/lib/compass/commands/print_version.rb b/lib/compass/commands/print_version.rb new file mode 100644 index 00000000..ef4037a0 --- /dev/null +++ b/lib/compass/commands/print_version.rb @@ -0,0 +1,23 @@ +module Compass + module Commands + class PrintVersion + attr_accessor :options + def initialize(working_directory, options) + self.options = options + end + + def perform + if options[:quiet] + # The quiet option may make scripting easier + puts ::Compass.version[:string] + else + lines = [] + lines << "Compass #{::Compass.version[:string]}" + lines << "Copyright (c) 2008 Chris Eppstein" + lines << "Released under the MIT License." + puts lines.join("\n") + end + end + end + end +end \ No newline at end of file diff --git a/lib/compass/commands/update_project.rb b/lib/compass/commands/update_project.rb new file mode 100644 index 00000000..c256c677 --- /dev/null +++ b/lib/compass/commands/update_project.rb @@ -0,0 +1,91 @@ +require 'rubygems' +require 'sass' +require 'fileutils' +require 'pathname' +require File.join(File.dirname(__FILE__), 'base') + +module Compass + module Commands + class UpdateProject < Base + + Base::ACTIONS << :compile + Base::ACTIONS << :overwrite + + attr_accessor :project_directory, :project_name, :options + + def initialize(working_directory, options = {}) + super(working_directory, options) + if options[:project_name] + options[:project_name] = options[:project_name][0..-2] if options[:project_name][-1..-1] == File::SEPARATOR + self.project_name = File.basename(options[:project_name]) + if options[:project_name][0] == File::SEPARATOR + self.project_directory = options[:project_name] + elsif File.directory?(File.join(working_directory, options[:project_name])) + self.project_directory = File.expand_path(File.join(working_directory, options[:project_name])) + else + if File.exists?(options[:project_name]) or File.exists?(File.join(working_directory, options[:project_name])) + raise ::Compass::Exec::ExecError.new("#{options[:project_name]} is not a directory.") + elsif !(options[:force] || options[:dry_run]) + raise ::Compass::Exec::ExecError.new("#{options[:project_name]} does not exist.") + end + end + else + self.project_name = File.basename(working_directory) + self.project_directory = working_directory + end + end + + def perform + Dir.glob(separate("#{project_directory}/src/**/[^_]*.sass")).each do |sass_file| + stylesheet_name = sass_file[("#{project_directory}/src/".length)..-6] + compile "src/#{stylesheet_name}.sass", "stylesheets/#{stylesheet_name}.css", options + end + end + + # Compile one Sass file + def compile(sass_filename, css_filename, options) + sass_filename = projectize(sass_filename) + css_filename = projectize(css_filename) + if !File.directory?(File.dirname(css_filename)) + directory basename(File.dirname(css_filename)), options.merge(:force => true) unless options[:dry_run] + end + print_action :compile, basename(sass_filename) + if File.exists?(css_filename) + print_action :overwrite, basename(css_filename) + else + print_action :create, basename(css_filename) + end + unless options[:dry_run] + engine = ::Sass::Engine.new(open(sass_filename).read, + :filename => sass_filename, + :line_comments => options[:environment] == :development, + :style => output_style, + :css_filename => css_filename, + :load_paths => sass_load_paths) + output = open(css_filename,'w') + output.write(engine.render) + output.close + end + end + + def output_style + @output_style ||= options[:style] || if options[:environment] == :development + :expanded + else + :compact + end + end + + # where to load sass files from + def sass_load_paths + @sass_load_paths ||= [project_src_directory] + Compass::Frameworks::ALL.map{|f| f.stylesheets_directory} + end + + # The directory where the project source files are located. + def project_src_directory + @project_src_directory ||= separate("#{project_directory}/src") + end + + end + end +end \ No newline at end of file diff --git a/lib/compass/core_ext.rb b/lib/compass/core_ext.rb new file mode 100644 index 00000000..70659b62 --- /dev/null +++ b/lib/compass/core_ext.rb @@ -0,0 +1,39 @@ +class String + # see if string has any content + def blank?; self.length.zero?; end + + # strip space after :, remove newlines, replace multiple spaces with only one space, remove comments + def strip_space! + replace self.gsub(/:\s*/, ':').gsub(/\n/, '').gsub(/\s+/, ' ').gsub(/(\/\*).*?(\*\/)/, '') + end + + # remove newlines, insert space after comma, replace two spaces with one space after comma + def strip_selector_space! + replace self.gsub(/(\n)/, '').gsub(',', ', ').gsub(', ', ', ') + end + + # remove leading whitespace, remove end whitespace + def strip_side_space! + replace self.gsub(/^\s+/, '').gsub(/\s+$/, $/) + end +end + +class NilClass + def blank? + true + end +end + +class File + # string output from file + def self.path_to_string(path) + File.new(path).read + end + + # saves a string to a specified file path + def self.string_to_file(string, path) + directory = File.dirname(path) + FileUtils.mkdir_p directory unless File.directory?(directory) + File.open(path, 'w') { |f| f << string } + end +end \ No newline at end of file diff --git a/lib/compass/exec.rb b/lib/compass/exec.rb new file mode 100644 index 00000000..66e65790 --- /dev/null +++ b/lib/compass/exec.rb @@ -0,0 +1,138 @@ +require 'optparse' +require 'rubygems' +require 'haml' + +module Compass + module Exec + class ExecError < StandardError + end + class Compass + + attr_accessor :args, :options, :opts + + def initialize(args) + self.args = args + self.options = {} + end + + def run! + begin + parse! + perform! + rescue Exception => e + raise e if e.is_a? SystemExit + if e.is_a?(ExecError) || e.is_a?(OptionParser::ParseError) + $stderr.puts e.message + else + $stderr.puts "#{e.class} on line #{get_line e} of #{get_file e}: #{e.message}" + if @options[:trace] + e.backtrace[1..-1].each { |t| $stderr.puts " #{t}" } + else + $stderr.puts "Run with --trace to see the full backtrace" + end + end + exit 1 + end + exit 0 + end + + protected + + def perform! + if options[:version] + do_command(:print_version) + elsif options[:update] + do_command(:update_project) + elsif options[:project_name] + do_command(:create_project) + else + puts self.opts + end + end + + def parse! + self.opts = OptionParser.new(&method(:set_opts)) + self.opts.parse!(self.args) + if ARGV.size > 0 + self.options[:project_name] = ARGV.shift + end + self.options[:environment] ||= :production + self.options[:framework] ||= :compass + end + + def set_opts(opts) + opts.banner = < + + + + +W3C IPR SOFTWARE NOTICE + + +

W3C® SOFTWARE NOTICE AND LICENSE

+ +

Copyright © 1997-2002 World +Wide Web Consortium, (Massachusetts Institute of +Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All Rights +Reserved. http://www.w3.org/Consortium/Legal/

+ +

This W3C work (including software, documents, or other related +items) is being provided by the copyright holders under the +following license. By obtaining, using and/or copying this work, +you (the licensee) agree that you have read, understood, and will +comply with the following terms and conditions:

+ +

Permission to use, copy, modify, and distribute this software +and its documentation, with or without modification,  for any +purpose and without fee or royalty is hereby granted, provided that +you include the following on ALL copies of the software and +documentation or portions thereof, including modifications, that +you make:

+ +
    +
  1. The full text of this NOTICE in a location viewable to users of +the redistributed or derivative work.
  2. + +
  3. Any pre-existing intellectual property disclaimers, notices, or +terms and conditions. If none exist, a short notice of the +following form (hypertext is preferred, text is permitted) should +be used within the body of any redistributed or derivative code: +"Copyright © [$date-of-software] World Wide Web Consortium, (Massachusetts Institute of +Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All Rights +Reserved. http://www.w3.org/Consortium/Legal/"
  4. + +
  5. Notice of any changes or modifications to the W3C files, +including the date changes were made. (We recommend you provide +URIs to the location from which the code is derived.)
  6. +
+ +

THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND +COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF +MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE +USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD +PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.

+ +

COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, +SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE +SOFTWARE OR DOCUMENTATION.

+ +

The name and trademarks of copyright holders may NOT be used in +advertising or publicity pertaining to the software without +specific, written prior permission. Title to copyright in this +software and any associated documentation will at all times remain +with copyright holders.

+ +

____________________________________

+ +

This formulation of W3C's notice and license became active on +August 14 1998 so as to improve compatibility with GPL. This +version ensures that W3C software licensing terms are no more +restrictive than GPL and consequently W3C software may be +distributed in GPL packages. See the older formulation for +the policy prior to this date. Please see our Copyright FAQ for common questions about +using materials from our site, including specific terms and +conditions for packages like libwww, Amaya, and Jigsaw. Other +questions about this notice can be directed to site-policy@w3.org.

+ +

 

+ +
webmaster
+ (last updated $Date: 2004/05/29 04:04:36 $)
+ + + \ No newline at end of file diff --git a/lib/compass/validate/JIGSAW_COPYRIGHT b/lib/compass/validate/JIGSAW_COPYRIGHT new file mode 100644 index 00000000..9108b470 --- /dev/null +++ b/lib/compass/validate/JIGSAW_COPYRIGHT @@ -0,0 +1,64 @@ +W3C IPR SOFTWARE NOTICE + +Copyright © 1995-1998 World Wide Web Consortium, (Massachusetts Institute of +Technology, Institut National de Recherche en Informatique et en +Automatique, Keio University). All Rights Reserved. +http://www.w3.org/Consortium/Legal/ + +This W3C work (including software, documents, or other related items) is +being provided by the copyright holders under the following license. By +obtaining, using and/or copying this work, you (the licensee) agree that you +have read, understood, and will comply with the following terms and +conditions: + +Permission to use, copy, and modify this software and its documentation, +with or without modification, for any purpose and without fee or royalty is +hereby granted, provided that you include the following on ALL copies of the +software and documentation or portions thereof, including modifications, +that you make: + + 1. The full text of this NOTICE in a location viewable to users of the + redistributed or derivative work. + 2. Any pre-existing intellectual property disclaimers, notices, or terms + and conditions. If none exist, a short notice of the following form + (hypertext is preferred, text is permitted) should be used within the + body of any redistributed or derivative code: "Copyright © World Wide + Web Consortium, (Massachusetts Institute of Technology, Institut + National de Recherche en Informatique et en Automatique, Keio + University). All Rights Reserved. http://www.w3.org/Consortium/Legal/" + 3. Notice of any changes or modifications to the W3C files, including the + date changes were made. (We recommend you provide URIs to the location + from which the code is derived). + +In addition, creators of derivitive works must include the full text of this +NOTICE in a location viewable to users of the derivitive work. + +THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS +MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR +PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE +ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. + +COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR +DOCUMENTATION. + +The name and trademarks of copyright holders may NOT be used in advertising +or publicity pertaining to the software without specific, written prior +permission. Title to copyright in this software and any associated +documentation will at all times remain with copyright holders. + +____________________________________ + +This formulation of W3C's notice and license became active on August 14 +1998. See the older formulation for the policy prior to this date. Please +see our Copyright FAQ for common questions about using materials from our +site, including specific terms and conditions for packages like libwww, +Amaya, and Jigsaw. Other questions about this notice can be directed to +site-policy@w3.org . + + + + +webmaster +(last updated 14-Aug-1998) diff --git a/lib/compass/validate/README.html b/lib/compass/validate/README.html new file mode 100644 index 00000000..4071e589 --- /dev/null +++ b/lib/compass/validate/README.html @@ -0,0 +1,83 @@ + + + + CSS Validator Binary Distribution - Illumit + + + +

CSS Validator Binary Distribution

+

This a binary distribution of W3C CSS Validator. + It was built from the source on June 25, 2006. + No modifications were made.

+ +

This distribution is provided as is to make testing a large number of CSS files easier.

+ + +

Requirements

+

A Java 2 Virtual Machine is required to use the validator. + You can download one from Sun if you do not have one installed.

+ +

Usage

+

Summary

+

java -jar ~/css-validator/css-validator.jar [-options] files URLs

+

Sample

+
+    java -jar ~/css-validator/css-validator.jar f1.css http://illumit.com/
+    
+

Options

+
+
-e
Show errors only.
+
-html
Output HTML.
+
-css1 | -css2 | -css21 | -css3 | -svg | -svgbasic | -svgtiny
+
Specify CSS version. CSS2 is the default.
+
+ +

Support

+ +

If you have questions about how this distribution is built or packaged, + mailto:contact@illumit.com.

+ +

Use the CSS Validator Feedback + page if you have any questions or problems with the validator itself.

+ +

Updates are announced on via + RSS

+ + + +

Download

+ +

Download the css validator binary distribution css-validator.zip. Extract the files (OS X and *ix users can use unzip).

+ + +

License Agreement

+ +

This is a binary distribution of W3C CSS Validator Version 2.0 + It was built from the source on June 25, 2006. + No modifications were made to the source.

+ +

THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND +ILLUMIT L.L.C AND THE COPYRIGHT HOLDERS (W3C) MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF +MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE +USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD +PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.

+ +

ILLUMIT L.L.C AND THE COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, +SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE +SOFTWARE OR DOCUMENTATION.

+ + + diff --git a/lib/compass/validate/XERCES_COPYING.txt b/lib/compass/validate/XERCES_COPYING.txt new file mode 100644 index 00000000..183b52c0 --- /dev/null +++ b/lib/compass/validate/XERCES_COPYING.txt @@ -0,0 +1,56 @@ +/* + * The Apache Software License, Version 1.1 + * + * + * Copyright (c) 1999 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Xerces" and "Apache Software Foundation" must + * not be used to endorse or promote products derived from this + * software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache", + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation and was + * originally based on software copyright (c) 1999, International + * Business Machines, Inc., http://www.ibm.com. For more + * information on the Apache Software Foundation, please see + * . + */ diff --git a/lib/compass/validate/css-validator-javadoc.jar b/lib/compass/validate/css-validator-javadoc.jar new file mode 100644 index 00000000..ed3d0302 Binary files /dev/null and b/lib/compass/validate/css-validator-javadoc.jar differ diff --git a/lib/compass/validate/css-validator.jar b/lib/compass/validate/css-validator.jar new file mode 100644 index 00000000..592b0406 Binary files /dev/null and b/lib/compass/validate/css-validator.jar differ diff --git a/lib/compass/validate/jigsaw.jar b/lib/compass/validate/jigsaw.jar new file mode 100644 index 00000000..53419d69 Binary files /dev/null and b/lib/compass/validate/jigsaw.jar differ diff --git a/lib/compass/validate/xerces.jar b/lib/compass/validate/xerces.jar new file mode 100644 index 00000000..f4708953 Binary files /dev/null and b/lib/compass/validate/xerces.jar differ diff --git a/lib/compass/validator.rb b/lib/compass/validator.rb new file mode 100644 index 00000000..3b95b83f --- /dev/null +++ b/lib/compass/validator.rb @@ -0,0 +1,59 @@ +require File.join(File.dirname(__FILE__), 'core_ext') +require File.join(File.dirname(__FILE__), 'constants') + +module Compass + # Validates generated CSS against the W3 using Java + class Validator + VALIDATOR_FILE = File.join(File.dirname(__FILE__), 'validate', 'css-validator.jar') + attr_reader :error_count + + def initialize + @error_count = 0 + end + + # Validates all three CSS files + def validate + java_path = `which java`.rstrip + raise "You do not have a Java installed, but it is required." if java_path.blank? + + output_header + + Dir.new(Compass::Constants::BLUEPRINT_ROOT_PATH).each do |file_name| + puts "#{file_name}" + if file_name =~ /\.css$/ + css_file = File.join(Compass::Constants::BLUEPRINT_ROOT_PATH, file_name) + @error_count += 1 if !validate_css_file(java_path, css_file) + end + end + + output_footer + end + + private + def validate_css_file(java_path, css_file) + puts "\n\n Testing #{css_file}" + puts " Output ============================================================\n\n" + system("#{java_path} -jar '#{VALIDATOR_FILE}' -e '#{css_file}'") + end + + def output_header + puts "\n\n" + puts " ************************************************************" + puts " **" + puts " ** Compass CSS Validator" + puts " ** Validates output CSS files" + puts " **" + puts " ************************************************************" + end + + def output_footer + puts "\n\n" + puts " ************************************************************" + puts " **" + puts " ** Done!" + puts " ** Your CSS files are#{" not" if error_count > 0} valid.#{" You had #{error_count} error(s) within your files" if error_count > 0}" + puts " **" + puts " ************************************************************" + end + end +end \ No newline at end of file diff --git a/lib/compass/version.rb b/lib/compass/version.rb new file mode 100644 index 00000000..43bee2eb --- /dev/null +++ b/lib/compass/version.rb @@ -0,0 +1,48 @@ +module Compass + module Version + # Returns a hash representing the version. + # The :major, :minor, and :teeny keys have their respective numbers. + # The :string key contains a human-readable string representation of the version. + # If checked out from Git, + # the :rev key will have the revision hash. + # + # This method swiped from Haml and then modified, some credit goes to Nathan Weizenbaum + attr_writer :version + def version + return @version if defined?(@version) + + @version = { + :string => File.read(scope('VERSION')).strip + } + dotted_string, label = @version[:string].split(/-/, 2) + numbers = dotted_string.split('.').map { |n| n.to_i } + @version[:major] = numbers[0] + @version[:minor] = numbers[1] + @version[:teeny] = numbers[2] + @version[:label] = label + + if File.exists?(scope('REVISION')) + rev = File.read(scope('REVISION')).strip + rev = nil if rev !~ /[a-f0-9]+/ + end + + if rev.nil? && File.exists?(scope('.git/HEAD')) + rev = File.read(scope('.git/HEAD')).strip + if rev =~ /^ref: (.*)$/ + rev = File.read(scope(".git/#{$1}")).strip + end + end + + if rev + @version[:rev] = rev + @version[:string] << " [#{rev[0...7]}]" + end + + @version + end + + def scope(file) # :nodoc: + File.join(File.dirname(__FILE__), '..', '..', file) + end + end +end diff --git a/test/compass_test.rb b/test/compass_test.rb new file mode 100644 index 00000000..42436fc4 --- /dev/null +++ b/test/compass_test.rb @@ -0,0 +1,111 @@ +require File.dirname(__FILE__)+'/test_helper' +require 'fileutils' +require 'compass' + +class CompassTest < Test::Unit::TestCase + def setup + Dir.glob("fixtures/*/templates").each do |dirname| + dirname = dirname[9..-11] + mkdir_clean tempfile_loc(dirname) + end + mkdir_clean absolutize("tmp") + mkdir_clean absolutize("tmp/blueprint") + mkdir_clean tempfile_loc("default") + end + + def teardown + FileUtils.rm_r absolutize("tmp/blueprint") + Dir.glob("fixtures/*/templates").each do |dirname| + dirname = dirname[9..-11] + FileUtils.rm_r tempfile_loc(dirname) + end + end + + def test_blueprint_generates_no_files + Sass::Plugin.options[:template_location][template_loc('default')] = tempfile_loc('default') + Sass::Plugin.update_stylesheets + + Dir.new(absolutize("tmp/blueprint")).each do |f| + fail "This file is not expected: #{f}" unless f == "." || f == ".." + end + + end + + def test_default + with_templates('default') do + each_css_file(tempfile_loc('default')) do |css_file| + assert_no_errors css_file, 'default' + end + end + end + + private + def assert_no_errors(css_file, folder) + file = css_file[(tempfile_loc(folder).size+1)..-1] + msg = "Syntax Error found in #{file}. Results saved into #{save_loc(folder)}/#{file}" + assert_equal 0, open(css_file).readlines.grep(/Sass::SyntaxError/).size, msg + end + + def with_templates(folder) + old_template_loc = Sass::Plugin.options[:template_location].dup + begin + Sass::Plugin.options[:template_location][template_loc(folder)] = tempfile_loc(folder) + Compass::Frameworks::ALL.each do |framework| + Sass::Plugin.options[:template_location][framework.stylesheets_directory] = tempfile_loc(folder) + end + Sass::Plugin.update_stylesheets + yield + ensure + Sass::Plugin.options[:template_location] = old_template_loc + end + rescue + save_output(folder) + raise + end + + def each_css_file(dir) + Dir.glob("#{dir}/**/*.css").each do |css_file| + yield css_file + end + end + + def save_output(dir) + FileUtils.rm_rf(save_loc(dir)) + FileUtils.cp_r(tempfile_loc(dir), save_loc(dir)) + end + + def mkdir_clean(dir) + begin + FileUtils.mkdir dir + rescue Errno::EEXIST + FileUtils.rm_r dir + FileUtils.mkdir dir + end + end + + def tempfile_loc(folder) + absolutize("fixtures/#{folder}/tmp") + end + + def template_loc(folder) + absolutize("fixtures/#{folder}/templates") + end + + def result_loc(folder) + absolutize("fixtures/#{folder}/results") + end + + def save_loc(folder) + absolutize("fixtures/#{folder}/saved") + end + + def absolutize(path) + if path.blank? + File.dirname(__FILE__) + elsif path[0] == ?/ + "#{File.dirname(__FILE__)}#{path}" + else + "#{File.dirname(__FILE__)}/#{path}" + end + end +end \ No newline at end of file diff --git a/test/fixtures/default/templates/ie.sass b/test/fixtures/default/templates/ie.sass new file mode 100644 index 00000000..9bb82459 --- /dev/null +++ b/test/fixtures/default/templates/ie.sass @@ -0,0 +1,4 @@ +@import blueprint/ie + +body + +blueprint-ie \ No newline at end of file diff --git a/test/fixtures/default/templates/print.sass b/test/fixtures/default/templates/print.sass new file mode 100644 index 00000000..f825831b --- /dev/null +++ b/test/fixtures/default/templates/print.sass @@ -0,0 +1,4 @@ +@import blueprint/print + +body + +blueprint-print \ No newline at end of file diff --git a/test/fixtures/default/templates/screen.sass b/test/fixtures/default/templates/screen.sass new file mode 100644 index 00000000..7f2ef7c0 --- /dev/null +++ b/test/fixtures/default/templates/screen.sass @@ -0,0 +1,21 @@ +@import blueprint/screen +@import compass/reset + +html + +reset-html + +body + +blueprint + #main.container + #top + +column(24, last) + #middle + +column(24, last) + #left + +column(6) + #content + +column(12) + #right + +column(6, last) + #bottom + +column(24, last) diff --git a/test/test_helper.rb b/test/test_helper.rb new file mode 100644 index 00000000..d7db925b --- /dev/null +++ b/test/test_helper.rb @@ -0,0 +1,37 @@ +# allows testing with edge Rails by creating a test/rails symlink +RAILS_ROOT = linked_rails = File.dirname(__FILE__) + '/rails' +RAILS_ENV = 'test' + +need_gems = false +if File.exists?(linked_rails) && !$:.include?(linked_rails + '/activesupport/lib') + puts "[ using linked Rails ]" + $:.unshift linked_rails + '/activesupport/lib' + $:.unshift linked_rails + '/actionpack/lib' +else + need_gems = true +end + +# allows testing with edge Haml by creating a test/haml symlink +linked_haml = File.dirname(__FILE__) + '/haml' + +if File.exists?(linked_haml) && !$:.include?(linked_haml + '/lib') + puts "[ using linked Haml ]" + $:.unshift linked_haml + '/lib' +else + need_gems = true +end + +require 'rubygems' if need_gems + +require 'action_controller' +require 'action_view' +require 'haml' +require 'sass' +require 'sass/plugin' + + +require 'test/unit' + +Sass::Plugin.options[:template_location] = { + "#{File.dirname(__FILE__)}/../src" => "#{File.dirname(__FILE__)}/tmp/blueprint" +}