adrianss-compass-oocss-plugin 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,24 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+ require 'sass'
3
+ require 'compass-oocss-plugin'
4
+
5
+
6
+ describe "sass extensions" do
7
+
8
+ it "should enumerate" do
9
+ @sass_code = <<SASS
10
+ \#{enumerate(".ui-col-",1,5)}
11
+ background-color: #AAA
12
+ SASS
13
+
14
+ @css_code = <<CSS
15
+ .ui-col-1, .ui-col-2, .ui-col-3, .ui-col-4, .ui-col-5 {
16
+ background-color: #AAA; }
17
+ CSS
18
+ sass_engine = Sass::Engine.new(@sass_code)
19
+ output = sass_engine.render
20
+ output.should == @css_code
21
+ end
22
+
23
+
24
+ end
@@ -0,0 +1,4 @@
1
+ $TESTING=true
2
+ $:.push File.join(File.dirname(__FILE__), '..', 'lib')
3
+
4
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
@@ -0,0 +1,102 @@
1
+ module Compass::CommandLineHelper
2
+ def compass(*arguments)
3
+ options = arguments.last.is_a?(Hash) ? arguments.pop : {}
4
+ options[:wait] = 0.25
5
+ if block_given?
6
+ responder = Responder.new
7
+ yield responder
8
+ IO.popen("-", "w+") do |io|
9
+ if io
10
+ #parent process
11
+ output = ""
12
+ eof_at = nil
13
+ while !eof_at || (Time.now - eof_at < options[:wait])
14
+ if io.eof?
15
+ eof_at ||= Time.now
16
+ sleep 0.1
17
+ else
18
+ eof_at = nil
19
+ timeout(1) do
20
+ output << io.readpartial(1024)
21
+ end
22
+ prompt = output.split("\n").last
23
+ if response = responder.response_for(prompt)
24
+ io.puts response
25
+ end
26
+ end
27
+ end
28
+ responder.assert_required_responses!
29
+ @last_result = output
30
+ else
31
+ #child process
32
+ compass_execute *arguments
33
+ end
34
+ end
35
+ else
36
+ @last_result = capture_output do
37
+ compass_execute *arguments
38
+ end
39
+ end
40
+ rescue Timeout::Error
41
+ fail "Read from child process timed out"
42
+ end
43
+
44
+ class Responder
45
+ Response = Struct.new(:prompt, :text, :required, :responded)
46
+ def initialize
47
+ @responses = []
48
+ end
49
+ def respond_to(prompt, options = {})
50
+ @responses << Response.new(prompt, options[:with], options[:required])
51
+ end
52
+ def response_for(prompt)
53
+ response = @responses.detect{|r| r.prompt == prompt}
54
+ if response
55
+ response.responded = true
56
+ response.text
57
+ end
58
+ end
59
+ def assert_required_responses!
60
+ @responses.each do |response|
61
+ if response.required && !response.responded
62
+ raise "Prompt not encountered: \"#{response.prompt}\""
63
+ end
64
+ end
65
+ end
66
+ end
67
+
68
+ def assert_action_performed(action, path)
69
+ actions_found = []
70
+ @last_result.split("\n").each do |line|
71
+ line = line.split
72
+ return if line.first == action.to_s && line.last == path
73
+ actions_found << line.first if line.last == path
74
+ end
75
+ message = "Action #{action.inspect} was not performed on: #{path}."
76
+ message += "The following actions were performed: #{actions_found.join(", ")}" if actions_found.any?
77
+ puts @last_result
78
+ fail message
79
+ end
80
+
81
+ def within_tmp_directory(dir = "tmp")
82
+ d = absolutize(dir)
83
+ FileUtils.mkdir_p(d)
84
+ Dir.chdir(d) do
85
+ yield
86
+ end
87
+ ensure
88
+ FileUtils.rm_rf(d)
89
+ end
90
+
91
+ def capture_output
92
+ real_stdout, $stdout = $stdout, StringIO.new
93
+ yield
94
+ $stdout.string
95
+ ensure
96
+ $stdout = real_stdout
97
+ end
98
+
99
+ def compass_execute(*arguments)
100
+ Compass::Exec::Compass.new(arguments).run!
101
+ end
102
+ end
@@ -0,0 +1,63 @@
1
+ module Compass
2
+ module TestCaseHelper
3
+ def absolutize(path)
4
+ if path.blank?
5
+ File.dirname(__FILE__)
6
+ elsif path[0] == ?/
7
+ "#{File.dirname(__FILE__)}#{path}"
8
+ else
9
+ "#{File.dirname(__FILE__)}/#{path}"
10
+ end
11
+ end
12
+
13
+ def within_project(project_name)
14
+ @current_project = project_name
15
+ Compass.configuration.parse(configuration_file(project_name)) if File.exists?(configuration_file(project_name))
16
+ Compass.configuration.project_path = project_path(project_name)
17
+ args = Compass.configuration.to_compiler_arguments(:logger => Compass::NullLogger.new)
18
+ if Compass.configuration.sass_path && File.exists?(Compass.configuration.sass_path)
19
+ compiler = Compass::Compiler.new *args
20
+ compiler.run
21
+ end
22
+ yield Compass.configuration
23
+ rescue
24
+ save_output(project_name)
25
+ raise
26
+ end
27
+
28
+ def each_css_file(dir)
29
+ Dir.glob("#{dir}/**/*.css").each do |css_file|
30
+ yield css_file
31
+ end
32
+ end
33
+
34
+ def save_output(dir)
35
+ FileUtils.rm_rf(save_path(dir))
36
+ FileUtils.cp_r(tempfile_path(dir), save_path(dir)) if File.exists?(tempfile_path(dir))
37
+ end
38
+
39
+ def project_path(project_name)
40
+ absolutize("fixtures/stylesheets/#{project_name}")
41
+ end
42
+
43
+ def configuration_file(project_name)
44
+ File.join(project_path(project_name), "config.rb")
45
+ end
46
+
47
+ def tempfile_path(project_name)
48
+ File.join(project_path(project_name), "tmp")
49
+ end
50
+
51
+ def template_path(project_name)
52
+ File.join(project_path(project_name), "sass")
53
+ end
54
+
55
+ def result_path(project_name)
56
+ File.join(project_path(project_name), "css")
57
+ end
58
+
59
+ def save_path(project_name)
60
+ File.join(project_path(project_name), "saved")
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,81 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+ require 'sass'
3
+ require 'compass-oocss-plugin'
4
+
5
+ def compile_sass(sass_code)
6
+ sass_engine = Sass::Engine.new(sass_code)
7
+ output = sass_engine.render
8
+ end
9
+
10
+ describe "template system" do
11
+
12
+ it "should create a main content" do
13
+ sass_code = <<SASS
14
+ @import sass/oocss/template.sass
15
+
16
+ .principal
17
+ +main
18
+ SASS
19
+
20
+ css_code = <<CSS
21
+ .principal {
22
+ overflow: hidden;
23
+ _overflow: visible;
24
+ _zoom: 1; }
25
+ CSS
26
+ compile_sass(sass_code).should == css_code
27
+ end
28
+
29
+ it "should create left column styled" do
30
+ sass_code = <<SASS
31
+ @import sass/oocss/template.sass
32
+
33
+ .sidebar
34
+ +left_column
35
+ SASS
36
+
37
+ css_code = <<CSS
38
+ .sidebar {
39
+ float: left;
40
+ width: 250px;
41
+ _margin-right: -3px; }
42
+ CSS
43
+ compile_sass(sass_code).should == css_code
44
+ end
45
+
46
+
47
+ it "should create left column styled with size" do
48
+ sass_code = <<SASS
49
+ @import sass/oocss/template.sass
50
+ // yahoo column
51
+ .sidebar
52
+ +left_column(240px)
53
+ SASS
54
+
55
+ css_code = <<CSS
56
+ .sidebar {
57
+ float: left;
58
+ width: 240px;
59
+ _margin-right: -3px; }
60
+ CSS
61
+ compile_sass(sass_code).should == css_code
62
+ end
63
+
64
+ it "should create right column styled with size" do
65
+ sass_code = <<SASS
66
+ @import sass/oocss/template.sass
67
+ // yahoo column
68
+ .ad-bar
69
+ +right_column(300px)
70
+ SASS
71
+
72
+ css_code = <<CSS
73
+ .ad-bar {
74
+ float: right;
75
+ width: 300px;
76
+ _margin-left: -3px; }
77
+ CSS
78
+ compile_sass(sass_code).should == css_code
79
+ end
80
+
81
+ end
@@ -0,0 +1 @@
1
+ //@import partials/ie6
@@ -0,0 +1 @@
1
+ //@import partials/ie7
@@ -0,0 +1,6 @@
1
+ stylesheet 'screen.sass', :media => "screen, projection"
2
+ stylesheet 'ie6.sass', :media => "screen, projection", :condition => "lt IE 7"
3
+ stylesheet 'ie7.sass', :media => "screen, projection", :condition => "eq IE 7"
4
+ stylesheet 'print.sass', :media => "print"
5
+ stylesheet 'partials/_ie6hacks.sass'
6
+ stylesheet 'partials/_ie7hacks.sass'
@@ -0,0 +1 @@
1
+ // This file is made in order to separate hacks for internet explorer 6
@@ -0,0 +1 @@
1
+ // This file is made in order to separate hacks for internet explorer 7
File without changes
@@ -0,0 +1,9 @@
1
+ /* Reset
2
+ @import oocss/reset
3
+ /* Fonts
4
+ @import oocss/fonts
5
+
6
+ @import oocss/grids
7
+
8
+ /* Grids
9
+ +grids_scaffold
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: adrianss-compass-oocss-plugin
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Adrian Sanchez
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-09-23 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: chriseppstein-compass
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: spec
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "1.2"
34
+ version:
35
+ description: compass-oocss-plugin is a plugin for compass that incorporate oocss framework.
36
+ email: adrian.saz@gmail.com
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files:
42
+ - README
43
+ - LICENSE
44
+ files:
45
+ - LICENSE
46
+ - OOCSS-LICENSE
47
+ - README
48
+ - Rakefile
49
+ - lib/compass-oocss-plugin
50
+ - lib/compass-oocss-plugin/compass_plugin.rb
51
+ - lib/compass-oocss-plugin/sass_extensions.rb
52
+ - lib/compass-oocss-plugin.rb
53
+ - spec/compass-oocss-plugin_spec.rb
54
+ - spec/spec_helper.rb
55
+ - spec/sass_extensions_spec.rb
56
+ - spec/support
57
+ - spec/support/command_line_helper.rb
58
+ - spec/support/test_case_helper.rb
59
+ - spec/grids_system_spec.rb
60
+ - spec/template_system_spec.rb
61
+ - sass/oocss
62
+ - sass/oocss/_reset.sass
63
+ - sass/oocss/_talk_skins.sass
64
+ - sass/oocss/_libraries.sass
65
+ - sass/oocss/_mod_skins.sass
66
+ - sass/oocss/_talk.sass
67
+ - sass/oocss/_mod.sass
68
+ - sass/oocss/_content.sass
69
+ - sass/oocss/_grids_debug.sass
70
+ - sass/oocss/_template_debug.sass
71
+ - sass/oocss/_template.sass
72
+ - sass/oocss/_grids.sass
73
+ - sass/oocss/_fonts.sass
74
+ - sass/oocss/_mod_debug.sass
75
+ - templates/project
76
+ - templates/project/print.sass
77
+ - templates/project/ie6.sass
78
+ - templates/project/screen.sass
79
+ - templates/project/ie7.sass
80
+ - templates/project/manifest.rb
81
+ - templates/project/partials
82
+ - templates/project/partials/_ie7hacks.sass
83
+ - templates/project/partials/_ie6hacks.sass
84
+ has_rdoc: false
85
+ homepage:
86
+ licenses:
87
+ post_install_message:
88
+ rdoc_options:
89
+ - --line-numbers
90
+ - --inline-source
91
+ - --title
92
+ - Compass-oocss-plugin
93
+ - --main
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: "0"
101
+ version:
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: "0"
107
+ version:
108
+ requirements: []
109
+
110
+ rubyforge_project: compass-oocss-plugin
111
+ rubygems_version: 1.3.5
112
+ signing_key:
113
+ specification_version: 3
114
+ summary: compass-oocss-plugin is a plugin for compass that incorporate oocss framework.
115
+ test_files: []
116
+