sass-rails 3.1.7 → 3.2.0

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.
@@ -1,12 +1,6 @@
1
1
  CHANGELOG
2
2
  =========
3
3
 
4
- 3.1.5.rc.1 (Oct 16, 2011)
5
- ---------------------
6
- * Several bug fixes
7
- * Performance and bug fixes when compressing stylesheets
8
- * Update dependency to latest sass stable release to fix caching issues.
9
-
10
4
  3.1.2 (Sept 15, 2011)
11
5
  ---------------------
12
6
 
data/Gemfile CHANGED
@@ -4,7 +4,6 @@ source "http://rubygems.org"
4
4
  gemspec
5
5
 
6
6
  gem "sfl", "~> 2.0"
7
- gem "sprockets"
8
7
  gem "mocha"
9
8
 
10
9
  # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
@@ -21,12 +21,13 @@ properties that will be passed to Sass.
21
21
  config.sass.syntax = :nested
22
22
  end
23
23
 
24
- ## Important Note
24
+ ### Important Note
25
25
 
26
26
  Sprockets provides some directives that are placed inside of comments called `require`, `require_tree`, and
27
- `require_self`. **<span style="color:#c00">DO NOT USE THEM IN YOUR SASS/SCSS FILES.</span>** They are very
28
- primitive and do not work well with Sass files. Instead, use Sass's native `@import` directive which
29
- `sass-rails` has customized to integrate with the conventions of your rails projects.
27
+ `require_self`. **DO NOT USE THEM IN YOUR SASS/SCSS FILES.** They are very primitive and
28
+ do not work well with Sass files. Instead, use Sass's native `@import`
29
+ directive which `sass-rails` has customized to integrate with the
30
+ conventions of your rails projects.
30
31
 
31
32
  ### Options
32
33
 
@@ -52,21 +53,19 @@ The [list of supported options](http://sass-lang.com/docs/yardoc/file.SASS_REFER
52
53
  cascade ordering for imports that contain styles using this approach.
53
54
 
54
55
  * **Asset Helpers**. When using the asset pipeline, paths to assets must be rewritten.
55
- When referencing assets use the following asset helpers:
56
+ When referencing assets use the following asset helpers (underscored in Ruby, hyphenated
57
+ in Sass):
56
58
 
57
- * `asset_path($relative-asset-path, $asset-class)` - Returns a string to the asset.
58
- For example: `asset_path("rails.png", image)` becomes `"/assets/rails.png"`
59
- * `asset_url($relative-asset-path, $asset-class)` - Returns url reference to the asset.
60
-
61
- For example: `asset_url("rails.png", image)` becomes `url(/assets/rails.png)`
59
+ * `asset-path($relative-asset-path, $asset-class)` - Returns a string to the asset.
60
+ For example: `asset-path("rails.png", image)` becomes `"/assets/rails.png"`
61
+ * `asset-url($relative-asset-path, $asset-class)` - Returns url reference to the asset.
62
+ For example: `asset-url("rails.png", image)` becomes `url(/assets/rails.png)`
62
63
  * As a convenience, for each of the following asset classes there are
63
- corresponding `_path` and `_url` helpers:
64
+ corresponding `-path` and `-url` helpers:
64
65
  image, font, video, audio, javascript, stylesheet.
65
-
66
- For example: `image_url("rails.png")` becomes `url(/assets/rails.png)` and
67
- `image_path("rails.png")` becomes `"/assets/rails.png"`.
68
-
69
- * `asset_data_url($relative-asset-path)` - Returns url reference to the Base64-encoded asset at the specified path.
66
+ For example: `image-url("rails.png")` becomes `url(/assets/rails.png)` and
67
+ `image-path("rails.png")` becomes `"/assets/rails.png"`.
68
+ * `asset-data-url($relative-asset-path)` - Returns url reference to the Base64-encoded asset at the specified path.
70
69
  For example: `asset-data-url("rails.png")` becomes `url(data:image/png;base64,iVBORw0K...)`
71
70
 
72
71
  ## Running Tests
@@ -1,12 +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 :Importer, 'sass/rails/importer'
7
+ autoload :Logger, 'sass/rails/logger'
8
+ autoload :Resolver, 'sass/rails/template_handlers'
9
+ autoload :SassTemplate, 'sass/rails/template_handlers'
10
+ autoload :ScssTemplate, 'sass/rails/template_handlers'
3
11
  end
4
12
  end
5
13
 
6
- require 'sass/rails/compressor'
7
- require 'sass/rails/logger'
8
- require 'sass/rails/railtie'
9
- require 'sass/rails/helpers'
10
- require 'sass/rails/importer'
11
- require 'sass/rails/template_handlers'
12
14
  require 'sass/rails/version'
15
+ require 'sass/rails/helpers'
16
+ require 'sass/rails/railtie'
@@ -4,15 +4,11 @@ module Sass
4
4
  module Rails
5
5
  class CssCompressor
6
6
  def compress(css)
7
- if css.count("\n") > 2
8
- Sass::Engine.new(css,
9
- :syntax => :scss,
10
- :cache => false,
11
- :read_cache => false,
12
- :style => :compressed).render
13
- else
14
- css
15
- end
7
+ Sass::Engine.new(css,
8
+ :syntax => :scss,
9
+ :cache => false,
10
+ :read_cache => false,
11
+ :style => :compressed).render
16
12
  end
17
13
  end
18
14
  end
@@ -41,11 +41,6 @@ module Sass::Rails
41
41
  end
42
42
  end
43
43
 
44
- # Remove the sass middleware if it gets inadvertently enabled by applications.
45
- config.after_initialize do |app|
46
- app.config.middleware.delete(Sass::Plugin::Rack) if defined?(Sass::Plugin::Rack)
47
- end
48
-
49
44
  initializer :setup_sass, :group => :all do |app|
50
45
  # Only emit one kind of syntax because though we have registered two kinds of generators
51
46
  syntax = app.config.sass.preferred_syntax.to_sym
@@ -71,7 +66,7 @@ module Sass::Rails
71
66
 
72
67
  initializer :setup_compression, :group => :all do |app|
73
68
  if app.config.assets.compress
74
- app.config.sass.style = :compressed
69
+ # Use sass's css_compressor
75
70
  app.config.assets.css_compressor = CssCompressor.new
76
71
  end
77
72
  end
@@ -19,7 +19,7 @@ module Sass::Rails
19
19
  nil
20
20
  end
21
21
 
22
- def public_path(path, scope = nil)
22
+ def public_path(path, scope)
23
23
  context.asset_paths.compute_public_path(path, ::Rails.application.config.assets.prefix)
24
24
  end
25
25
 
@@ -72,17 +72,14 @@ module Sass::Rails
72
72
  options = sass_options_from_rails(scope)
73
73
  load_paths = (options[:load_paths] || []).dup
74
74
  load_paths.unshift(importer)
75
- resolver = Resolver.new(scope)
76
- css_filename = File.join(::Rails.public_path, ::Rails.application.config.assets.prefix, scope.logical_path) + ".css"
77
75
  options.merge(
78
76
  :filename => eval_file,
79
- :css_filename => css_filename,
80
77
  :line => line,
81
78
  :syntax => syntax,
82
79
  :importer => importer,
83
80
  :load_paths => load_paths,
84
81
  :custom => {
85
- :resolver => resolver
82
+ :resolver => Resolver.new(scope)
86
83
  }
87
84
  )
88
85
  end
@@ -1,5 +1,5 @@
1
1
  module Sass
2
2
  module Rails
3
- VERSION = "3.1.7"
3
+ VERSION = "3.2.0"
4
4
  end
5
5
  end
@@ -14,10 +14,9 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.rubyforge_project = "sass-rails"
16
16
 
17
- s.add_runtime_dependency 'sass', '>= 3.1.10'
18
- s.add_runtime_dependency 'railties', '~> 3.1.0'
19
- s.add_runtime_dependency 'actionpack', '~> 3.1.0'
20
- s.add_runtime_dependency 'tilt', '~> 1.3.2'
17
+ s.add_runtime_dependency 'sass', '~> 3.1.10'
18
+ s.add_runtime_dependency 'railties', '~> 3.2.0.beta'
19
+ s.add_runtime_dependency 'tilt', '~> 1.3'
21
20
 
22
21
  s.files = `git ls-files`.split("\n")
23
22
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -8,9 +8,11 @@ class SassRailsLoggerTest < Sass::Rails::TestCase
8
8
  end
9
9
  end
10
10
 
11
- test "sending a log messages to the sass logger writes to the environment log file" do
12
- within_rails_app "scss_project" do |app_root|
13
- [:debug, :warn, :info, :error, :trace].each do |level|
11
+ [:debug, :warn, :info, :error, :trace].each do |level|
12
+ test "sending a #{level} message to the sass logger writes to the environment log file" do
13
+ within_rails_app "scss_project" do
14
+ app_root = runcmd 'rails runner "print Rails.root"'
15
+
14
16
  message = "[#{level}]: sass message"
15
17
  runcmd %{rails runner "Sass::logger.log_level = :#{level}; Sass::logger.log(:#{level}, %Q|#{message}|)"}
16
18
 
@@ -59,16 +59,15 @@ class Sass::Rails::TestCase < ActiveSupport::TestCase
59
59
  #
60
60
  # Automatically changes back to the working directory
61
61
  # and removes the temp directory when done.
62
- def within_rails_app(name, without_gems = [], gem_options = $gem_options)
62
+ def within_rails_app(name, without_gems = [], gem_locations = $gem_locations)
63
63
  sourcedir = File.expand_path("../../fixtures/#{name}", __FILE__)
64
64
  Dir.mktmpdir do |tmpdir|
65
65
  FileUtils.cp_r "#{sourcedir}/.", tmpdir
66
66
  Dir.chdir(tmpdir) do
67
- gem_options.each {|name, options| modify_gem_entry name, options}
67
+ gem_locations.each {|name, path| modify_gem_location name, path}
68
68
  without_gems.each {|name| remove_gem name}
69
- FileUtils.rm("Gemfile.lock") if File.exist?("Gemfile.lock")
70
69
  runcmd "bundle install --verbose"
71
- yield tmpdir
70
+ yield
72
71
  end
73
72
  end
74
73
  end
@@ -82,29 +81,23 @@ class Sass::Rails::TestCase < ActiveSupport::TestCase
82
81
  end
83
82
  end
84
83
 
85
- def modify_gem_entry(gemname, options, gemfile = "Gemfile")
84
+ def modify_gem_location(gemname, path, gemfile = "Gemfile")
86
85
  found = false
87
86
  process_gemfile(gemfile) do |line|
88
87
  if line =~ /gem *(["'])#{Regexp.escape(gemname)}\1/
89
88
  found = true
90
- gem_entry(gemname, options) + "\n"
89
+ %Q{gem "#{gemname}", :path => #{path.inspect}\n}
91
90
  else
92
91
  line
93
92
  end
94
93
  end
95
94
  unless found
96
95
  File.open(gemfile, "a") do |f|
97
- f.print("\n#{gem_entry(gemname, options)}\n")
96
+ f.print(%Q{\ngem "#{gemname}", :path => #{path.inspect}\n})
98
97
  end
99
98
  end
100
99
  end
101
100
 
102
- def gem_entry(gemname, options)
103
- entry = %Q{gem "#{gemname}", "~> #{options[:version]}"}
104
- entry += ", :path => #{options[:path].inspect}" if options[:path]
105
- entry
106
- end
107
-
108
101
  def remove_gem(gemname)
109
102
  process_gemfile(gemfile) do |line|
110
103
  line unless line =~ /gem *(["'])#{Regexp.escape(gemname)}\1/
@@ -12,14 +12,14 @@ Rails.backtrace_cleaner.remove_silencers!
12
12
 
13
13
  # If developing against local dependencies, this code will ensure they get picked up
14
14
  # in the project fixtures that have their own bundle environment
15
- $gem_options = {}
15
+ $gem_locations = {}
16
16
  possible_dev_dependencies = %w(sass-rails sass rails actionpack railties sprockets)
17
17
  Bundler.load.specs.each do |s|
18
18
  if possible_dev_dependencies.include?(s.name)
19
19
  gem_path = s.full_gem_path
20
- gem_options = {:version => s.version}
21
- gem_options[:path] = gem_path if File.exists?("#{gem_path}/#{s.name}.gemspec")
22
- $gem_options[s.name] = gem_options
20
+ if File.exists?("#{gem_path}/#{s.name}.gemspec")
21
+ $gem_locations[s.name] = gem_path
22
+ end
23
23
  end
24
24
  end
25
25
 
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass-rails
3
3
  version: !ruby/object:Gem::Version
4
+ version: 3.2.0
4
5
  prerelease:
5
- version: 3.1.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - wycats
@@ -10,72 +10,41 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-01-17 00:00:00.000000000 Z
13
+ date: 2011-12-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- type: :runtime
17
- prerelease: false
18
16
  name: sass
19
- version_requirements: !ruby/object:Gem::Requirement
20
- none: false
21
- requirements:
22
- - - ! '>='
23
- - !ruby/object:Gem::Version
24
- version: 3.1.10
25
- requirement: !ruby/object:Gem::Requirement
17
+ requirement: &2152738300 !ruby/object:Gem::Requirement
26
18
  none: false
27
19
  requirements:
28
- - - ! '>='
20
+ - - ~>
29
21
  - !ruby/object:Gem::Version
30
22
  version: 3.1.10
31
- - !ruby/object:Gem::Dependency
32
23
  type: :runtime
33
24
  prerelease: false
25
+ version_requirements: *2152738300
26
+ - !ruby/object:Gem::Dependency
34
27
  name: railties
35
- version_requirements: !ruby/object:Gem::Requirement
28
+ requirement: &2152735040 !ruby/object:Gem::Requirement
36
29
  none: false
37
30
  requirements:
38
31
  - - ~>
39
32
  - !ruby/object:Gem::Version
40
- version: 3.1.0
41
- requirement: !ruby/object:Gem::Requirement
42
- none: false
43
- requirements:
44
- - - ~>
45
- - !ruby/object:Gem::Version
46
- version: 3.1.0
47
- - !ruby/object:Gem::Dependency
33
+ version: 3.2.0.beta
48
34
  type: :runtime
49
35
  prerelease: false
50
- name: actionpack
51
- version_requirements: !ruby/object:Gem::Requirement
52
- none: false
53
- requirements:
54
- - - ~>
55
- - !ruby/object:Gem::Version
56
- version: 3.1.0
57
- requirement: !ruby/object:Gem::Requirement
58
- none: false
59
- requirements:
60
- - - ~>
61
- - !ruby/object:Gem::Version
62
- version: 3.1.0
36
+ version_requirements: *2152735040
63
37
  - !ruby/object:Gem::Dependency
64
- type: :runtime
65
- prerelease: false
66
38
  name: tilt
67
- version_requirements: !ruby/object:Gem::Requirement
39
+ requirement: &2152732640 !ruby/object:Gem::Requirement
68
40
  none: false
69
41
  requirements:
70
42
  - - ~>
71
43
  - !ruby/object:Gem::Version
72
- version: 1.3.2
73
- requirement: !ruby/object:Gem::Requirement
74
- none: false
75
- requirements:
76
- - - ~>
77
- - !ruby/object:Gem::Version
78
- version: 1.3.2
44
+ version: '1.3'
45
+ type: :runtime
46
+ prerelease: false
47
+ version_requirements: *2152732640
79
48
  description: Sass adapter for the Rails asset pipeline.
80
49
  email:
81
50
  - wycats@gmail.com
@@ -265,22 +234,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
265
234
  requirements:
266
235
  - - ! '>='
267
236
  - !ruby/object:Gem::Version
268
- segments:
269
- - 0
270
- hash: 4507985399140691707
271
237
  version: '0'
272
238
  required_rubygems_version: !ruby/object:Gem::Requirement
273
239
  none: false
274
240
  requirements:
275
241
  - - ! '>='
276
242
  - !ruby/object:Gem::Version
277
- segments:
278
- - 0
279
- hash: 4507985399140691707
280
243
  version: '0'
281
244
  requirements: []
282
245
  rubyforge_project: sass-rails
283
- rubygems_version: 1.8.24
246
+ rubygems_version: 1.8.10
284
247
  signing_key:
285
248
  specification_version: 3
286
249
  summary: Sass adapter for the Rails asset pipeline.