sinatra-bundles 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -1
- data/VERSION +1 -1
- data/lib/sinatra/bundles/bundle.rb +36 -0
- data/lib/sinatra/bundles/helpers.rb +22 -0
- data/lib/sinatra/bundles/javascript_bundle.rb +37 -0
- data/lib/sinatra/bundles/stylesheet_bundle.rb +36 -0
- data/lib/sinatra/bundles.rb +4 -114
- data/sinatra-bundles.gemspec +11 -58
- data/spec/app.rb +1 -1
- data/spec/production_app.rb +1 -1
- data/spec/public/javascripts/eval.js +5 -0
- data/spec/sinatra-bundles_spec.rb +10 -1
- data/spec/spec_helper.rb +5 -6
- metadata +17 -57
- data/vendor/cache/sinatra-0.10.1.gem +0 -0
- data/vendor/gems/sinatra-0.10.1/AUTHORS +0 -43
- data/vendor/gems/sinatra-0.10.1/CHANGES +0 -467
- data/vendor/gems/sinatra-0.10.1/LICENSE +0 -22
- data/vendor/gems/sinatra-0.10.1/README.jp.rdoc +0 -552
- data/vendor/gems/sinatra-0.10.1/README.rdoc +0 -622
- data/vendor/gems/sinatra-0.10.1/Rakefile +0 -129
- data/vendor/gems/sinatra-0.10.1/lib/sinatra/base.rb +0 -1143
- data/vendor/gems/sinatra-0.10.1/lib/sinatra/images/404.png +0 -0
- data/vendor/gems/sinatra-0.10.1/lib/sinatra/images/500.png +0 -0
- data/vendor/gems/sinatra-0.10.1/lib/sinatra/main.rb +0 -28
- data/vendor/gems/sinatra-0.10.1/lib/sinatra/showexceptions.rb +0 -303
- data/vendor/gems/sinatra-0.10.1/lib/sinatra/tilt.rb +0 -509
- data/vendor/gems/sinatra-0.10.1/lib/sinatra.rb +0 -7
- data/vendor/gems/sinatra-0.10.1/sinatra.gemspec +0 -86
- data/vendor/gems/sinatra-0.10.1/test/base_test.rb +0 -160
- data/vendor/gems/sinatra-0.10.1/test/builder_test.rb +0 -65
- data/vendor/gems/sinatra-0.10.1/test/contest.rb +0 -64
- data/vendor/gems/sinatra-0.10.1/test/erb_test.rb +0 -81
- data/vendor/gems/sinatra-0.10.1/test/erubis_test.rb +0 -82
- data/vendor/gems/sinatra-0.10.1/test/extensions_test.rb +0 -100
- data/vendor/gems/sinatra-0.10.1/test/filter_test.rb +0 -195
- data/vendor/gems/sinatra-0.10.1/test/haml_test.rb +0 -90
- data/vendor/gems/sinatra-0.10.1/test/helper.rb +0 -76
- data/vendor/gems/sinatra-0.10.1/test/helpers_test.rb +0 -573
- data/vendor/gems/sinatra-0.10.1/test/mapped_error_test.rb +0 -186
- data/vendor/gems/sinatra-0.10.1/test/middleware_test.rb +0 -68
- data/vendor/gems/sinatra-0.10.1/test/request_test.rb +0 -33
- data/vendor/gems/sinatra-0.10.1/test/response_test.rb +0 -42
- data/vendor/gems/sinatra-0.10.1/test/result_test.rb +0 -98
- data/vendor/gems/sinatra-0.10.1/test/route_added_hook_test.rb +0 -59
- data/vendor/gems/sinatra-0.10.1/test/routing_test.rb +0 -878
- data/vendor/gems/sinatra-0.10.1/test/sass_test.rb +0 -79
- data/vendor/gems/sinatra-0.10.1/test/server_test.rb +0 -47
- data/vendor/gems/sinatra-0.10.1/test/sinatra_test.rb +0 -13
- data/vendor/gems/sinatra-0.10.1/test/static_test.rb +0 -87
- data/vendor/gems/sinatra-0.10.1/test/templates_test.rb +0 -155
- data/vendor/gems/sinatra-0.10.1/test/views/error.builder +0 -3
- data/vendor/gems/sinatra-0.10.1/test/views/error.erb +0 -3
- data/vendor/gems/sinatra-0.10.1/test/views/error.erubis +0 -3
- data/vendor/gems/sinatra-0.10.1/test/views/error.haml +0 -3
- data/vendor/gems/sinatra-0.10.1/test/views/error.sass +0 -2
- data/vendor/gems/sinatra-0.10.1/test/views/foo/hello.test +0 -1
- data/vendor/gems/sinatra-0.10.1/test/views/hello.builder +0 -1
- data/vendor/gems/sinatra-0.10.1/test/views/hello.erb +0 -1
- data/vendor/gems/sinatra-0.10.1/test/views/hello.erubis +0 -1
- data/vendor/gems/sinatra-0.10.1/test/views/hello.haml +0 -1
- data/vendor/gems/sinatra-0.10.1/test/views/hello.sass +0 -2
- data/vendor/gems/sinatra-0.10.1/test/views/hello.test +0 -1
- data/vendor/gems/sinatra-0.10.1/test/views/layout2.builder +0 -3
- data/vendor/gems/sinatra-0.10.1/test/views/layout2.erb +0 -2
- data/vendor/gems/sinatra-0.10.1/test/views/layout2.erubis +0 -2
- data/vendor/gems/sinatra-0.10.1/test/views/layout2.haml +0 -2
- data/vendor/gems/sinatra-0.10.1/test/views/layout2.test +0 -1
- data/vendor/specifications/sinatra-0.10.1.gemspec +0 -40
data/Rakefile
CHANGED
@@ -12,6 +12,7 @@ begin
|
|
12
12
|
gem.authors = ['Daniel Huckstep']
|
13
13
|
gem.add_dependency 'rainpress', '>= 0'
|
14
14
|
gem.add_dependency 'packr', '>= 0'
|
15
|
+
gem.add_dependency 'rack', '>= 1.0'
|
15
16
|
gem.add_dependency 'sinatra', '>= 1.0.a'
|
16
17
|
gem.add_development_dependency 'rspec', '>= 1.2.9'
|
17
18
|
gem.add_development_dependency 'rack-test', '>= 0.5.3'
|
@@ -48,4 +49,4 @@ rescue LoadError
|
|
48
49
|
task :yardoc do
|
49
50
|
abort 'YARD is not available. In order to run yardoc, you must: sudo gem install yard'
|
50
51
|
end
|
51
|
-
end
|
52
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Sinatra
|
2
|
+
module Bundles
|
3
|
+
# The base class for a bundle of files.
|
4
|
+
# The developer user sinatra-bundles should
|
5
|
+
# never have to deal with this directly
|
6
|
+
class Bundle
|
7
|
+
def initialize(app, files)
|
8
|
+
@app = app
|
9
|
+
@files = files
|
10
|
+
end
|
11
|
+
|
12
|
+
# Since we pass Bundles back as the body,
|
13
|
+
# this follows Rack standards and supports an each method
|
14
|
+
# to yield parts of the body, in our case, the files.
|
15
|
+
def each
|
16
|
+
@files.each do |f|
|
17
|
+
content = File.read(path(f))
|
18
|
+
content = compress(content) if @app.compress_bundles
|
19
|
+
# Include a new line to prevent weirdness at file boundaries
|
20
|
+
yield("#{content}\n")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
# The timestamp of the bundle, which is the newest file in the bundle.
|
27
|
+
#
|
28
|
+
# @return [Integer] The timestamp of the bundle
|
29
|
+
def stamp
|
30
|
+
@files.map do |f|
|
31
|
+
File.mtime(path(f))
|
32
|
+
end.sort.first.to_i
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Sinatra
|
2
|
+
module Bundles
|
3
|
+
# View helpers
|
4
|
+
module Helpers
|
5
|
+
# Emit a script tag for a javascript bundle
|
6
|
+
#
|
7
|
+
# @param [Symbol,String] bundle The bundle name
|
8
|
+
# @return [String] HTML script tag
|
9
|
+
def javascript_bundle_include_tag(bundle)
|
10
|
+
options.javascript_bundles[bundle].to_html(bundle)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Emit a script tag for a stylesheet bundle
|
14
|
+
#
|
15
|
+
# @param [Symbol,String] bundle The bundle name
|
16
|
+
# @return [String] HTML link tag
|
17
|
+
def stylesheet_bundle_link_tag(bundle)
|
18
|
+
options.stylesheet_bundles[bundle].to_html(bundle)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'sinatra/bundles/bundle'
|
2
|
+
require 'packr'
|
3
|
+
|
4
|
+
module Sinatra
|
5
|
+
module Bundles
|
6
|
+
# Bundle for javascripts
|
7
|
+
class JavascriptBundle < Bundle
|
8
|
+
# Generate the HTML tag for the script file
|
9
|
+
#
|
10
|
+
# @param [String] name The name of a bundle
|
11
|
+
# @return [String] The HTML that can be inserted into the doc
|
12
|
+
def to_html(name)
|
13
|
+
"<script type='text/javascript' src='/javascripts/bundles/#{name}.js#{@app.stamp_bundles ? "?#{stamp}" : ''}'></script>"
|
14
|
+
end
|
15
|
+
|
16
|
+
protected
|
17
|
+
|
18
|
+
# Compress Javascript
|
19
|
+
#
|
20
|
+
# @param [String] js The Javascript to compress
|
21
|
+
# @return [String] Compressed Javascript
|
22
|
+
def compress(js)
|
23
|
+
# Don't shrink variables if the file includes a call to `eval`
|
24
|
+
Packr.pack(js, :shrink_vars => !js.include?('eval('))
|
25
|
+
end
|
26
|
+
|
27
|
+
# Get the path of the file on disk
|
28
|
+
#
|
29
|
+
# @param [String] filename The name of sheet,
|
30
|
+
# assumed to be in the public directory, under 'javascripts'
|
31
|
+
# @return [String] The full path to the file
|
32
|
+
def path(filename)
|
33
|
+
File.join(@app.public, 'javascripts', "#{filename}.js")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'sinatra/bundles/bundle'
|
2
|
+
require 'rainpress'
|
3
|
+
|
4
|
+
module Sinatra
|
5
|
+
module Bundles
|
6
|
+
# Bundle for stylesheets
|
7
|
+
class StylesheetBundle < Bundle
|
8
|
+
# Generate the HTML tag for the stylesheet
|
9
|
+
#
|
10
|
+
# @param [String] name The name of a bundle
|
11
|
+
# @return [String] The HTML that can be inserted into the doc
|
12
|
+
def to_html(name)
|
13
|
+
"<link type='text/css' href='/stylesheets/bundles/#{name}.css#{@app.stamp_bundles ? "?#{stamp}" : ''}' rel='stylesheet' media='screen' />"
|
14
|
+
end
|
15
|
+
|
16
|
+
protected
|
17
|
+
|
18
|
+
# Compress CSS
|
19
|
+
#
|
20
|
+
# @param [String] css The CSS to compress
|
21
|
+
# @return [String] Compressed CSS
|
22
|
+
def compress(css)
|
23
|
+
Rainpress.compress(css)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Get the path of the file on disk
|
27
|
+
#
|
28
|
+
# @param [String] filename The name of sheet,
|
29
|
+
# assumed to be in the public directory, under 'stylesheets'
|
30
|
+
# @return [String] The full path to the file
|
31
|
+
def path(filename)
|
32
|
+
File.join(@app.public, 'stylesheets', "#{filename}.css")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/sinatra/bundles.rb
CHANGED
@@ -1,120 +1,10 @@
|
|
1
|
-
require 'rainpress'
|
2
|
-
require 'packr'
|
3
|
-
|
4
1
|
module Sinatra
|
5
2
|
# Main Bundles Module
|
6
3
|
module Bundles
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
def initialize(app, files)
|
12
|
-
@app = app
|
13
|
-
@files = files
|
14
|
-
end
|
15
|
-
|
16
|
-
# Since we pass Bundles back as the body,
|
17
|
-
# this follows Rack standards and supports an each method
|
18
|
-
# to yield parts of the body, in our case, the files.
|
19
|
-
def each
|
20
|
-
@files.each do |f|
|
21
|
-
content = File.read(path(f))
|
22
|
-
content = compress(content) if @app.compress_bundles
|
23
|
-
# Include a new line to prevent weirdness at file boundaries
|
24
|
-
yield("#{content}\n")
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
# The timestamp of the bundle, which is the newest file in the bundle.
|
31
|
-
#
|
32
|
-
# @return [Integer] The timestamp of the bundle
|
33
|
-
def stamp
|
34
|
-
@files.map do |f|
|
35
|
-
File.mtime(path(f))
|
36
|
-
end.sort.first.to_i
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
# Bundle for stylesheets
|
41
|
-
class StylesheetBundle < Bundle
|
42
|
-
# Generate the HTML tag for the stylesheet
|
43
|
-
#
|
44
|
-
# @param [String] name The name of a bundle
|
45
|
-
# @return [String] The HTML that can be inserted into the doc
|
46
|
-
def to_html(name)
|
47
|
-
"<link type='text/css' href='/stylesheets/bundles/#{name}.css#{@app.stamp_bundles ? "?#{stamp}" : ''}' rel='stylesheet' media='screen' />"
|
48
|
-
end
|
49
|
-
|
50
|
-
protected
|
51
|
-
|
52
|
-
# Compress CSS
|
53
|
-
#
|
54
|
-
# @param [String] css The CSS to compress
|
55
|
-
# @return [String] Compressed CSS
|
56
|
-
def compress(css)
|
57
|
-
Rainpress.compress(css)
|
58
|
-
end
|
59
|
-
|
60
|
-
# Get the path of the file on disk
|
61
|
-
#
|
62
|
-
# @param [String] filename The name of sheet,
|
63
|
-
# assumed to be in the public directory, under 'stylesheets'
|
64
|
-
# @return [String] The full path to the file
|
65
|
-
def path(filename)
|
66
|
-
File.join(@app.public, 'stylesheets', "#{filename}.css")
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
# Bundle for javascripts
|
71
|
-
class JavascriptBundle < Bundle
|
72
|
-
# Generate the HTML tag for the script file
|
73
|
-
#
|
74
|
-
# @param [String] name The name of a bundle
|
75
|
-
# @return [String] The HTML that can be inserted into the doc
|
76
|
-
def to_html(name)
|
77
|
-
"<script type='text/javascript' src='/javascripts/bundles/#{name}.js#{@app.stamp_bundles ? "?#{stamp}" : ''}'></script>"
|
78
|
-
end
|
79
|
-
|
80
|
-
protected
|
81
|
-
|
82
|
-
# Compress Javascript
|
83
|
-
#
|
84
|
-
# @param [String] js The Javascript to compress
|
85
|
-
# @return [String] Compressed Javascript
|
86
|
-
def compress(js)
|
87
|
-
Packr.pack(js, :shrink_vars => true)
|
88
|
-
end
|
89
|
-
|
90
|
-
# Get the path of the file on disk
|
91
|
-
#
|
92
|
-
# @param [String] filename The name of sheet,
|
93
|
-
# assumed to be in the public directory, under 'javascripts'
|
94
|
-
# @return [String] The full path to the file
|
95
|
-
def path(filename)
|
96
|
-
File.join(@app.public, 'javascripts', "#{filename}.js")
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
# View helpers
|
101
|
-
module Helpers
|
102
|
-
# Emit a script tag for a javascript bundle
|
103
|
-
#
|
104
|
-
# @param [Symbol,String] bundle The bundle name
|
105
|
-
# @return [String] HTML script tag
|
106
|
-
def javascript_bundle_include_tag(bundle)
|
107
|
-
options.javascript_bundles[bundle].to_html(bundle)
|
108
|
-
end
|
109
|
-
|
110
|
-
# Emit a script tag for a stylesheet bundle
|
111
|
-
#
|
112
|
-
# @param [Symbol,String] bundle The bundle name
|
113
|
-
# @return [String] HTML link tag
|
114
|
-
def stylesheet_bundle_link_tag(bundle)
|
115
|
-
options.stylesheet_bundles[bundle].to_html(bundle)
|
116
|
-
end
|
117
|
-
end
|
4
|
+
autoload :Helpers, 'sinatra/bundles/helpers'
|
5
|
+
autoload :Bundle, 'sinatra/bundles/bundle'
|
6
|
+
autoload :JavascriptBundle, 'sinatra/bundles/javascript_bundle'
|
7
|
+
autoload :StylesheetBundle, 'sinatra/bundles/stylesheet_bundle'
|
118
8
|
|
119
9
|
# Set a Javascript bundle
|
120
10
|
# javascript_bundle(:all, %w(jquery lightbox))
|
data/sinatra-bundles.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{sinatra-bundles}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Daniel Huckstep"]
|
12
|
-
s.date = %q{2010-02-
|
12
|
+
s.date = %q{2010-02-28}
|
13
13
|
s.description = %q{Bundle CSS and Javascript assets to a single file, compress, and cache them for snappier web experiences.}
|
14
14
|
s.email = %q{darkhelmet@darkhelmetlive.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -24,71 +24,21 @@ Gem::Specification.new do |s|
|
|
24
24
|
"Rakefile",
|
25
25
|
"VERSION",
|
26
26
|
"lib/sinatra/bundles.rb",
|
27
|
+
"lib/sinatra/bundles/bundle.rb",
|
28
|
+
"lib/sinatra/bundles/helpers.rb",
|
29
|
+
"lib/sinatra/bundles/javascript_bundle.rb",
|
30
|
+
"lib/sinatra/bundles/stylesheet_bundle.rb",
|
27
31
|
"sinatra-bundles.gemspec",
|
28
32
|
"spec/app.rb",
|
29
33
|
"spec/production_app.rb",
|
34
|
+
"spec/public/javascripts/eval.js",
|
30
35
|
"spec/public/javascripts/test1.js",
|
31
36
|
"spec/public/javascripts/test2.js",
|
32
37
|
"spec/public/stylesheets/test1.css",
|
33
38
|
"spec/public/stylesheets/test2.css",
|
34
39
|
"spec/sinatra-bundles_spec.rb",
|
35
40
|
"spec/spec.opts",
|
36
|
-
"spec/spec_helper.rb"
|
37
|
-
"vendor/cache/sinatra-0.10.1.gem",
|
38
|
-
"vendor/gems/sinatra-0.10.1/AUTHORS",
|
39
|
-
"vendor/gems/sinatra-0.10.1/CHANGES",
|
40
|
-
"vendor/gems/sinatra-0.10.1/LICENSE",
|
41
|
-
"vendor/gems/sinatra-0.10.1/README.jp.rdoc",
|
42
|
-
"vendor/gems/sinatra-0.10.1/README.rdoc",
|
43
|
-
"vendor/gems/sinatra-0.10.1/Rakefile",
|
44
|
-
"vendor/gems/sinatra-0.10.1/lib/sinatra.rb",
|
45
|
-
"vendor/gems/sinatra-0.10.1/lib/sinatra/base.rb",
|
46
|
-
"vendor/gems/sinatra-0.10.1/lib/sinatra/images/404.png",
|
47
|
-
"vendor/gems/sinatra-0.10.1/lib/sinatra/images/500.png",
|
48
|
-
"vendor/gems/sinatra-0.10.1/lib/sinatra/main.rb",
|
49
|
-
"vendor/gems/sinatra-0.10.1/lib/sinatra/showexceptions.rb",
|
50
|
-
"vendor/gems/sinatra-0.10.1/lib/sinatra/tilt.rb",
|
51
|
-
"vendor/gems/sinatra-0.10.1/sinatra.gemspec",
|
52
|
-
"vendor/gems/sinatra-0.10.1/test/base_test.rb",
|
53
|
-
"vendor/gems/sinatra-0.10.1/test/builder_test.rb",
|
54
|
-
"vendor/gems/sinatra-0.10.1/test/contest.rb",
|
55
|
-
"vendor/gems/sinatra-0.10.1/test/erb_test.rb",
|
56
|
-
"vendor/gems/sinatra-0.10.1/test/erubis_test.rb",
|
57
|
-
"vendor/gems/sinatra-0.10.1/test/extensions_test.rb",
|
58
|
-
"vendor/gems/sinatra-0.10.1/test/filter_test.rb",
|
59
|
-
"vendor/gems/sinatra-0.10.1/test/haml_test.rb",
|
60
|
-
"vendor/gems/sinatra-0.10.1/test/helper.rb",
|
61
|
-
"vendor/gems/sinatra-0.10.1/test/helpers_test.rb",
|
62
|
-
"vendor/gems/sinatra-0.10.1/test/mapped_error_test.rb",
|
63
|
-
"vendor/gems/sinatra-0.10.1/test/middleware_test.rb",
|
64
|
-
"vendor/gems/sinatra-0.10.1/test/request_test.rb",
|
65
|
-
"vendor/gems/sinatra-0.10.1/test/response_test.rb",
|
66
|
-
"vendor/gems/sinatra-0.10.1/test/result_test.rb",
|
67
|
-
"vendor/gems/sinatra-0.10.1/test/route_added_hook_test.rb",
|
68
|
-
"vendor/gems/sinatra-0.10.1/test/routing_test.rb",
|
69
|
-
"vendor/gems/sinatra-0.10.1/test/sass_test.rb",
|
70
|
-
"vendor/gems/sinatra-0.10.1/test/server_test.rb",
|
71
|
-
"vendor/gems/sinatra-0.10.1/test/sinatra_test.rb",
|
72
|
-
"vendor/gems/sinatra-0.10.1/test/static_test.rb",
|
73
|
-
"vendor/gems/sinatra-0.10.1/test/templates_test.rb",
|
74
|
-
"vendor/gems/sinatra-0.10.1/test/views/error.builder",
|
75
|
-
"vendor/gems/sinatra-0.10.1/test/views/error.erb",
|
76
|
-
"vendor/gems/sinatra-0.10.1/test/views/error.erubis",
|
77
|
-
"vendor/gems/sinatra-0.10.1/test/views/error.haml",
|
78
|
-
"vendor/gems/sinatra-0.10.1/test/views/error.sass",
|
79
|
-
"vendor/gems/sinatra-0.10.1/test/views/foo/hello.test",
|
80
|
-
"vendor/gems/sinatra-0.10.1/test/views/hello.builder",
|
81
|
-
"vendor/gems/sinatra-0.10.1/test/views/hello.erb",
|
82
|
-
"vendor/gems/sinatra-0.10.1/test/views/hello.erubis",
|
83
|
-
"vendor/gems/sinatra-0.10.1/test/views/hello.haml",
|
84
|
-
"vendor/gems/sinatra-0.10.1/test/views/hello.sass",
|
85
|
-
"vendor/gems/sinatra-0.10.1/test/views/hello.test",
|
86
|
-
"vendor/gems/sinatra-0.10.1/test/views/layout2.builder",
|
87
|
-
"vendor/gems/sinatra-0.10.1/test/views/layout2.erb",
|
88
|
-
"vendor/gems/sinatra-0.10.1/test/views/layout2.erubis",
|
89
|
-
"vendor/gems/sinatra-0.10.1/test/views/layout2.haml",
|
90
|
-
"vendor/gems/sinatra-0.10.1/test/views/layout2.test",
|
91
|
-
"vendor/specifications/sinatra-0.10.1.gemspec"
|
41
|
+
"spec/spec_helper.rb"
|
92
42
|
]
|
93
43
|
s.homepage = %q{http://github.com/darkhelmet/sinatra-bundles}
|
94
44
|
s.rdoc_options = ["--charset=UTF-8"]
|
@@ -109,6 +59,7 @@ Gem::Specification.new do |s|
|
|
109
59
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
110
60
|
s.add_runtime_dependency(%q<rainpress>, [">= 0"])
|
111
61
|
s.add_runtime_dependency(%q<packr>, [">= 0"])
|
62
|
+
s.add_runtime_dependency(%q<rack>, [">= 1.0"])
|
112
63
|
s.add_runtime_dependency(%q<sinatra>, [">= 1.0.a"])
|
113
64
|
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
114
65
|
s.add_development_dependency(%q<rack-test>, [">= 0.5.3"])
|
@@ -116,6 +67,7 @@ Gem::Specification.new do |s|
|
|
116
67
|
else
|
117
68
|
s.add_dependency(%q<rainpress>, [">= 0"])
|
118
69
|
s.add_dependency(%q<packr>, [">= 0"])
|
70
|
+
s.add_dependency(%q<rack>, [">= 1.0"])
|
119
71
|
s.add_dependency(%q<sinatra>, [">= 1.0.a"])
|
120
72
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
121
73
|
s.add_dependency(%q<rack-test>, [">= 0.5.3"])
|
@@ -124,6 +76,7 @@ Gem::Specification.new do |s|
|
|
124
76
|
else
|
125
77
|
s.add_dependency(%q<rainpress>, [">= 0"])
|
126
78
|
s.add_dependency(%q<packr>, [">= 0"])
|
79
|
+
s.add_dependency(%q<rack>, [">= 1.0"])
|
127
80
|
s.add_dependency(%q<sinatra>, [">= 1.0.a"])
|
128
81
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
129
82
|
s.add_dependency(%q<rack-test>, [">= 0.5.3"])
|
data/spec/app.rb
CHANGED
data/spec/production_app.rb
CHANGED
@@ -29,7 +29,7 @@ describe 'sinatra-bundles' do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
before do
|
32
|
-
@scripts = %w(test1 test2).map do |name|
|
32
|
+
@scripts = %w(test1 test2 eval).map do |name|
|
33
33
|
File.expand_path(File.join(File.dirname(__FILE__), 'public', 'javascripts', "#{name}.js"))
|
34
34
|
end
|
35
35
|
|
@@ -111,6 +111,15 @@ describe 'sinatra-bundles' do
|
|
111
111
|
last_response.headers['Vary'].should == 'Accept-Encoding'
|
112
112
|
last_response.headers['Cache-Control'].should == 'public, must-revalidate, max-age=31536000'
|
113
113
|
end
|
114
|
+
|
115
|
+
it 'should not shrink vars on javascript files that use eval' do
|
116
|
+
app.enable(:compress_bundles)
|
117
|
+
get '/javascripts/bundles/test.js'
|
118
|
+
last_response.should be_ok
|
119
|
+
js = File.read(File.join(File.dirname(__FILE__), 'public/javascripts/eval.js'))
|
120
|
+
last_response.body.include?(Packr.pack(js)).should be_true
|
121
|
+
last_response.body.include?(Packr.pack(js, :shrink_vars => true)).should be_false
|
122
|
+
end
|
114
123
|
end
|
115
124
|
|
116
125
|
context 'stylesheet bundles' do
|
data/spec/spec_helper.rb
CHANGED
@@ -1,17 +1,16 @@
|
|
1
1
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
2
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
|
3
4
|
require 'rubygems'
|
4
|
-
Gem.clear_paths
|
5
|
-
ENV['GEM_HOME'] = File.expand_path(File.join(File.dirname(__FILE__), '..', 'vendor'))
|
6
5
|
require 'spec'
|
7
6
|
require 'spec/autorun'
|
8
7
|
require 'rack/test'
|
9
8
|
|
10
|
-
gem 'sinatra', '>= 0.
|
9
|
+
gem 'sinatra', '>= 1.0.a'
|
11
10
|
require 'sinatra/base'
|
12
11
|
require 'sinatra/bundles'
|
13
12
|
|
14
|
-
Spec::Runner.configure do |
|
15
|
-
|
16
|
-
|
13
|
+
Spec::Runner.configure do |c|
|
14
|
+
c.include Rack::Test::Methods
|
15
|
+
c.include Sinatra::Bundles::Helpers
|
17
16
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-bundles
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Huckstep
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-02-
|
12
|
+
date: 2010-02-28 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -32,6 +32,16 @@ dependencies:
|
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: "0"
|
34
34
|
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rack
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "1.0"
|
44
|
+
version:
|
35
45
|
- !ruby/object:Gem::Dependency
|
36
46
|
name: sinatra
|
37
47
|
type: :runtime
|
@@ -89,9 +99,14 @@ files:
|
|
89
99
|
- Rakefile
|
90
100
|
- VERSION
|
91
101
|
- lib/sinatra/bundles.rb
|
102
|
+
- lib/sinatra/bundles/bundle.rb
|
103
|
+
- lib/sinatra/bundles/helpers.rb
|
104
|
+
- lib/sinatra/bundles/javascript_bundle.rb
|
105
|
+
- lib/sinatra/bundles/stylesheet_bundle.rb
|
92
106
|
- sinatra-bundles.gemspec
|
93
107
|
- spec/app.rb
|
94
108
|
- spec/production_app.rb
|
109
|
+
- spec/public/javascripts/eval.js
|
95
110
|
- spec/public/javascripts/test1.js
|
96
111
|
- spec/public/javascripts/test2.js
|
97
112
|
- spec/public/stylesheets/test1.css
|
@@ -99,61 +114,6 @@ files:
|
|
99
114
|
- spec/sinatra-bundles_spec.rb
|
100
115
|
- spec/spec.opts
|
101
116
|
- spec/spec_helper.rb
|
102
|
-
- vendor/cache/sinatra-0.10.1.gem
|
103
|
-
- vendor/gems/sinatra-0.10.1/AUTHORS
|
104
|
-
- vendor/gems/sinatra-0.10.1/CHANGES
|
105
|
-
- vendor/gems/sinatra-0.10.1/LICENSE
|
106
|
-
- vendor/gems/sinatra-0.10.1/README.jp.rdoc
|
107
|
-
- vendor/gems/sinatra-0.10.1/README.rdoc
|
108
|
-
- vendor/gems/sinatra-0.10.1/Rakefile
|
109
|
-
- vendor/gems/sinatra-0.10.1/lib/sinatra.rb
|
110
|
-
- vendor/gems/sinatra-0.10.1/lib/sinatra/base.rb
|
111
|
-
- vendor/gems/sinatra-0.10.1/lib/sinatra/images/404.png
|
112
|
-
- vendor/gems/sinatra-0.10.1/lib/sinatra/images/500.png
|
113
|
-
- vendor/gems/sinatra-0.10.1/lib/sinatra/main.rb
|
114
|
-
- vendor/gems/sinatra-0.10.1/lib/sinatra/showexceptions.rb
|
115
|
-
- vendor/gems/sinatra-0.10.1/lib/sinatra/tilt.rb
|
116
|
-
- vendor/gems/sinatra-0.10.1/sinatra.gemspec
|
117
|
-
- vendor/gems/sinatra-0.10.1/test/base_test.rb
|
118
|
-
- vendor/gems/sinatra-0.10.1/test/builder_test.rb
|
119
|
-
- vendor/gems/sinatra-0.10.1/test/contest.rb
|
120
|
-
- vendor/gems/sinatra-0.10.1/test/erb_test.rb
|
121
|
-
- vendor/gems/sinatra-0.10.1/test/erubis_test.rb
|
122
|
-
- vendor/gems/sinatra-0.10.1/test/extensions_test.rb
|
123
|
-
- vendor/gems/sinatra-0.10.1/test/filter_test.rb
|
124
|
-
- vendor/gems/sinatra-0.10.1/test/haml_test.rb
|
125
|
-
- vendor/gems/sinatra-0.10.1/test/helper.rb
|
126
|
-
- vendor/gems/sinatra-0.10.1/test/helpers_test.rb
|
127
|
-
- vendor/gems/sinatra-0.10.1/test/mapped_error_test.rb
|
128
|
-
- vendor/gems/sinatra-0.10.1/test/middleware_test.rb
|
129
|
-
- vendor/gems/sinatra-0.10.1/test/request_test.rb
|
130
|
-
- vendor/gems/sinatra-0.10.1/test/response_test.rb
|
131
|
-
- vendor/gems/sinatra-0.10.1/test/result_test.rb
|
132
|
-
- vendor/gems/sinatra-0.10.1/test/route_added_hook_test.rb
|
133
|
-
- vendor/gems/sinatra-0.10.1/test/routing_test.rb
|
134
|
-
- vendor/gems/sinatra-0.10.1/test/sass_test.rb
|
135
|
-
- vendor/gems/sinatra-0.10.1/test/server_test.rb
|
136
|
-
- vendor/gems/sinatra-0.10.1/test/sinatra_test.rb
|
137
|
-
- vendor/gems/sinatra-0.10.1/test/static_test.rb
|
138
|
-
- vendor/gems/sinatra-0.10.1/test/templates_test.rb
|
139
|
-
- vendor/gems/sinatra-0.10.1/test/views/error.builder
|
140
|
-
- vendor/gems/sinatra-0.10.1/test/views/error.erb
|
141
|
-
- vendor/gems/sinatra-0.10.1/test/views/error.erubis
|
142
|
-
- vendor/gems/sinatra-0.10.1/test/views/error.haml
|
143
|
-
- vendor/gems/sinatra-0.10.1/test/views/error.sass
|
144
|
-
- vendor/gems/sinatra-0.10.1/test/views/foo/hello.test
|
145
|
-
- vendor/gems/sinatra-0.10.1/test/views/hello.builder
|
146
|
-
- vendor/gems/sinatra-0.10.1/test/views/hello.erb
|
147
|
-
- vendor/gems/sinatra-0.10.1/test/views/hello.erubis
|
148
|
-
- vendor/gems/sinatra-0.10.1/test/views/hello.haml
|
149
|
-
- vendor/gems/sinatra-0.10.1/test/views/hello.sass
|
150
|
-
- vendor/gems/sinatra-0.10.1/test/views/hello.test
|
151
|
-
- vendor/gems/sinatra-0.10.1/test/views/layout2.builder
|
152
|
-
- vendor/gems/sinatra-0.10.1/test/views/layout2.erb
|
153
|
-
- vendor/gems/sinatra-0.10.1/test/views/layout2.erubis
|
154
|
-
- vendor/gems/sinatra-0.10.1/test/views/layout2.haml
|
155
|
-
- vendor/gems/sinatra-0.10.1/test/views/layout2.test
|
156
|
-
- vendor/specifications/sinatra-0.10.1.gemspec
|
157
117
|
has_rdoc: true
|
158
118
|
homepage: http://github.com/darkhelmet/sinatra-bundles
|
159
119
|
licenses: []
|
Binary file
|
@@ -1,43 +0,0 @@
|
|
1
|
-
Sinatra was designed and developed by Blake Mizerany (bmizerany) in
|
2
|
-
California. Continued development would not be possible without the ongoing
|
3
|
-
financial support provided by [Heroku](http://heroku.com) and the emotional
|
4
|
-
support provided by Adam Wiggins (adamwiggins) of Heroku, Chris Wanstrath (defunkt),
|
5
|
-
PJ Hyett (pjhyett), and the rest of the GitHub crew.
|
6
|
-
|
7
|
-
Special thanks to the following extraordinary individuals, who-out which
|
8
|
-
Sinatra would not be possible:
|
9
|
-
|
10
|
-
* Ryan Tomayko (rtomayko) for constantly fixing whitespace errors 60d5006
|
11
|
-
* Ezra Zygmuntowicz (ezmobius) for initial help and letting Blake steal
|
12
|
-
some of merbs internal code.
|
13
|
-
* Ari Lerner (http://xnot.org/) for his evangelism, spirit, and gumption
|
14
|
-
that got Sinatra recognized from Day 1.
|
15
|
-
* Christopher Schneid (cschneid) for The Book, the blog (gittr.com),
|
16
|
-
irclogger.com, and a bunch of useful patches.
|
17
|
-
* Markus Prinz (cypher) for patches over the years, caring about
|
18
|
-
the README, and hanging in there when times were rough.
|
19
|
-
* Simon Rozet (sr) for a ton of doc patches, HAML options, and all that
|
20
|
-
advocacy stuff he's going to do for 1.0.
|
21
|
-
* Erik Kastner (kastner) for fixing `MIME_TYPES` under Rack 0.5.
|
22
|
-
* Ben Bleything (bleything) for caring about HTTP status codes and doc fixes.
|
23
|
-
* Igal Koshevoy (igal) for root path detection under Thin/Passenger.
|
24
|
-
* Jon Crosby (jcrosby) for coffee breaks, doc fixes, and just because, man.
|
25
|
-
* Karel Minarik (karmi) for screaming until the website came back up.
|
26
|
-
* Jeremy Evans (jeremyevans) for unbreaking optional path params (twice!)
|
27
|
-
* The GitHub guys for stealing Blake's table.
|
28
|
-
* Nickolas Means (nmeans) for Sass template support.
|
29
|
-
* Victor Hugo Borja (vic) for splat'n routes specs and doco.
|
30
|
-
* Avdi Grimm (avdi) for basic RSpec support.
|
31
|
-
* Jack Danger Canty for a more accurate root directory and for making me
|
32
|
-
watch [this](http://www.youtube.com/watch?v=ueaHLHgskkw) just now.
|
33
|
-
* Mathew Walker for making escaped paths work with static files.
|
34
|
-
* Millions of Us for having the problem that led to Sinatra's conception.
|
35
|
-
* Songbird for the problems that helped Sinatra's future become realized.
|
36
|
-
* Rick Olson (technoweenie) for the killer plug at RailsConf '08.
|
37
|
-
* Steven Garcia for the amazing custom artwork you see on 404's and 500's
|
38
|
-
* Pat Nakajima (nakajima) for fixing non-nested params in nested params Hash's.
|
39
|
-
|
40
|
-
and last but not least:
|
41
|
-
|
42
|
-
* Frank Sinatra (chairman of the board) for having so much class he
|
43
|
-
deserves a web-framework named after him.
|