sass-rails 3.2.0 → 3.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,12 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.2
4
+ - 1.9.3
5
+ - ree
6
+ - jruby
7
+ - rbx
8
+ script: bundle exec rake test
9
+ notifications:
10
+ email: false
11
+ campfire:
12
+ secure: "CGWvthGkBKNnTnk9YSmf9AXKoiRI33fCl5D3jU4nx3cOPu6kv2R9nMjt9EAo\nOuS4Q85qNSf4VNQ2cUPNiNYSWQ+XiTfivKvDUw/QW9r1FejYyeWarMsSBWA+\n0fADjF1M2dkDIVLgYPfwoXEv7l+j654F1KLKB69F0F/netwP9CQ="
@@ -1,6 +1,12 @@
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
+
4
10
  3.1.2 (Sept 15, 2011)
5
11
  ---------------------
6
12
 
data/Gemfile CHANGED
@@ -3,6 +3,11 @@ source "http://rubygems.org"
3
3
  # Specify your gem's dependencies in sass-rails.gemspec
4
4
  gemspec
5
5
 
6
+ # Meanwhile we are depending on a non released rails version
7
+ gem "rails", :git => 'git://github.com/rails/rails.git'
8
+
9
+ gem "sqlite3"
10
+
6
11
  gem "sfl", "~> 2.0"
7
12
  gem "mocha"
8
13
 
@@ -21,13 +21,12 @@ 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`. **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.
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.
31
30
 
32
31
  ### Options
33
32
 
@@ -4,11 +4,15 @@ module Sass
4
4
  module Rails
5
5
  class CssCompressor
6
6
  def compress(css)
7
- Sass::Engine.new(css,
8
- :syntax => :scss,
9
- :cache => false,
10
- :read_cache => false,
11
- :style => :compressed).render
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
12
16
  end
13
17
  end
14
18
  end
@@ -58,15 +58,18 @@ module Sass::Rails
58
58
  # Display a stack trace in the css output when in development-like environments.
59
59
  config.sass.full_exception = app.config.consider_all_requests_local
60
60
  end
61
- app.assets.context_class.extend(SassContext)
62
- app.assets.context_class.sass_config = app.config.sass
61
+
62
+ if app.assets
63
+ app.assets.context_class.extend(SassContext)
64
+ app.assets.context_class.sass_config = app.config.sass
65
+ end
63
66
 
64
67
  Sass.logger = app.config.sass.logger
65
68
  end
66
69
 
67
70
  initializer :setup_compression, :group => :all do |app|
68
71
  if app.config.assets.compress
69
- # Use sass's css_compressor
72
+ app.config.sass.style = :compressed
70
73
  app.config.assets.css_compressor = CssCompressor.new
71
74
  end
72
75
  end
@@ -19,7 +19,7 @@ module Sass::Rails
19
19
  nil
20
20
  end
21
21
 
22
- def public_path(path, scope)
22
+ def public_path(path, scope = nil)
23
23
  context.asset_paths.compute_public_path(path, ::Rails.application.config.assets.prefix)
24
24
  end
25
25
 
@@ -72,14 +72,17 @@ 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, resolver.public_path(scope.logical_path)) + ".css"
75
77
  options.merge(
76
78
  :filename => eval_file,
79
+ :css_filename => css_filename,
77
80
  :line => line,
78
81
  :syntax => syntax,
79
82
  :importer => importer,
80
83
  :load_paths => load_paths,
81
84
  :custom => {
82
- :resolver => Resolver.new(scope)
85
+ :resolver => resolver
83
86
  }
84
87
  )
85
88
  end
@@ -1,5 +1,5 @@
1
1
  module Sass
2
2
  module Rails
3
- VERSION = "3.2.0"
3
+ VERSION = "3.2.1"
4
4
  end
5
5
  end
@@ -14,7 +14,7 @@ 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'
17
+ s.add_runtime_dependency 'sass', '>= 3.1.10'
18
18
  s.add_runtime_dependency 'railties', '~> 3.2.0.beta'
19
19
  s.add_runtime_dependency 'tilt', '~> 1.3'
20
20
 
@@ -8,11 +8,9 @@ class SassRailsLoggerTest < Sass::Rails::TestCase
8
8
  end
9
9
  end
10
10
 
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
-
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|
16
14
  message = "[#{level}]: sass message"
17
15
  runcmd %{rails runner "Sass::logger.log_level = :#{level}; Sass::logger.log(:#{level}, %Q|#{message}|)"}
18
16
 
@@ -59,15 +59,16 @@ 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_locations = $gem_locations)
62
+ def within_rails_app(name, without_gems = [], gem_options = $gem_options)
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_locations.each {|name, path| modify_gem_location name, path}
67
+ gem_options.each {|name, options| modify_gem_entry name, options}
68
68
  without_gems.each {|name| remove_gem name}
69
+ FileUtils.rm("Gemfile.lock") if File.exist?("Gemfile.lock")
69
70
  runcmd "bundle install --verbose"
70
- yield
71
+ yield tmpdir
71
72
  end
72
73
  end
73
74
  end
@@ -81,23 +82,29 @@ class Sass::Rails::TestCase < ActiveSupport::TestCase
81
82
  end
82
83
  end
83
84
 
84
- def modify_gem_location(gemname, path, gemfile = "Gemfile")
85
+ def modify_gem_entry(gemname, options, gemfile = "Gemfile")
85
86
  found = false
86
87
  process_gemfile(gemfile) do |line|
87
88
  if line =~ /gem *(["'])#{Regexp.escape(gemname)}\1/
88
89
  found = true
89
- %Q{gem "#{gemname}", :path => #{path.inspect}\n}
90
+ gem_entry(gemname, options) + "\n"
90
91
  else
91
92
  line
92
93
  end
93
94
  end
94
95
  unless found
95
96
  File.open(gemfile, "a") do |f|
96
- f.print(%Q{\ngem "#{gemname}", :path => #{path.inspect}\n})
97
+ f.print("\n#{gem_entry(gemname, options)}\n")
97
98
  end
98
99
  end
99
100
  end
100
101
 
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
+
101
108
  def remove_gem(gemname)
102
109
  process_gemfile(gemfile) do |line|
103
110
  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_locations = {}
15
+ $gem_options = {}
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
- if File.exists?("#{gem_path}/#{s.name}.gemspec")
21
- $gem_locations[s.name] = gem_path
22
- end
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
23
23
  end
24
24
  end
25
25
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,22 +10,22 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-12-17 00:00:00.000000000 Z
13
+ date: 2011-12-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: sass
17
- requirement: &2152738300 !ruby/object:Gem::Requirement
17
+ requirement: &2168607320 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
- - - ~>
20
+ - - ! '>='
21
21
  - !ruby/object:Gem::Version
22
22
  version: 3.1.10
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2152738300
25
+ version_requirements: *2168607320
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: railties
28
- requirement: &2152735040 !ruby/object:Gem::Requirement
28
+ requirement: &2168606380 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 3.2.0.beta
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2152735040
36
+ version_requirements: *2168606380
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: tilt
39
- requirement: &2152732640 !ruby/object:Gem::Requirement
39
+ requirement: &2168605260 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,7 +44,7 @@ dependencies:
44
44
  version: '1.3'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *2152732640
47
+ version_requirements: *2168605260
48
48
  description: Sass adapter for the Rails asset pipeline.
49
49
  email:
50
50
  - wycats@gmail.com
@@ -54,6 +54,7 @@ extensions: []
54
54
  extra_rdoc_files: []
55
55
  files:
56
56
  - .gitignore
57
+ - .travis.yml
57
58
  - CHANGELOG.md
58
59
  - Gemfile
59
60
  - MIT-LICENSE