sprockets-sass 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -4,3 +4,5 @@ Gemfile.lock
4
4
  gemfiles/*.lock
5
5
  pkg/*
6
6
  .sass-cache
7
+ .rspec
8
+ .ruby-version
data/Appraisals CHANGED
@@ -1,56 +1,75 @@
1
- appraise 'sprockets_2.0' do
2
- gem 'sprockets', '~> 2.0.0'
1
+ appraise 'sass_3.1' do
2
+ gem 'sass', '~> 3.1.0'
3
+ gem 'compass', '~> 0.12.0'
4
+ end
5
+
6
+ appraise 'compass_0.11' do
7
+ gem 'sass', '~> 3.2.0'
8
+ gem 'compass', '~> 0.11.0'
3
9
  end
4
10
 
5
11
  appraise 'sprockets_2.1' do
6
12
  gem 'sprockets', '~> 2.1.0'
13
+ gem 'sass', '~> 3.2.0'
14
+ gem 'compass', '~> 0.12.0'
7
15
  end
8
16
 
9
17
  appraise 'sprockets_2.2' do
10
18
  gem 'sprockets', '~> 2.2.0'
19
+ gem 'sass', '~> 3.2.0'
20
+ gem 'compass', '~> 0.12.0'
11
21
  end
12
22
 
13
23
  appraise 'sprockets_2.3' do
14
24
  gem 'sprockets', '~> 2.3.0'
25
+ gem 'sass', '~> 3.2.0'
26
+ gem 'compass', '~> 0.12.0'
15
27
  end
16
28
 
17
29
  appraise 'sprockets_2.4' do
18
30
  gem 'sprockets', '~> 2.4.0'
31
+ gem 'sass', '~> 3.2.0'
32
+ gem 'compass', '~> 0.12.0'
19
33
  end
20
34
 
21
35
  appraise 'sprockets_2.5' do
22
36
  gem 'sprockets', '~> 2.5.0'
37
+ gem 'sass', '~> 3.2.0'
38
+ gem 'compass', '~> 0.12.0'
23
39
  end
24
40
 
25
41
  appraise 'sprockets_2.6' do
26
42
  gem 'sprockets', '~> 2.6.0'
43
+ gem 'sass', '~> 3.2.0'
44
+ gem 'compass', '~> 0.12.0'
27
45
  end
28
46
 
29
47
  appraise 'sprockets_2.7' do
30
48
  gem 'sprockets', '~> 2.7.0'
49
+ gem 'sass', '~> 3.2.0'
50
+ gem 'compass', '~> 0.12.0'
31
51
  end
32
52
 
33
53
  appraise 'sprockets_2.8' do
34
54
  gem 'sprockets', '~> 2.8.0'
35
- gem 'sass', '~> 3.1.0'
55
+ gem 'sass', '~> 3.2.0'
56
+ gem 'compass', '~> 0.12.0'
36
57
  end
37
58
 
38
59
  appraise 'sprockets_2.9' do
39
60
  gem 'sprockets', '~> 2.9.0'
40
- end
41
-
42
- appraise 'sass_3.1' do
43
- gem 'sass', '~> 3.1.0'
44
- end
45
-
46
- appraise 'sass_3.2' do
47
61
  gem 'sass', '~> 3.2.0'
62
+ gem 'compass', '~> 0.12.0'
48
63
  end
49
64
 
50
- appraise 'compass_0.11' do
51
- gem 'compass', '~> 0.11.0'
65
+ appraise 'sprockets_2.10' do
66
+ gem 'sprockets', '~> 2.9.0'
67
+ gem 'sass', '~> 3.2.0'
68
+ gem 'compass', '~> 0.12.0'
52
69
  end
53
70
 
54
- appraise 'compass_0.12' do
71
+ appraise 'sprockets_2.11' do
72
+ gem 'sprockets', '~> 2.9.0'
73
+ gem 'sass', '~> 3.2.0'
55
74
  gem 'compass', '~> 0.12.0'
56
75
  end
data/Gemfile CHANGED
@@ -1,2 +1,2 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
  gemspec
@@ -1,7 +1,8 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source :rubygems
3
+ source "https://rubygems.org"
4
4
 
5
+ gem "sass", "~> 3.2.0"
5
6
  gem "compass", "~> 0.11.0"
6
7
 
7
8
  gemspec :path=>"../"
@@ -1,7 +1,8 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source :rubygems
3
+ source "https://rubygems.org"
4
4
 
5
5
  gem "sass", "~> 3.1.0"
6
+ gem "compass", "~> 0.12.0"
6
7
 
7
8
  gemspec :path=>"../"
@@ -1,7 +1,9 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source :rubygems
3
+ source "https://rubygems.org"
4
4
 
5
5
  gem "sprockets", "~> 2.1.0"
6
+ gem "sass", "~> 3.2.0"
7
+ gem "compass", "~> 0.12.0"
6
8
 
7
9
  gemspec :path=>"../"
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "sprockets", "~> 2.9.0"
6
+ gem "sass", "~> 3.2.0"
7
+ gem "compass", "~> 0.12.0"
8
+
9
+ gemspec :path=>"../"
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "sprockets", "~> 2.9.0"
6
+ gem "sass", "~> 3.2.0"
7
+ gem "compass", "~> 0.12.0"
8
+
9
+ gemspec :path=>"../"
@@ -1,7 +1,9 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source :rubygems
3
+ source "https://rubygems.org"
4
4
 
5
5
  gem "sprockets", "~> 2.2.0"
6
+ gem "sass", "~> 3.2.0"
7
+ gem "compass", "~> 0.12.0"
6
8
 
7
9
  gemspec :path=>"../"
@@ -1,7 +1,9 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source :rubygems
3
+ source "https://rubygems.org"
4
4
 
5
5
  gem "sprockets", "~> 2.3.0"
6
+ gem "sass", "~> 3.2.0"
7
+ gem "compass", "~> 0.12.0"
6
8
 
7
9
  gemspec :path=>"../"
@@ -1,7 +1,9 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source :rubygems
3
+ source "https://rubygems.org"
4
4
 
5
5
  gem "sprockets", "~> 2.4.0"
6
+ gem "sass", "~> 3.2.0"
7
+ gem "compass", "~> 0.12.0"
6
8
 
7
9
  gemspec :path=>"../"
@@ -1,7 +1,9 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source :rubygems
3
+ source "https://rubygems.org"
4
4
 
5
5
  gem "sprockets", "~> 2.5.0"
6
+ gem "sass", "~> 3.2.0"
7
+ gem "compass", "~> 0.12.0"
6
8
 
7
9
  gemspec :path=>"../"
@@ -1,7 +1,9 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source :rubygems
3
+ source "https://rubygems.org"
4
4
 
5
5
  gem "sprockets", "~> 2.6.0"
6
+ gem "sass", "~> 3.2.0"
7
+ gem "compass", "~> 0.12.0"
6
8
 
7
9
  gemspec :path=>"../"
@@ -1,7 +1,9 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source :rubygems
3
+ source "https://rubygems.org"
4
4
 
5
5
  gem "sprockets", "~> 2.7.0"
6
+ gem "sass", "~> 3.2.0"
7
+ gem "compass", "~> 0.12.0"
6
8
 
7
9
  gemspec :path=>"../"
@@ -1,8 +1,9 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source :rubygems
3
+ source "https://rubygems.org"
4
4
 
5
5
  gem "sprockets", "~> 2.8.0"
6
- gem "sass", "~> 3.1.0"
6
+ gem "sass", "~> 3.2.0"
7
+ gem "compass", "~> 0.12.0"
7
8
 
8
9
  gemspec :path=>"../"
@@ -1,7 +1,9 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source :rubygems
3
+ source "https://rubygems.org"
4
4
 
5
5
  gem "sprockets", "~> 2.9.0"
6
+ gem "sass", "~> 3.2.0"
7
+ gem "compass", "~> 0.12.0"
6
8
 
7
9
  gemspec :path=>"../"
@@ -6,14 +6,6 @@ module Sprockets
6
6
  class Importer < ::Sass::Importers::Base
7
7
  GLOB = /\*|\[.+\]/
8
8
 
9
- # Reference to the Sprockets context
10
- attr_reader :context
11
-
12
- #
13
- def initialize(context)
14
- @context = context
15
- end
16
-
17
9
  # @see Sass::Importers::Base#find_relative
18
10
  def find_relative(path, base_path, options)
19
11
  if path =~ GLOB
@@ -52,9 +44,10 @@ module Sprockets
52
44
 
53
45
  # Create a Sass::Engine from the given path.
54
46
  def engine_from_path(path, base_path, options)
55
- pathname = resolve(path, base_path) or return nil
47
+ context = options[:custom][:sprockets_context]
48
+ pathname = resolve(context, path, base_path) or return nil
56
49
  context.depend_on pathname
57
- ::Sass::Engine.new evaluate(pathname), options.merge(
50
+ ::Sass::Engine.new evaluate(context, pathname), options.merge(
58
51
  :filename => pathname.to_s,
59
52
  :syntax => syntax(pathname),
60
53
  :importer => self
@@ -64,7 +57,8 @@ module Sprockets
64
57
  # Create a Sass::Engine that will handle importing
65
58
  # a glob of files.
66
59
  def engine_from_glob(glob, base_path, options)
67
- imports = resolve_glob(glob, base_path).inject('') do |imports, path|
60
+ context = options[:custom][:sprockets_context]
61
+ imports = resolve_glob(context, glob, base_path).inject('') do |imports, path|
68
62
  context.depend_on path
69
63
  relative_path = path.relative_path_from Pathname.new(context.root_path)
70
64
  imports << %(@import "#{relative_path}";\n)
@@ -80,8 +74,8 @@ module Sprockets
80
74
  # Finds an asset from the given path. This is where
81
75
  # we make Sprockets behave like Sass, and import partial
82
76
  # style paths.
83
- def resolve(path, base_path)
84
- possible_files(path, base_path).each do |file|
77
+ def resolve(context, path, base_path)
78
+ possible_files(context, path, base_path).each do |file|
85
79
  context.resolve(file) { |found| return found if context.asset_requirable?(found) }
86
80
  end
87
81
 
@@ -89,7 +83,7 @@ module Sprockets
89
83
  end
90
84
 
91
85
  # Finds all of the assets using the given glob.
92
- def resolve_glob(glob, base_path)
86
+ def resolve_glob(context, glob, base_path)
93
87
  base_path = Pathname.new(base_path)
94
88
  path_with_glob = base_path.dirname.join(glob).to_s
95
89
 
@@ -100,7 +94,7 @@ module Sprockets
100
94
 
101
95
  # Returns all of the possible paths (including partial variations)
102
96
  # to attempt to resolve with the given path.
103
- def possible_files(path, base_path)
97
+ def possible_files(context, path, base_path)
104
98
  path = Pathname.new(path)
105
99
  base_path = Pathname.new(base_path).dirname
106
100
  root_path = Pathname.new(context.root_path)
@@ -132,7 +126,7 @@ module Sprockets
132
126
  # Returns the string to be passed to the Sass engine. We use
133
127
  # Sprockets to process the file, but we remove any Sass processors
134
128
  # because we need to let the Sass::Engine handle that.
135
- def evaluate(path)
129
+ def evaluate(context, path)
136
130
  attributes = context.environment.attributes_for(path)
137
131
  processors = context.environment.preprocessors(attributes.content_type) + attributes.engines.reverse
138
132
  processors.delete_if { |processor| processor < Tilt::SassTemplate }
@@ -71,11 +71,6 @@ module Sprockets
71
71
  end
72
72
  end
73
73
 
74
- # A reference to the custom Sass importer, `Sprockets::Sass::Importer`.
75
- def importer
76
- Importer.new context
77
- end
78
-
79
74
  # Assemble the options for the `Sass::Engine`
80
75
  def sass_options
81
76
  merge_sass_options(default_sass_options, options).merge(
@@ -83,7 +78,7 @@ module Sprockets
83
78
  :line => line,
84
79
  :syntax => syntax,
85
80
  :cache_store => cache_store,
86
- :importer => importer,
81
+ :importer => Importer.new,
87
82
  :custom => { :sprockets_context => context }
88
83
  )
89
84
  end
@@ -1,5 +1,5 @@
1
1
  module Sprockets
2
2
  module Sass
3
- VERSION = '1.0.3'
3
+ VERSION = '1.1.0'
4
4
  end
5
5
  end
data/spec/spec_helper.rb CHANGED
@@ -2,7 +2,7 @@ require 'sprockets'
2
2
  require 'sprockets-sass'
3
3
  require 'sprockets-helpers'
4
4
  require 'compass'
5
- require 'construct'
5
+ require 'test_construct'
6
6
 
7
7
  Compass.configuration do |compass|
8
8
  compass.line_comments = false
@@ -14,5 +14,5 @@ end
14
14
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
15
15
 
16
16
  RSpec.configure do |config|
17
- config.include Construct::Helpers
17
+ config.include TestConstruct::Helpers
18
18
  end
@@ -231,7 +231,11 @@ describe Sprockets::Sass do
231
231
  @assets.file 'main.css.scss', %($color: blue;\nbody { color: $color; })
232
232
 
233
233
  @env['main.css'].to_s
234
- sass_cache = cache.keys.detect { |key| key =~ /main\.css\.scss/ }
234
+ if Sass.version[:minor] > 2
235
+ sass_cache = cache.detect.detect { |key, value| value['pathname'] =~ /main\.css\.scss/ }
236
+ else
237
+ sass_cache = cache.keys.detect { |key| key =~ /main\.css\.scss/ }
238
+ end
235
239
  expect(sass_cache).to_not be_nil
236
240
  end
237
241
 
@@ -22,10 +22,10 @@ Gem::Specification.new do |s|
22
22
  s.add_dependency 'tilt', '~> 1.1'
23
23
  s.add_development_dependency 'appraisal', '~> 0.5'
24
24
  s.add_development_dependency 'rspec', '~> 2.13'
25
- s.add_development_dependency 'test-construct', '~> 1.2'
25
+ s.add_development_dependency 'test_construct', '~> 2.0'
26
26
  s.add_development_dependency 'sprockets-helpers', '~> 1.0'
27
- s.add_development_dependency 'sass', '~> 3.2'
28
- s.add_development_dependency 'compass', '~> 0.12'
27
+ s.add_development_dependency 'sass', '~> 3.3'
28
+ s.add_development_dependency 'compass', '~> 1.0.0.alpha.19'
29
29
  s.add_development_dependency 'rake'
30
30
  s.add_development_dependency 'pry'
31
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprockets-sass
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-26 00:00:00.000000000 Z
12
+ date: 2014-04-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sprockets
@@ -76,13 +76,13 @@ dependencies:
76
76
  - !ruby/object:Gem::Version
77
77
  version: '2.13'
78
78
  - !ruby/object:Gem::Dependency
79
- name: test-construct
79
+ name: test_construct
80
80
  requirement: !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
83
83
  - - ~>
84
84
  - !ruby/object:Gem::Version
85
- version: '1.2'
85
+ version: '2.0'
86
86
  type: :development
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
@@ -90,7 +90,7 @@ dependencies:
90
90
  requirements:
91
91
  - - ~>
92
92
  - !ruby/object:Gem::Version
93
- version: '1.2'
93
+ version: '2.0'
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: sprockets-helpers
96
96
  requirement: !ruby/object:Gem::Requirement
@@ -114,7 +114,7 @@ dependencies:
114
114
  requirements:
115
115
  - - ~>
116
116
  - !ruby/object:Gem::Version
117
- version: '3.2'
117
+ version: '3.3'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
@@ -122,7 +122,7 @@ dependencies:
122
122
  requirements:
123
123
  - - ~>
124
124
  - !ruby/object:Gem::Version
125
- version: '3.2'
125
+ version: '3.3'
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: compass
128
128
  requirement: !ruby/object:Gem::Requirement
@@ -130,7 +130,7 @@ dependencies:
130
130
  requirements:
131
131
  - - ~>
132
132
  - !ruby/object:Gem::Version
133
- version: '0.12'
133
+ version: 1.0.0.alpha.19
134
134
  type: :development
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
@@ -138,7 +138,7 @@ dependencies:
138
138
  requirements:
139
139
  - - ~>
140
140
  - !ruby/object:Gem::Version
141
- version: '0.12'
141
+ version: 1.0.0.alpha.19
142
142
  - !ruby/object:Gem::Dependency
143
143
  name: rake
144
144
  requirement: !ruby/object:Gem::Requirement
@@ -194,6 +194,8 @@ files:
194
194
  - gemfiles/sass_3.2.gemfile
195
195
  - gemfiles/sprockets_2.0.gemfile
196
196
  - gemfiles/sprockets_2.1.gemfile
197
+ - gemfiles/sprockets_2.10.gemfile
198
+ - gemfiles/sprockets_2.11.gemfile
197
199
  - gemfiles/sprockets_2.2.gemfile
198
200
  - gemfiles/sprockets_2.3.gemfile
199
201
  - gemfiles/sprockets_2.4.gemfile
@@ -230,7 +232,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
230
232
  version: '0'
231
233
  segments:
232
234
  - 0
233
- hash: 899970428098053938
235
+ hash: 3623172445139916864
234
236
  required_rubygems_version: !ruby/object:Gem::Requirement
235
237
  none: false
236
238
  requirements:
@@ -239,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
239
241
  version: '0'
240
242
  segments:
241
243
  - 0
242
- hash: 899970428098053938
244
+ hash: 3623172445139916864
243
245
  requirements: []
244
246
  rubyforge_project: sprockets-sass
245
247
  rubygems_version: 1.8.23