sinatra-assetpack 0.0.6 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/HISTORY.md +24 -0
- data/README.md +3 -1
- data/Rakefile +8 -5
- data/lib/sinatra/assetpack.rb +11 -6
- data/lib/sinatra/assetpack/buster_helpers.rb +18 -3
- data/lib/sinatra/assetpack/class_methods.rb +2 -1
- data/lib/sinatra/assetpack/configurator.rb +13 -7
- data/lib/sinatra/assetpack/css.rb +3 -2
- data/lib/sinatra/assetpack/helpers.rb +1 -1
- data/lib/sinatra/assetpack/image.rb +22 -0
- data/lib/sinatra/assetpack/options.rb +20 -5
- data/lib/sinatra/assetpack/package.rb +6 -3
- data/lib/sinatra/assetpack/version.rb +1 -1
- data/sinatra-assetpack.gemspec +2 -0
- data/test/app/app/css/style.css +1 -0
- data/test/app/app/css/stylus.styl +3 -0
- data/test/app/app/css_stylus/stylus.styl +3 -0
- data/test/arity_test.rb +2 -2
- data/test/build_test.rb +1 -0
- data/test/img_test.rb +18 -0
- data/test/local_file_test.rb +22 -0
- data/test/non_existent_test.rb +46 -0
- data/test/options_test.rb +1 -2
- data/test/order_test.rb +2 -2
- data/test/preproc_test.rb +5 -0
- data/test/stylus_test.rb +24 -0
- data/test/test_helper.rb +9 -0
- data/test/tilt_test.rb +11 -0
- metadata +48 -20
data/.gitignore
CHANGED
data/HISTORY.md
CHANGED
@@ -1,3 +1,27 @@
|
|
1
|
+
v0.0.8 - Sep 06, 2011
|
2
|
+
---------------------
|
3
|
+
|
4
|
+
### Fixed:
|
5
|
+
* Fixed the CSS preprocessing bug that gives invalid 'url()' properties to
|
6
|
+
non-existing images. Closes #1.
|
7
|
+
|
8
|
+
### Added:
|
9
|
+
* Allow adding CSS/JS files that don't exist. Closes #8.
|
10
|
+
* Support any Tilt-compatible CSS or JS engine. Related to #5.
|
11
|
+
|
12
|
+
### Changed:
|
13
|
+
* Default to '/assets/x.js' then using assets.css without a path. Inspiration
|
14
|
+
from Jammit.
|
15
|
+
* Ask browsers to cache assets for 1 month.
|
16
|
+
|
17
|
+
### Misc:
|
18
|
+
* Add a note on the ImageMagick requirement.
|
19
|
+
* Stop the 'img' helper from invoking ImageMagick more times than it needs to.
|
20
|
+
* Make "rake test!" abort when it encounters an error.
|
21
|
+
* Stylus tests to stub stylus compilation.
|
22
|
+
* Added .rvmrc and .sass-cache to gitignore.
|
23
|
+
* Allow overridable multiple RVM environments in tests.
|
24
|
+
|
1
25
|
v0.0.6 - Aug 30, 2011
|
2
26
|
---------------------
|
3
27
|
|
data/README.md
CHANGED
@@ -194,6 +194,7 @@ Images
|
|
194
194
|
|
195
195
|
To show images, use the `img` helper.
|
196
196
|
This automatically adds width, height, and a cache buster thingie.
|
197
|
+
ImageMagick is required to generate full image tags with width and height.
|
197
198
|
|
198
199
|
``` html
|
199
200
|
<!-- Original: --> <%= img '/images/email.png' %>
|
@@ -401,7 +402,8 @@ __Usage:__ `img 'SRC'`
|
|
401
402
|
__Usage:__ `img 'SRC', OPTIONS_HASH`
|
402
403
|
|
403
404
|
Shows an `<img>` tag from the given `SRC`. If the images is found in the asset
|
404
|
-
directories, `width` and `height` attributes
|
405
|
+
directories (and ImageMagick is available), `width` and `height` attributes
|
406
|
+
will be added.
|
405
407
|
|
406
408
|
If `OPTIONS_HASH` is given, they will we passed onto the `<img>` tag to be
|
407
409
|
generated as attributes.
|
data/Rakefile
CHANGED
@@ -1,11 +1,14 @@
|
|
1
|
-
desc "Invokes the test suite in multiple
|
2
|
-
task :test do
|
3
|
-
|
1
|
+
desc "Invokes the test suite in multiple RVM environments"
|
2
|
+
task :'test!' do
|
3
|
+
# Override this by adding RVM_TEST_ENVS=".." in .rvmrc
|
4
|
+
envs = ENV['RVM_TEST_ENVS'] || '1.9.2@sinatra,1.8.7@sinatra'
|
5
|
+
puts "* Testing in the following RVM environments: #{envs.gsub(',', ', ')}"
|
6
|
+
system "rvm #{envs} rake test" or abort
|
4
7
|
end
|
5
8
|
|
6
9
|
desc "Runs tests"
|
7
|
-
task :
|
10
|
+
task :test do
|
8
11
|
Dir['test/*_test.rb'].each { |f| load f }
|
9
12
|
end
|
10
13
|
|
11
|
-
task :default => :
|
14
|
+
task :default => :test
|
data/lib/sinatra/assetpack.rb
CHANGED
@@ -19,12 +19,17 @@ module Sinatra
|
|
19
19
|
|
20
20
|
# Returns a map of what MIME format each Tilt type returns.
|
21
21
|
def self.tilt_formats
|
22
|
-
@formats ||=
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
@formats ||= begin
|
23
|
+
hash = Hash.new
|
24
|
+
Tilt.mappings.each do |format, (engine, _)|
|
25
|
+
case engine.default_mime_type
|
26
|
+
when 'text/css' then hash[format] = 'css'
|
27
|
+
when 'application/javascript' then hash[format] = 'js'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
hash
|
32
|
+
end
|
28
33
|
end
|
29
34
|
|
30
35
|
# Returns the inverse of tilt_formats.
|
@@ -5,16 +5,31 @@ module Sinatra
|
|
5
5
|
# Returns the cache buster suffix for given file(s).
|
6
6
|
# This implementation somewhat obfuscates the mtime to not reveal deployment dates.
|
7
7
|
def cache_buster_hash(*files)
|
8
|
-
i = files
|
9
|
-
(i * 4567).to_s.reverse[0...6]
|
8
|
+
i = mtime_for(files)
|
9
|
+
(i * 4567).to_s.reverse[0...6] if i
|
10
|
+
end
|
11
|
+
|
12
|
+
# Returns the maximum mtime for a given list of files.
|
13
|
+
# It will return nil if none of them are found.
|
14
|
+
def mtime_for(files)
|
15
|
+
files.map { |f| File.mtime(f).to_i if f.is_a?(String) && File.file?(f) }.compact.max
|
10
16
|
end
|
11
17
|
|
12
18
|
# Adds a cache buster for the given path.
|
13
19
|
#
|
20
|
+
# The 2nd parameter (and beyond) are the files to take mtime from.
|
21
|
+
# If the files are not found, the paths will be left as they are.
|
22
|
+
#
|
14
23
|
# add_cache_buster('/images/email.png', '/var/www/x/public/images/email.png')
|
15
24
|
#
|
16
25
|
def add_cache_buster(path, *files)
|
17
|
-
|
26
|
+
hash = cache_buster_hash *files
|
27
|
+
|
28
|
+
if hash
|
29
|
+
path.gsub(/(\.[^.]+)$/) { |ext| ".#{hash}#{ext}" }
|
30
|
+
else
|
31
|
+
path
|
32
|
+
end
|
18
33
|
end
|
19
34
|
end
|
20
35
|
end
|
@@ -20,7 +20,7 @@ module Sinatra
|
|
20
20
|
assets.packages.each do |name, package|
|
21
21
|
get package.route_regex do
|
22
22
|
content_type package.type
|
23
|
-
last_modified package.mtime
|
23
|
+
last_modified package.mtime if package.mtime
|
24
24
|
|
25
25
|
settings.assets.cache[package.hash] ||= package.minify
|
26
26
|
end
|
@@ -40,6 +40,7 @@ module Sinatra
|
|
40
40
|
# Send headers
|
41
41
|
content_type fmt.to_sym
|
42
42
|
last_modified File.mtime(fn).to_i
|
43
|
+
expires 86400*30, :public
|
43
44
|
|
44
45
|
format = File.extname(fn)[1..-1]
|
45
46
|
|
@@ -1,14 +1,20 @@
|
|
1
1
|
module Sinatra
|
2
2
|
module AssetPack
|
3
3
|
module Configurator
|
4
|
-
def
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
def self.included(klass)
|
5
|
+
klass.extend ClassMethods
|
6
|
+
end
|
7
|
+
|
8
|
+
module ClassMethods
|
9
|
+
def attrib(name)
|
10
|
+
define_method(:"#{name}") { |*a|
|
11
|
+
value = a.first
|
12
|
+
self.instance_variable_set :"@#{name}", value unless value.nil?
|
13
|
+
self.instance_variable_get :"@#{name}"
|
14
|
+
}
|
10
15
|
|
11
|
-
|
16
|
+
alias_method(:"#{name}=", :"#{name}")
|
17
|
+
end
|
12
18
|
end
|
13
19
|
end
|
14
20
|
end
|
@@ -3,7 +3,8 @@ module Sinatra
|
|
3
3
|
module Css
|
4
4
|
def self.preproc(str, assets)
|
5
5
|
str.gsub(/url\(["']?(.*?)["']?\)/) { |url|
|
6
|
-
|
6
|
+
path = $1
|
7
|
+
file, options = path.split('?')
|
7
8
|
local = assets.local_file_for file
|
8
9
|
|
9
10
|
url = if local
|
@@ -13,7 +14,7 @@ module Sinatra
|
|
13
14
|
BusterHelpers.add_cache_buster(file, local)
|
14
15
|
end
|
15
16
|
else
|
16
|
-
|
17
|
+
path
|
17
18
|
end
|
18
19
|
|
19
20
|
"url(#{url})"
|
@@ -1,6 +1,28 @@
|
|
1
1
|
module Sinatra
|
2
2
|
module AssetPack
|
3
|
+
# An image.
|
4
|
+
#
|
5
|
+
# == Common usage
|
6
|
+
#
|
7
|
+
# i = Image['/app/images/background.png'] # Local file path
|
8
|
+
#
|
9
|
+
# i.dimensions # Tuple for [ width, height ]
|
10
|
+
# i.width
|
11
|
+
# i.height
|
12
|
+
#
|
13
|
+
# i.dimensions? # True if dimensions are available
|
14
|
+
# # (e.g., if ImageMagick is installed and working)
|
15
|
+
#
|
3
16
|
class Image
|
17
|
+
# Looks up an image.
|
18
|
+
# This makes each image only have one associated instance forever.
|
19
|
+
def self.[](fname)
|
20
|
+
fname = File.expand_path(fname) || fname
|
21
|
+
|
22
|
+
@cache ||= Hash.new
|
23
|
+
@cache[fname] ||= new fname
|
24
|
+
end
|
25
|
+
|
4
26
|
def initialize(file)
|
5
27
|
@file = file
|
6
28
|
end
|
@@ -34,11 +34,11 @@ module Sinatra
|
|
34
34
|
# a.local_path_for('/images/bg.gif')
|
35
35
|
# a.served?('/images/bg.gif')
|
36
36
|
#
|
37
|
-
# a.glob('/js/*.js', '/js/vendor/**/*.js')
|
37
|
+
# a.glob(['/js/*.js', '/js/vendor/**/*.js'])
|
38
38
|
# # Returns a HashArray of (local => remote)
|
39
39
|
#
|
40
40
|
class Options
|
41
|
-
|
41
|
+
include Configurator
|
42
42
|
|
43
43
|
def initialize(app, &blk)
|
44
44
|
@app = app
|
@@ -100,7 +100,7 @@ module Sinatra
|
|
100
100
|
|
101
101
|
# Account for "css :name, [ files ]"
|
102
102
|
elsif args[0].respond_to?(:each)
|
103
|
-
path = "/#{
|
103
|
+
path = "/assets/#{name}.#{type}" # /assets/foobar.css by default
|
104
104
|
files = args[0]
|
105
105
|
|
106
106
|
else
|
@@ -216,9 +216,24 @@ module Sinatra
|
|
216
216
|
end
|
217
217
|
|
218
218
|
# Returns an array of URI paths of those matching given globs.
|
219
|
-
|
219
|
+
#
|
220
|
+
# glob('spec')
|
221
|
+
# glob(['spec1', 'spec2' ...])
|
222
|
+
# glob('spec', preserve: true)
|
223
|
+
#
|
224
|
+
# If `preserve` is set to true, it will preserve any specs that are not
|
225
|
+
# wildcards that don't match anything.
|
226
|
+
#
|
227
|
+
def glob(match, options={})
|
228
|
+
|
229
|
+
match = [*match] # Force array-ness
|
230
|
+
|
220
231
|
paths = match.map { |spec|
|
221
|
-
|
232
|
+
if options[:preserve] && !spec.include?('*')
|
233
|
+
spec
|
234
|
+
else
|
235
|
+
files.keys.select { |f| File.fnmatch?(spec, f) }.sort
|
236
|
+
end
|
222
237
|
}.flatten
|
223
238
|
|
224
239
|
paths = paths.uniq
|
@@ -37,7 +37,7 @@ module Sinatra
|
|
37
37
|
|
38
38
|
# Returns a list of URIs
|
39
39
|
def paths_and_files
|
40
|
-
@assets.glob
|
40
|
+
@assets.glob @filespecs, :preserve => true
|
41
41
|
end
|
42
42
|
|
43
43
|
def files
|
@@ -49,7 +49,7 @@ module Sinatra
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def mtime
|
52
|
-
|
52
|
+
BusterHelpers.mtime_for(files)
|
53
53
|
end
|
54
54
|
|
55
55
|
# Returns the regex for the route, including cache buster crap.
|
@@ -92,7 +92,10 @@ module Sinatra
|
|
92
92
|
|
93
93
|
def combined
|
94
94
|
session = Rack::Test::Session.new(@assets.app)
|
95
|
-
paths.map { |path|
|
95
|
+
paths.map { |path|
|
96
|
+
result = session.get(path)
|
97
|
+
result.body if result.status == 200
|
98
|
+
}.join("\n")
|
96
99
|
end
|
97
100
|
|
98
101
|
def js?() @type == :js; end
|
data/sinatra-assetpack.gemspec
CHANGED
@@ -11,6 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.files = `git ls-files`.strip.split("\n")
|
12
12
|
s.executables = Dir["bin/*"].map { |f| File.basename(f) }
|
13
13
|
|
14
|
+
s.add_dependency "tilt", ">= 1.3.0"
|
14
15
|
s.add_dependency "sinatra"
|
15
16
|
s.add_dependency "jsmin"
|
16
17
|
s.add_dependency "rack-test"
|
@@ -20,4 +21,5 @@ Gem::Specification.new do |s|
|
|
20
21
|
s.add_development_dependency "coffee-script"
|
21
22
|
s.add_development_dependency "contest"
|
22
23
|
s.add_development_dependency "mocha"
|
24
|
+
s.add_development_dependency "stylus"
|
23
25
|
end
|
data/test/app/app/css/style.css
CHANGED
data/test/arity_test.rb
CHANGED
@@ -18,8 +18,8 @@ class ArityTest < UnitTest
|
|
18
18
|
|
19
19
|
test "arity in #assets" do
|
20
20
|
paths = App.assets.packages['a.css'].paths
|
21
|
-
|
22
|
-
["/css/screen.css", "/css/sqwishable.css", "/css/style.css", "/css/js2c.css"]
|
21
|
+
assert_equal paths,
|
22
|
+
[ "/css/screen.css", "/css/sqwishable.css", "/css/style.css", "/css/stylus.css", "/css/js2c.css" ]
|
23
23
|
|
24
24
|
assert App.assets.js_compression == :closure
|
25
25
|
assert App.assets.css_compression == :yui
|
data/test/build_test.rb
CHANGED
data/test/img_test.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require File.expand_path('../test_helper', __FILE__)
|
2
2
|
|
3
3
|
class ImgTest < UnitTest
|
4
|
+
Image = Sinatra::AssetPack::Image
|
5
|
+
|
4
6
|
test "get img" do
|
5
7
|
get '/images/email.png'
|
6
8
|
assert_equal last_response.headers['Content-Length'], File.size(r("/app/images/email.png")).to_s
|
@@ -10,4 +12,20 @@ class ImgTest < UnitTest
|
|
10
12
|
get '/images/email.893748.png'
|
11
13
|
assert_equal last_response.headers['Content-Length'], File.size(r("/app/images/email.png")).to_s
|
12
14
|
end
|
15
|
+
|
16
|
+
test "Image[]" do
|
17
|
+
i = Image['/app/images/email.png']
|
18
|
+
j = Image['/app/images/email.png']
|
19
|
+
|
20
|
+
assert j === i
|
21
|
+
end
|
22
|
+
|
23
|
+
test "Image[]" do
|
24
|
+
i = Image['/app/images/email.png']
|
25
|
+
j = Image['/app/images/email.png']
|
26
|
+
|
27
|
+
Image.any_instance.expects(:`).times(1)
|
28
|
+
j.dimensions
|
29
|
+
i.dimensions
|
30
|
+
end
|
13
31
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require File.expand_path('../test_helper', __FILE__)
|
2
|
+
|
3
|
+
class LocalFileTest < UnitTest
|
4
|
+
class App < Sinatra::Base
|
5
|
+
set :root, File.expand_path('../app', __FILE__)
|
6
|
+
register Sinatra::AssetPack
|
7
|
+
|
8
|
+
assets {
|
9
|
+
css :application, [ '/css/*.css' ]
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
13
|
+
test "local file for (in existing files)" do
|
14
|
+
fn = App.assets.local_file_for '/images/background.jpg'
|
15
|
+
assert_equal r('app/images/background.jpg'), fn
|
16
|
+
end
|
17
|
+
|
18
|
+
test "local file for (in nonexisting files)" do
|
19
|
+
fn = App.assets.local_file_for '/images/404.jpg'
|
20
|
+
assert fn.nil?
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require File.expand_path('../test_helper', __FILE__)
|
2
|
+
|
3
|
+
class NonExistentTest < UnitTest
|
4
|
+
class App < Sinatra::Base
|
5
|
+
set :root, File.expand_path('../app', __FILE__)
|
6
|
+
register Sinatra::AssetPack
|
7
|
+
|
8
|
+
assets do |a|
|
9
|
+
a.js :script, '/script.min.js', [
|
10
|
+
'/js/h*.js',
|
11
|
+
'/js/combine.js'
|
12
|
+
]
|
13
|
+
|
14
|
+
a.js_compression :closure
|
15
|
+
a.css_compression = :yui
|
16
|
+
end
|
17
|
+
|
18
|
+
get '/js/combine.js' do
|
19
|
+
"alert('Spin spin sugar');"
|
20
|
+
end
|
21
|
+
|
22
|
+
get '/' do
|
23
|
+
js :script
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def app
|
28
|
+
App
|
29
|
+
end
|
30
|
+
|
31
|
+
test "non-existent files in js helper" do
|
32
|
+
get '/'
|
33
|
+
assert body.include?('combine.js')
|
34
|
+
end
|
35
|
+
|
36
|
+
test "dev non-existent files in js helper" do
|
37
|
+
App.expects(:environment).returns(:development).times(1..100)
|
38
|
+
get '/'
|
39
|
+
assert body.include?('combine.js')
|
40
|
+
end
|
41
|
+
|
42
|
+
test "non-existent files in js minifier" do
|
43
|
+
get '/script.min.js'
|
44
|
+
assert body.include?('Spin spin sugar')
|
45
|
+
end
|
46
|
+
end
|
data/test/options_test.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require File.expand_path('../test_helper', __FILE__)
|
2
2
|
|
3
|
-
|
4
3
|
class OptionsTest < UnitTest
|
5
4
|
class App < Sinatra::Base
|
6
5
|
set :root, File.expand_path('../app', __FILE__)
|
@@ -18,6 +17,6 @@ class OptionsTest < UnitTest
|
|
18
17
|
|
19
18
|
test "options" do
|
20
19
|
assert App.assets.js_compression == :closure
|
21
|
-
assert App.assets.packages['application.css'].path == "/
|
20
|
+
assert App.assets.packages['application.css'].path == "/assets/application.css"
|
22
21
|
end
|
23
22
|
end
|
data/test/order_test.rb
CHANGED
@@ -15,7 +15,7 @@ class OrderTest < UnitTest
|
|
15
15
|
|
16
16
|
test "order" do
|
17
17
|
paths = App.assets.packages['a.css'].paths
|
18
|
-
|
19
|
-
["/css/screen.css", "/css/sqwishable.css", "/css/style.css", "/css/js2c.css"]
|
18
|
+
assert_equal paths.sort,
|
19
|
+
[ "/css/screen.css", "/css/sqwishable.css", "/css/style.css", "/css/stylus.css", "/css/js2c.css" ].sort
|
20
20
|
end
|
21
21
|
end
|
data/test/preproc_test.rb
CHANGED
@@ -11,6 +11,11 @@ class PreprocTest < UnitTest
|
|
11
11
|
assert body =~ %r{background.[0-9]+.jpg}
|
12
12
|
end
|
13
13
|
|
14
|
+
test "no cache-busting number for non-existent images" do
|
15
|
+
get '/css/style.css'
|
16
|
+
assert body.include?('background: url(/images/404.png)')
|
17
|
+
end
|
18
|
+
|
14
19
|
test "preproc on minify" do
|
15
20
|
get '/css/application.css'
|
16
21
|
assert body =~ %r{email.[0-9]+.png}
|
data/test/stylus_test.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.expand_path('../test_helper', __FILE__)
|
2
|
+
|
3
|
+
class StylusTest < UnitTest
|
4
|
+
class App < Sinatra::Base
|
5
|
+
set :root, File.expand_path('../app', __FILE__)
|
6
|
+
register Sinatra::AssetPack
|
7
|
+
|
8
|
+
assets do |a|
|
9
|
+
a.css :a, '/css/a.css', [
|
10
|
+
'/css/stylus.css'
|
11
|
+
]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def app
|
16
|
+
App
|
17
|
+
end
|
18
|
+
|
19
|
+
test "build" do
|
20
|
+
Stylus.expects(:compile).returns("body{background:#f00;color:#00f;}")
|
21
|
+
get '/css/stylus.css'
|
22
|
+
assert body.gsub(/[ \t\r\n]/, '') == "body{background:#f00;color:#00f;}"
|
23
|
+
end
|
24
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'contest'
|
2
2
|
require 'jsmin'
|
3
|
+
require 'tilt'
|
4
|
+
require 'stylus'
|
3
5
|
require 'rack/test'
|
4
6
|
require 'yaml'
|
5
7
|
require 'mocha'
|
@@ -23,6 +25,13 @@ class UnitTest < Test::Unit::TestCase
|
|
23
25
|
puts ""
|
24
26
|
end
|
25
27
|
|
28
|
+
def get(*a)
|
29
|
+
super *a
|
30
|
+
has_error = body.include?('sinatra.error')
|
31
|
+
d if has_error
|
32
|
+
assert ! has_error, "Found a Sinatra error."
|
33
|
+
end
|
34
|
+
|
26
35
|
def body
|
27
36
|
last_response.body.strip
|
28
37
|
end
|
data/test/tilt_test.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require File.expand_path('../test_helper', __FILE__)
|
2
|
+
|
3
|
+
class OptionsTest < UnitTest
|
4
|
+
test "tilt mappings" do
|
5
|
+
@formats = Sinatra::AssetPack.tilt_formats
|
6
|
+
assert @formats['sass'] == 'css'
|
7
|
+
assert @formats['scss'] == 'css'
|
8
|
+
assert @formats['coffee'] == 'js'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-assetpack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,23 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-09-06 00:00:00.000000000 +08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: tilt
|
17
|
+
requirement: &2164770720 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.3.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *2164770720
|
15
26
|
- !ruby/object:Gem::Dependency
|
16
27
|
name: sinatra
|
17
|
-
requirement: &
|
28
|
+
requirement: &2164770260 !ruby/object:Gem::Requirement
|
18
29
|
none: false
|
19
30
|
requirements:
|
20
31
|
- - ! '>='
|
@@ -22,10 +33,10 @@ dependencies:
|
|
22
33
|
version: '0'
|
23
34
|
type: :runtime
|
24
35
|
prerelease: false
|
25
|
-
version_requirements: *
|
36
|
+
version_requirements: *2164770260
|
26
37
|
- !ruby/object:Gem::Dependency
|
27
38
|
name: jsmin
|
28
|
-
requirement: &
|
39
|
+
requirement: &2164769760 !ruby/object:Gem::Requirement
|
29
40
|
none: false
|
30
41
|
requirements:
|
31
42
|
- - ! '>='
|
@@ -33,10 +44,10 @@ dependencies:
|
|
33
44
|
version: '0'
|
34
45
|
type: :runtime
|
35
46
|
prerelease: false
|
36
|
-
version_requirements: *
|
47
|
+
version_requirements: *2164769760
|
37
48
|
- !ruby/object:Gem::Dependency
|
38
49
|
name: rack-test
|
39
|
-
requirement: &
|
50
|
+
requirement: &2164769320 !ruby/object:Gem::Requirement
|
40
51
|
none: false
|
41
52
|
requirements:
|
42
53
|
- - ! '>='
|
@@ -44,10 +55,10 @@ dependencies:
|
|
44
55
|
version: '0'
|
45
56
|
type: :runtime
|
46
57
|
prerelease: false
|
47
|
-
version_requirements: *
|
58
|
+
version_requirements: *2164769320
|
48
59
|
- !ruby/object:Gem::Dependency
|
49
60
|
name: yui-compressor
|
50
|
-
requirement: &
|
61
|
+
requirement: &2164768860 !ruby/object:Gem::Requirement
|
51
62
|
none: false
|
52
63
|
requirements:
|
53
64
|
- - ! '>='
|
@@ -55,10 +66,10 @@ dependencies:
|
|
55
66
|
version: '0'
|
56
67
|
type: :development
|
57
68
|
prerelease: false
|
58
|
-
version_requirements: *
|
69
|
+
version_requirements: *2164768860
|
59
70
|
- !ruby/object:Gem::Dependency
|
60
71
|
name: sass
|
61
|
-
requirement: &
|
72
|
+
requirement: &2164768420 !ruby/object:Gem::Requirement
|
62
73
|
none: false
|
63
74
|
requirements:
|
64
75
|
- - ! '>='
|
@@ -66,10 +77,10 @@ dependencies:
|
|
66
77
|
version: '0'
|
67
78
|
type: :development
|
68
79
|
prerelease: false
|
69
|
-
version_requirements: *
|
80
|
+
version_requirements: *2164768420
|
70
81
|
- !ruby/object:Gem::Dependency
|
71
82
|
name: haml
|
72
|
-
requirement: &
|
83
|
+
requirement: &2164768000 !ruby/object:Gem::Requirement
|
73
84
|
none: false
|
74
85
|
requirements:
|
75
86
|
- - ! '>='
|
@@ -77,10 +88,10 @@ dependencies:
|
|
77
88
|
version: '0'
|
78
89
|
type: :development
|
79
90
|
prerelease: false
|
80
|
-
version_requirements: *
|
91
|
+
version_requirements: *2164768000
|
81
92
|
- !ruby/object:Gem::Dependency
|
82
93
|
name: coffee-script
|
83
|
-
requirement: &
|
94
|
+
requirement: &2164767500 !ruby/object:Gem::Requirement
|
84
95
|
none: false
|
85
96
|
requirements:
|
86
97
|
- - ! '>='
|
@@ -88,10 +99,10 @@ dependencies:
|
|
88
99
|
version: '0'
|
89
100
|
type: :development
|
90
101
|
prerelease: false
|
91
|
-
version_requirements: *
|
102
|
+
version_requirements: *2164767500
|
92
103
|
- !ruby/object:Gem::Dependency
|
93
104
|
name: contest
|
94
|
-
requirement: &
|
105
|
+
requirement: &2164767020 !ruby/object:Gem::Requirement
|
95
106
|
none: false
|
96
107
|
requirements:
|
97
108
|
- - ! '>='
|
@@ -99,10 +110,21 @@ dependencies:
|
|
99
110
|
version: '0'
|
100
111
|
type: :development
|
101
112
|
prerelease: false
|
102
|
-
version_requirements: *
|
113
|
+
version_requirements: *2164767020
|
103
114
|
- !ruby/object:Gem::Dependency
|
104
115
|
name: mocha
|
105
|
-
requirement: &
|
116
|
+
requirement: &2164766600 !ruby/object:Gem::Requirement
|
117
|
+
none: false
|
118
|
+
requirements:
|
119
|
+
- - ! '>='
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
type: :development
|
123
|
+
prerelease: false
|
124
|
+
version_requirements: *2164766600
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: stylus
|
127
|
+
requirement: &2164766180 !ruby/object:Gem::Requirement
|
106
128
|
none: false
|
107
129
|
requirements:
|
108
130
|
- - ! '>='
|
@@ -110,7 +132,7 @@ dependencies:
|
|
110
132
|
version: '0'
|
111
133
|
type: :development
|
112
134
|
prerelease: false
|
113
|
-
version_requirements: *
|
135
|
+
version_requirements: *2164766180
|
114
136
|
description: Package your assets for Sinatra.
|
115
137
|
email:
|
116
138
|
- rico@sinefunc.com
|
@@ -155,6 +177,8 @@ files:
|
|
155
177
|
- test/app/app/css/screen.sass
|
156
178
|
- test/app/app/css/sqwishable.css
|
157
179
|
- test/app/app/css/style.css
|
180
|
+
- test/app/app/css/stylus.styl
|
181
|
+
- test/app/app/css_stylus/stylus.styl
|
158
182
|
- test/app/app/images/background.jpg
|
159
183
|
- test/app/app/images/email.png
|
160
184
|
- test/app/app/js/hello.js
|
@@ -165,13 +189,17 @@ files:
|
|
165
189
|
- test/cache_test.rb
|
166
190
|
- test/helpers_test.rb
|
167
191
|
- test/img_test.rb
|
192
|
+
- test/local_file_test.rb
|
193
|
+
- test/non_existent_test.rb
|
168
194
|
- test/options_test.rb
|
169
195
|
- test/order_test.rb
|
170
196
|
- test/preproc_test.rb
|
171
197
|
- test/redundant_test.rb
|
172
198
|
- test/simplecss_test.rb
|
173
199
|
- test/sqwish_test.rb
|
200
|
+
- test/stylus_test.rb
|
174
201
|
- test/test_helper.rb
|
202
|
+
- test/tilt_test.rb
|
175
203
|
- test/unit_test.rb
|
176
204
|
- test/yui_test.rb
|
177
205
|
has_rdoc: true
|