Skip to content

Commit cd1bf9f

Browse files
committed
first pass at supporting multiple sprockets versions
1 parent fcf0a58 commit cd1bf9f

10 files changed

+379
-29
lines changed

.travis.yml

+7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
language: ruby
22

33
bundler_args: "--binstubs --standalone --without documentation --path ../bundle"
4+
45
script: "bundle exec rake test"
6+
7+
gemfile:
8+
- gemfiles/sprockets_2_12.gemfile
9+
- gemfiles/sprockets_3_0.gemfile
10+
511
rvm:
612
- 2.0.0
713
- 2.1.5
814
- 2.2.0
15+
916
notifications:
1017
email: false

Gemfile

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
source 'https://rubygems.org'
22

3+
# for working locally
4+
# gem "sassc", :path => "../sassc"
5+
36
# Specify your gem's dependencies in sassc-rails.gemspec
47
gemspec

Rakefile

+24
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,27 @@ task :test do
44
$LOAD_PATH.unshift('lib', 'test')
55
Dir.glob('./test/**/*_test.rb') { |f| require f }
66
end
7+
8+
namespace :tests do
9+
gemfiles = %w[
10+
sprockets_2_12
11+
sprockets_3_0
12+
]
13+
14+
gemfiles.each do |gemfile|
15+
desc "Run Tests against #{gemfile}"
16+
task gemfile do
17+
sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle --quiet"
18+
sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle exec rake test"
19+
end
20+
end
21+
22+
desc "Run Tests against all ORMs"
23+
task :all do
24+
gemfiles.each do |gemfile|
25+
puts "Running Tests against #{gemfile}"
26+
sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle --quiet"
27+
sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle exec rake test"
28+
end
29+
end
30+
end

gemfiles/sprockets_2_12.gemfile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source 'https://rubygems.org'
2+
3+
gem "sprockets", "~> 2.12.0"
4+
5+
# Specify your gem's dependencies in sassc-rails.gemspec
6+
gemspec path: "../"

gemfiles/sprockets_2_12.gemfile.lock

+135
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
PATH
2+
remote: ../
3+
specs:
4+
sassc-rails (0.0.5)
5+
rails (> 4.0.0)
6+
sass
7+
sassc (= 1.1.1)
8+
sprockets (> 2.11)
9+
tilt
10+
11+
GEM
12+
remote: https://rubygems.org/
13+
specs:
14+
actionmailer (4.2.1)
15+
actionpack (= 4.2.1)
16+
actionview (= 4.2.1)
17+
activejob (= 4.2.1)
18+
mail (~> 2.5, >= 2.5.4)
19+
rails-dom-testing (~> 1.0, >= 1.0.5)
20+
actionpack (4.2.1)
21+
actionview (= 4.2.1)
22+
activesupport (= 4.2.1)
23+
rack (~> 1.6)
24+
rack-test (~> 0.6.2)
25+
rails-dom-testing (~> 1.0, >= 1.0.5)
26+
rails-html-sanitizer (~> 1.0, >= 1.0.1)
27+
actionview (4.2.1)
28+
activesupport (= 4.2.1)
29+
builder (~> 3.1)
30+
erubis (~> 2.7.0)
31+
rails-dom-testing (~> 1.0, >= 1.0.5)
32+
rails-html-sanitizer (~> 1.0, >= 1.0.1)
33+
activejob (4.2.1)
34+
activesupport (= 4.2.1)
35+
globalid (>= 0.3.0)
36+
activemodel (4.2.1)
37+
activesupport (= 4.2.1)
38+
builder (~> 3.1)
39+
activerecord (4.2.1)
40+
activemodel (= 4.2.1)
41+
activesupport (= 4.2.1)
42+
arel (~> 6.0)
43+
activesupport (4.2.1)
44+
i18n (~> 0.7)
45+
json (~> 1.7, >= 1.7.7)
46+
minitest (~> 5.1)
47+
thread_safe (~> 0.3, >= 0.3.4)
48+
tzinfo (~> 1.1)
49+
arel (6.0.0)
50+
builder (3.2.2)
51+
coderay (1.1.0)
52+
erubis (2.7.0)
53+
ffi (1.9.8)
54+
globalid (0.3.5)
55+
activesupport (>= 4.1.0)
56+
hike (1.2.3)
57+
i18n (0.7.0)
58+
json (1.8.2)
59+
loofah (2.0.1)
60+
nokogiri (>= 1.5.9)
61+
mail (2.6.3)
62+
mime-types (>= 1.16, < 3)
63+
metaclass (0.0.4)
64+
method_source (0.8.2)
65+
mime-types (2.5)
66+
mini_portile (0.6.2)
67+
minitest (5.5.1)
68+
mocha (1.1.0)
69+
metaclass (~> 0.0.1)
70+
multi_json (1.11.0)
71+
nokogiri (1.6.6.2)
72+
mini_portile (~> 0.6.0)
73+
pry (0.10.1)
74+
coderay (~> 1.1.0)
75+
method_source (~> 0.8.1)
76+
slop (~> 3.4)
77+
rack (1.6.0)
78+
rack-test (0.6.3)
79+
rack (>= 1.0)
80+
rails (4.2.1)
81+
actionmailer (= 4.2.1)
82+
actionpack (= 4.2.1)
83+
actionview (= 4.2.1)
84+
activejob (= 4.2.1)
85+
activemodel (= 4.2.1)
86+
activerecord (= 4.2.1)
87+
activesupport (= 4.2.1)
88+
bundler (>= 1.3.0, < 2.0)
89+
railties (= 4.2.1)
90+
sprockets-rails
91+
rails-deprecated_sanitizer (1.0.3)
92+
activesupport (>= 4.2.0.alpha)
93+
rails-dom-testing (1.0.6)
94+
activesupport (>= 4.2.0.beta, < 5.0)
95+
nokogiri (~> 1.6.0)
96+
rails-deprecated_sanitizer (>= 1.0.1)
97+
rails-html-sanitizer (1.0.2)
98+
loofah (~> 2.0)
99+
railties (4.2.1)
100+
actionpack (= 4.2.1)
101+
activesupport (= 4.2.1)
102+
rake (>= 0.8.7)
103+
thor (>= 0.18.1, < 2.0)
104+
rake (10.4.2)
105+
sass (3.4.13)
106+
sassc (1.1.1)
107+
bundler
108+
ffi (~> 1.9.6)
109+
slop (3.6.0)
110+
sprockets (2.12.3)
111+
hike (~> 1.2)
112+
multi_json (~> 1.0)
113+
rack (~> 1.0)
114+
tilt (~> 1.1, != 1.3.0)
115+
sprockets-rails (2.2.4)
116+
actionpack (>= 3.0)
117+
activesupport (>= 3.0)
118+
sprockets (>= 2.8, < 4.0)
119+
thor (0.19.1)
120+
thread_safe (0.3.5)
121+
tilt (1.4.1)
122+
tzinfo (1.2.2)
123+
thread_safe (~> 0.1)
124+
125+
PLATFORMS
126+
ruby
127+
128+
DEPENDENCIES
129+
bundler (~> 1.7)
130+
minitest (~> 5.5.1)
131+
mocha
132+
pry
133+
rake (~> 10.0)
134+
sassc-rails!
135+
sprockets (~> 2.12.0)

gemfiles/sprockets_3_0.gemfile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source 'https://rubygems.org'
2+
3+
gem "sprockets", "~> 3.0.0"
4+
5+
# Specify your gem's dependencies in sassc-rails.gemspec
6+
gemspec path: "../"

gemfiles/sprockets_3_0.gemfile.lock

+130
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
PATH
2+
remote: ../
3+
specs:
4+
sassc-rails (0.0.5)
5+
rails (> 4.0.0)
6+
sass
7+
sassc (= 1.1.1)
8+
sprockets (> 2.11)
9+
tilt
10+
11+
GEM
12+
remote: https://rubygems.org/
13+
specs:
14+
actionmailer (4.2.1)
15+
actionpack (= 4.2.1)
16+
actionview (= 4.2.1)
17+
activejob (= 4.2.1)
18+
mail (~> 2.5, >= 2.5.4)
19+
rails-dom-testing (~> 1.0, >= 1.0.5)
20+
actionpack (4.2.1)
21+
actionview (= 4.2.1)
22+
activesupport (= 4.2.1)
23+
rack (~> 1.6)
24+
rack-test (~> 0.6.2)
25+
rails-dom-testing (~> 1.0, >= 1.0.5)
26+
rails-html-sanitizer (~> 1.0, >= 1.0.1)
27+
actionview (4.2.1)
28+
activesupport (= 4.2.1)
29+
builder (~> 3.1)
30+
erubis (~> 2.7.0)
31+
rails-dom-testing (~> 1.0, >= 1.0.5)
32+
rails-html-sanitizer (~> 1.0, >= 1.0.1)
33+
activejob (4.2.1)
34+
activesupport (= 4.2.1)
35+
globalid (>= 0.3.0)
36+
activemodel (4.2.1)
37+
activesupport (= 4.2.1)
38+
builder (~> 3.1)
39+
activerecord (4.2.1)
40+
activemodel (= 4.2.1)
41+
activesupport (= 4.2.1)
42+
arel (~> 6.0)
43+
activesupport (4.2.1)
44+
i18n (~> 0.7)
45+
json (~> 1.7, >= 1.7.7)
46+
minitest (~> 5.1)
47+
thread_safe (~> 0.3, >= 0.3.4)
48+
tzinfo (~> 1.1)
49+
arel (6.0.0)
50+
builder (3.2.2)
51+
coderay (1.1.0)
52+
erubis (2.7.0)
53+
ffi (1.9.8)
54+
globalid (0.3.5)
55+
activesupport (>= 4.1.0)
56+
i18n (0.7.0)
57+
json (1.8.2)
58+
loofah (2.0.1)
59+
nokogiri (>= 1.5.9)
60+
mail (2.6.3)
61+
mime-types (>= 1.16, < 3)
62+
metaclass (0.0.4)
63+
method_source (0.8.2)
64+
mime-types (2.5)
65+
mini_portile (0.6.2)
66+
minitest (5.5.1)
67+
mocha (1.1.0)
68+
metaclass (~> 0.0.1)
69+
nokogiri (1.6.6.2)
70+
mini_portile (~> 0.6.0)
71+
pry (0.10.1)
72+
coderay (~> 1.1.0)
73+
method_source (~> 0.8.1)
74+
slop (~> 3.4)
75+
rack (1.6.0)
76+
rack-test (0.6.3)
77+
rack (>= 1.0)
78+
rails (4.2.1)
79+
actionmailer (= 4.2.1)
80+
actionpack (= 4.2.1)
81+
actionview (= 4.2.1)
82+
activejob (= 4.2.1)
83+
activemodel (= 4.2.1)
84+
activerecord (= 4.2.1)
85+
activesupport (= 4.2.1)
86+
bundler (>= 1.3.0, < 2.0)
87+
railties (= 4.2.1)
88+
sprockets-rails
89+
rails-deprecated_sanitizer (1.0.3)
90+
activesupport (>= 4.2.0.alpha)
91+
rails-dom-testing (1.0.6)
92+
activesupport (>= 4.2.0.beta, < 5.0)
93+
nokogiri (~> 1.6.0)
94+
rails-deprecated_sanitizer (>= 1.0.1)
95+
rails-html-sanitizer (1.0.2)
96+
loofah (~> 2.0)
97+
railties (4.2.1)
98+
actionpack (= 4.2.1)
99+
activesupport (= 4.2.1)
100+
rake (>= 0.8.7)
101+
thor (>= 0.18.1, < 2.0)
102+
rake (10.4.2)
103+
sass (3.4.13)
104+
sassc (1.1.1)
105+
bundler
106+
ffi (~> 1.9.6)
107+
slop (3.6.0)
108+
sprockets (3.0.3)
109+
rack (~> 1.0)
110+
sprockets-rails (2.2.4)
111+
actionpack (>= 3.0)
112+
activesupport (>= 3.0)
113+
sprockets (>= 2.8, < 4.0)
114+
thor (0.19.1)
115+
thread_safe (0.3.5)
116+
tilt (2.0.1)
117+
tzinfo (1.2.2)
118+
thread_safe (~> 0.1)
119+
120+
PLATFORMS
121+
ruby
122+
123+
DEPENDENCIES
124+
bundler (~> 1.7)
125+
minitest (~> 5.5.1)
126+
mocha
127+
pry
128+
rake (~> 10.0)
129+
sassc-rails!
130+
sprockets (~> 3.0.0)

lib/sassc/rails/functions.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
require "sprockets/sass_template"
1+
require 'sprockets/sass_functions'
22

33
module Sprockets
4-
class SassTemplate
5-
module Functions
6-
def asset_data_url(path)
7-
SassC::Script::String.new("url(" + sprockets_context.asset_data_uri(path.value) + ")")
8-
end
4+
module SassFunctions
5+
def asset_data_url(path)
6+
SassC::Script::String.new("url(" + sprockets_context.asset_data_uri(path.value) + ")")
97
end
108
end
119
end
10+
11+
::SassC::Script::Functions.send :include, Sprockets::SassFunctions

0 commit comments

Comments
 (0)