sass-rails 3.1.0.rc.5 → 3.1.0.rc.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile +1 -1
- data/lib/sass/rails.rb +10 -7
- data/lib/sass/rails/logger.rb +2 -0
- data/lib/sass/rails/railtie.rb +13 -0
- data/lib/sass/rails/template_handlers.rb +0 -4
- data/lib/sass/rails/version.rb +1 -1
- data/sass-rails.gemspec +2 -3
- data/test/sass_rails_test.rb +18 -21
- data/test/support/sass_rails_test_case.rb +7 -27
- data/test/test_helper.rb +1 -0
- metadata +5 -58
- data/lib/sass/rails/monkey_patches.rb +0 -36
data/.gitignore
CHANGED
data/Gemfile
CHANGED
@@ -3,9 +3,9 @@ source "http://rubygems.org"
|
|
3
3
|
# Specify your gem's dependencies in sass-rails.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
gem "rails", :git => "git://github.com/rails/rails.git", :branch => "3-1-stable"
|
7
6
|
gem "sfl", "~> 2.0"
|
8
7
|
gem "sprockets"
|
8
|
+
gem "mocha"
|
9
9
|
|
10
10
|
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
|
11
11
|
# gem 'ruby-debug'
|
data/lib/sass/rails.rb
CHANGED
@@ -1,13 +1,16 @@
|
|
1
1
|
module Sass
|
2
|
+
autoload :Script, 'sass/rails/helpers'
|
3
|
+
|
2
4
|
module Rails
|
5
|
+
autoload :CssCompressor, 'sass/rails/compressor'
|
6
|
+
autoload :Helpers, 'sass/rails/helpers'
|
7
|
+
autoload :Importer, 'sass/rails/importer'
|
8
|
+
autoload :Logger, 'sass/rails/logger'
|
9
|
+
autoload :Resolver, 'sass/rails/template_handlers'
|
10
|
+
autoload :SassTemplate, 'sass/rails/template_handlers'
|
11
|
+
autoload :ScssTemplate, 'sass/rails/template_handlers'
|
3
12
|
end
|
4
13
|
end
|
5
14
|
|
6
|
-
require 'sass/rails/compressor'
|
7
|
-
require 'sass/rails/logger'
|
8
|
-
require 'sass/rails/railtie'
|
9
|
-
require 'sass/rails/monkey_patches'
|
10
|
-
require 'sass/rails/helpers'
|
11
|
-
require 'sass/rails/importer'
|
12
|
-
require 'sass/rails/template_handlers'
|
13
15
|
require 'sass/rails/version'
|
16
|
+
require 'sass/rails/railtie'
|
data/lib/sass/rails/logger.rb
CHANGED
data/lib/sass/rails/railtie.rb
CHANGED
@@ -1,5 +1,10 @@
|
|
1
|
+
require 'sprockets/railtie'
|
2
|
+
|
1
3
|
module Sass::Rails
|
2
4
|
class Railtie < ::Rails::Railtie
|
5
|
+
module SassContext
|
6
|
+
attr_accessor :sass_config
|
7
|
+
end
|
3
8
|
config.sass = ActiveSupport::OrderedOptions.new
|
4
9
|
# Establish static configuration defaults
|
5
10
|
# Emit scss files during stylesheet generation of scaffold
|
@@ -17,6 +22,12 @@ module Sass::Rails
|
|
17
22
|
# Send Sass logs to Rails.logger
|
18
23
|
config.sass.logger = Sass::Rails::Logger.new
|
19
24
|
|
25
|
+
config.before_initialize do
|
26
|
+
require 'sprockets/engines'
|
27
|
+
Sprockets.register_engine '.sass', Sass::Rails::SassTemplate
|
28
|
+
Sprockets.register_engine '.scss', Sass::Rails::ScssTemplate
|
29
|
+
end
|
30
|
+
|
20
31
|
initializer :setup_sass do |app|
|
21
32
|
# Only emit one kind of syntax because though we have registered two kinds of generators
|
22
33
|
syntax = app.config.sass.preferred_syntax.to_sym
|
@@ -34,6 +45,8 @@ module Sass::Rails
|
|
34
45
|
# Display a stack trace in the css output when in development-like environments.
|
35
46
|
config.sass.full_exception = app.config.consider_all_requests_local
|
36
47
|
end
|
48
|
+
app.assets.context_class.extend(SassContext)
|
49
|
+
app.assets.context_class.sass_config = app.config.sass
|
37
50
|
end
|
38
51
|
|
39
52
|
initializer :setup_compression do |app|
|
data/lib/sass/rails/version.rb
CHANGED
data/sass-rails.gemspec
CHANGED
@@ -15,9 +15,8 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.rubyforge_project = "sass-rails"
|
16
16
|
|
17
17
|
s.add_runtime_dependency 'sass', '>= 3.1.4'
|
18
|
-
s.add_runtime_dependency 'railties', '~> 3.1.0.
|
19
|
-
s.add_runtime_dependency 'actionpack', '~> 3.1.0.
|
20
|
-
s.add_runtime_dependency 'sprockets', '>= 2.0.0.beta.9'
|
18
|
+
s.add_runtime_dependency 'railties', '~> 3.1.0.rc6'
|
19
|
+
s.add_runtime_dependency 'actionpack', '~> 3.1.0.rc6'
|
21
20
|
|
22
21
|
s.files = `git ls-files`.split("\n")
|
23
22
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
data/test/sass_rails_test.rb
CHANGED
@@ -22,24 +22,21 @@ class SassRailsTest < Sass::Rails::TestCase
|
|
22
22
|
assert_not_output(/conflict/)
|
23
23
|
end
|
24
24
|
end
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
assert_equal Sass::Rails::SassTemplate, Sprockets.engines[".sass"]
|
41
|
-
assert_equal Sass::Rails::ScssTemplate, Sprockets.engines[".scss"]
|
42
|
-
end
|
25
|
+
# DISABLED because we've removed the feature for now.
|
26
|
+
# test "scss template has correct dasherized css class for namespaced controllers" do
|
27
|
+
# within_rails_app "scss_project" do
|
28
|
+
# runcmd "rails generate controller foo/bar"
|
29
|
+
# assert_file_exists "app/assets/stylesheets/foo/bar.css.scss"
|
30
|
+
# assert_match /\.foo-bar/, File.read("app/assets/stylesheets/foo/bar.css.scss")
|
31
|
+
# end
|
32
|
+
# end
|
33
|
+
# test "sass template has correct dasherized css class for namespaced controllers" do
|
34
|
+
# within_rails_app "sass_project" do
|
35
|
+
# runcmd "rails generate controller foo/bar"
|
36
|
+
# assert_file_exists "app/assets/stylesheets/foo/bar.css.sass"
|
37
|
+
# assert_match /\.foo-bar/, File.read("app/assets/stylesheets/foo/bar.css.sass")
|
38
|
+
# end
|
39
|
+
# end
|
43
40
|
test "sprockets require works correctly" do
|
44
41
|
css_output = sprockets_render("scss_project", "css_application.css")
|
45
42
|
assert_match /globbed/, css_output
|
@@ -61,9 +58,9 @@ class SassRailsTest < Sass::Rails::TestCase
|
|
61
58
|
end
|
62
59
|
test "sass asset paths work" do
|
63
60
|
css_output = sprockets_render("scss_project", "application.css.scss")
|
64
|
-
assert_match css_output, %r{asset-path:\s*"/assets/rails.png"}
|
65
|
-
assert_match css_output, %r{asset-url:\s*url\(/assets/rails.png\)}
|
66
|
-
assert_match css_output, %r{image-url:\s*url\(/assets/rails.png\)}
|
61
|
+
assert_match css_output, %r{asset-path:\s*"/assets/rails.png"}, 'asset-path:\s*"/assets/rails.png"'
|
62
|
+
assert_match css_output, %r{asset-url:\s*url\(/assets/rails.png\)}, 'asset-url:\s*url\(/assets/rails.png\)'
|
63
|
+
assert_match css_output, %r{image-url:\s*url\(/assets/rails.png\)}, 'image-url:\s*url\(/assets/rails.png\)'
|
67
64
|
end
|
68
65
|
test "css compressor compresses" do
|
69
66
|
assert_equal "div{color:red}\n", Sass::Rails::CssCompressor.new.compress(<<CSS)
|
@@ -1,5 +1,10 @@
|
|
1
|
+
unless defined?(Bundler)
|
2
|
+
$stderr.puts "You didn't run bundle exec did you? Try again: bundle exec rake test"
|
3
|
+
exit 1
|
4
|
+
end
|
1
5
|
require 'fileutils'
|
2
6
|
require 'tmpdir'
|
7
|
+
require 'sprockets/helpers/rails_helper'
|
3
8
|
|
4
9
|
class Sass::Rails::TestCase < ActiveSupport::TestCase
|
5
10
|
|
@@ -32,34 +37,9 @@ class Sass::Rails::TestCase < ActiveSupport::TestCase
|
|
32
37
|
end
|
33
38
|
|
34
39
|
def sprockets_render(project, filename)
|
35
|
-
|
36
|
-
|
37
|
-
def self.assets=(assets)
|
38
|
-
@assets = assets
|
39
|
-
end
|
40
|
-
def self.assets
|
41
|
-
@assets
|
42
|
-
end
|
43
|
-
def self.sass_config
|
44
|
-
Sass::Rails::Railtie.config.sass
|
45
|
-
end
|
46
|
-
def config
|
47
|
-
@config ||= ActiveSupport::InheritableOptions.new
|
48
|
-
end
|
49
|
-
include Sprockets::Helpers::RailsHelper
|
50
|
-
def asset_paths_with_testing
|
51
|
-
paths = asset_paths_without_testing
|
52
|
-
unless paths.is_a?(TestAssetPaths)
|
53
|
-
paths.extend(TestAssetPaths)
|
54
|
-
paths.assets = self.class.assets
|
55
|
-
end
|
56
|
-
paths
|
57
|
-
end
|
58
|
-
alias_method_chain :asset_paths, :testing
|
40
|
+
within_rails_app(project) do
|
41
|
+
runcmd "ruby script/rails runner 'puts Rails.application.assets[#{filename.inspect}]'"
|
59
42
|
end
|
60
|
-
env.context_class.assets = env
|
61
|
-
env.paths << fixture_path("#{project}/app/assets/stylesheets")
|
62
|
-
env[filename].to_s
|
63
43
|
end
|
64
44
|
|
65
45
|
def assert_file_exists(filename)
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sass-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 15424111
|
5
4
|
prerelease: 6
|
6
|
-
|
7
|
-
- 3
|
8
|
-
- 1
|
9
|
-
- 0
|
10
|
-
- rc
|
11
|
-
- 5
|
12
|
-
version: 3.1.0.rc.5
|
5
|
+
version: 3.1.0.rc.6
|
13
6
|
platform: ruby
|
14
7
|
authors:
|
15
8
|
- wycats
|
@@ -18,7 +11,7 @@ autorequire:
|
|
18
11
|
bindir: bin
|
19
12
|
cert_chain: []
|
20
13
|
|
21
|
-
date: 2011-
|
14
|
+
date: 2011-08-16 00:00:00 -07:00
|
22
15
|
default_executable:
|
23
16
|
dependencies:
|
24
17
|
- !ruby/object:Gem::Dependency
|
@@ -29,11 +22,6 @@ dependencies:
|
|
29
22
|
requirements:
|
30
23
|
- - ">="
|
31
24
|
- !ruby/object:Gem::Version
|
32
|
-
hash: 11
|
33
|
-
segments:
|
34
|
-
- 3
|
35
|
-
- 1
|
36
|
-
- 4
|
37
25
|
version: 3.1.4
|
38
26
|
type: :runtime
|
39
27
|
version_requirements: *id001
|
@@ -45,14 +33,7 @@ dependencies:
|
|
45
33
|
requirements:
|
46
34
|
- - ~>
|
47
35
|
- !ruby/object:Gem::Version
|
48
|
-
|
49
|
-
segments:
|
50
|
-
- 3
|
51
|
-
- 1
|
52
|
-
- 0
|
53
|
-
- rc
|
54
|
-
- 1
|
55
|
-
version: 3.1.0.rc1
|
36
|
+
version: 3.1.0.rc6
|
56
37
|
type: :runtime
|
57
38
|
version_requirements: *id002
|
58
39
|
- !ruby/object:Gem::Dependency
|
@@ -63,34 +44,9 @@ dependencies:
|
|
63
44
|
requirements:
|
64
45
|
- - ~>
|
65
46
|
- !ruby/object:Gem::Version
|
66
|
-
|
67
|
-
segments:
|
68
|
-
- 3
|
69
|
-
- 1
|
70
|
-
- 0
|
71
|
-
- rc
|
72
|
-
- 1
|
73
|
-
version: 3.1.0.rc1
|
47
|
+
version: 3.1.0.rc6
|
74
48
|
type: :runtime
|
75
49
|
version_requirements: *id003
|
76
|
-
- !ruby/object:Gem::Dependency
|
77
|
-
name: sprockets
|
78
|
-
prerelease: false
|
79
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
80
|
-
none: false
|
81
|
-
requirements:
|
82
|
-
- - ">="
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
hash: 62196465
|
85
|
-
segments:
|
86
|
-
- 2
|
87
|
-
- 0
|
88
|
-
- 0
|
89
|
-
- beta
|
90
|
-
- 9
|
91
|
-
version: 2.0.0.beta.9
|
92
|
-
type: :runtime
|
93
|
-
version_requirements: *id004
|
94
50
|
description: Sass adapter for the Rails asset pipeline.
|
95
51
|
email:
|
96
52
|
- wycats@gmail.com
|
@@ -119,7 +75,6 @@ files:
|
|
119
75
|
- lib/sass/rails/helpers.rb
|
120
76
|
- lib/sass/rails/importer.rb
|
121
77
|
- lib/sass/rails/logger.rb
|
122
|
-
- lib/sass/rails/monkey_patches.rb
|
123
78
|
- lib/sass/rails/railtie.rb
|
124
79
|
- lib/sass/rails/template_handlers.rb
|
125
80
|
- lib/sass/rails/version.rb
|
@@ -237,25 +192,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
237
192
|
requirements:
|
238
193
|
- - ">="
|
239
194
|
- !ruby/object:Gem::Version
|
240
|
-
hash: 3
|
241
|
-
segments:
|
242
|
-
- 0
|
243
195
|
version: "0"
|
244
196
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
245
197
|
none: false
|
246
198
|
requirements:
|
247
199
|
- - ">"
|
248
200
|
- !ruby/object:Gem::Version
|
249
|
-
hash: 25
|
250
|
-
segments:
|
251
|
-
- 1
|
252
|
-
- 3
|
253
|
-
- 1
|
254
201
|
version: 1.3.1
|
255
202
|
requirements: []
|
256
203
|
|
257
204
|
rubyforge_project: sass-rails
|
258
|
-
rubygems_version: 1.
|
205
|
+
rubygems_version: 1.5.3
|
259
206
|
signing_key:
|
260
207
|
specification_version: 3
|
261
208
|
summary: Sass adapter for the Rails asset pipeline.
|
@@ -1,36 +0,0 @@
|
|
1
|
-
module Sass::Rails::SassContext
|
2
|
-
attr_accessor :sass_config
|
3
|
-
end
|
4
|
-
|
5
|
-
module Sass::Rails::SprocketsConfig
|
6
|
-
def self.included(base)
|
7
|
-
base.alias_method_chain :asset_environment, :sass_config
|
8
|
-
end
|
9
|
-
|
10
|
-
def asset_environment_with_sass_config(app, *args)
|
11
|
-
env = asset_environment_without_sass_config(app, *args)
|
12
|
-
env.context_class.extend(Sass::Rails::SassContext)
|
13
|
-
env.context_class.sass_config = app.config.sass
|
14
|
-
env
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
begin
|
19
|
-
# Before sprockets was extracted from rails
|
20
|
-
require 'sprockets/railtie'
|
21
|
-
module Sprockets
|
22
|
-
class Railtie < ::Rails::Railtie
|
23
|
-
include Sass::Rails::SprocketsConfig
|
24
|
-
end
|
25
|
-
end
|
26
|
-
rescue LoadError
|
27
|
-
# After sprockets was extracted into sprockets-rails
|
28
|
-
require 'sprockets/rails/railtie'
|
29
|
-
module Sprockets
|
30
|
-
module Rails
|
31
|
-
class Railtie < ::Rails::Railtie
|
32
|
-
include Sass::Rails::SprocketsConfig
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|