sinatra-assetpack 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 36980bbe81aa1db5f97f6fcedb9cd0d3d18a917c
4
- data.tar.gz: b051cfbb48584c044bd4145a9dd91a4941b7b864
3
+ metadata.gz: e742977ba0329b1f960c46f4294fa2cb860d35de
4
+ data.tar.gz: 45e3dd99cc00c05bf524751f0a1f19e0a8a43693
5
5
  SHA512:
6
- metadata.gz: f6482f3a6d2dbbc4608c4c8a7fa711f90b8836da96aa58935cc452e5a4e6cdee0e9702bc893f1c726fc8ec08c691a3aa84469877032d37edf9f9a8c124989d29
7
- data.tar.gz: 0031c2f116f04cf2bc388fa819216db737401bd759c08894a3a4bf44fcfe0ab0c73ff0f20951532c5cc4fac05f16471004809c7ddbfbf251bf3dc160275233bb
6
+ metadata.gz: 7b2d990a88e9acb49884f9d764fe5c7f8b17b045da773b245200f2ff3a21617429cd525358ca9cc594b859bf7725a8658446a1f53bfe63078f968646f211e719
7
+ data.tar.gz: 23d6d7a5a7f2cdab53406e16a572ba068d46e3042607595032e19d8560f19ec8f64ffc78cd6adf3ca70a69fc67c7fa8e0cf6fd30e76c5f36441858e958907747
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -10,5 +10,6 @@ rvm:
10
10
  - ruby-head
11
11
  matrix:
12
12
  allow_failures:
13
+ - rvm: rbx-19mode
13
14
  - rvm: jruby-head
14
- - rvm: ruby-head
15
+ - rvm: ruby-head
@@ -1,3 +1,11 @@
1
+ ## v0.3.2 - January 10, 2014
2
+
3
+ * Change : Support .ico files (#147)
4
+ * Change : lock tilt gem to 1.0, not tilt 2.0 compatible yet.
5
+ * Fix : Account for suburi in img helper (#144)
6
+ * Fix : Improve image_path helper (#146)
7
+ * Fix : No broken HTML for crazy file names (#150)
8
+
1
9
  ## v0.3.1 - August 1, 2013
2
10
 
3
11
  * Fix : Use Tilt mappings when sorting candidates for dynamic requests. (#122)
@@ -1,67 +1,61 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sinatra-assetpack (0.3.1)
4
+ sinatra-assetpack (0.3.2)
5
5
  jsmin
6
6
  rack-test
7
7
  sinatra
8
- tilt (>= 1.3.0)
8
+ tilt (>= 1.3.0, < 2.0)
9
9
 
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- POpen4 (0.1.4)
14
- Platform (>= 0.4.0)
15
- open4
16
- Platform (0.4.0)
17
- awesome_print (1.1.0)
13
+ awesome_print (1.2.0)
18
14
  coffee-script (2.2.0)
19
15
  coffee-script-source
20
16
  execjs
21
- coffee-script-source (1.6.2)
17
+ coffee-script-source (1.6.3)
22
18
  columnize (0.3.6)
23
- commonjs (0.2.6)
19
+ commonjs (0.2.7)
24
20
  contest (0.1.3)
25
- debugger (1.6.0)
21
+ debugger (1.6.5)
26
22
  columnize (>= 0.3.1)
27
23
  debugger-linecache (~> 1.2.0)
28
- debugger-ruby_core_source (~> 1.2.1)
24
+ debugger-ruby_core_source (~> 1.3.1)
29
25
  debugger-linecache (1.2.0)
30
- debugger-ruby_core_source (1.2.2)
31
- execjs (1.4.0)
32
- multi_json (~> 1.0)
33
- gem-release (0.6.0)
34
- haml (4.0.3)
26
+ debugger-ruby_core_source (1.3.1)
27
+ execjs (2.0.2)
28
+ gem-release (0.7.1)
29
+ haml (4.0.5)
35
30
  tilt
36
31
  jsmin (1.0.1)
37
- less (2.3.2)
38
- commonjs (~> 0.2.6)
32
+ json (1.8.1)
33
+ json (1.8.1-java)
34
+ less (2.4.0)
35
+ commonjs (~> 0.2.7)
39
36
  metaclass (0.0.1)
40
37
  mocha (0.14.0)
41
38
  metaclass (~> 0.0.1)
42
- multi_json (1.7.7)
43
- open4 (1.3.0)
44
39
  rack (1.5.2)
45
- rack-protection (1.5.0)
40
+ rack-protection (1.5.1)
46
41
  rack
47
42
  rack-test (0.6.2)
48
43
  rack (>= 1.0)
49
- rake (10.1.0)
50
- sass (3.2.9)
51
- sinatra (1.4.3)
44
+ rake (10.1.1)
45
+ sass (3.2.13)
46
+ sinatra (1.4.4)
52
47
  rack (~> 1.4)
53
48
  rack-protection (~> 1.4)
54
49
  tilt (~> 1.3, >= 1.3.4)
55
- stylus (0.7.2)
50
+ stylus (1.0.0)
56
51
  execjs
57
52
  stylus-source
58
- stylus-source (0.31.0)
53
+ stylus-source (0.38.0)
59
54
  tilt (1.4.1)
60
- uglifier (2.1.1)
55
+ uglifier (2.4.0)
61
56
  execjs (>= 0.3.0)
62
- multi_json (~> 1.0, >= 1.0.2)
63
- yui-compressor (0.9.6)
64
- POpen4 (>= 0.1.4)
57
+ json (>= 1.8.0)
58
+ yui-compressor (0.12.0)
65
59
 
66
60
  PLATFORMS
67
61
  java
data/README.md CHANGED
@@ -393,8 +393,8 @@ Redundancies will be taken care of.
393
393
  assets {
394
394
  css :NAME, [ PATH1, PATH2, ... ]
395
395
  css :NAME, 'URI', [ PATH1, PATH2, ... ]
396
- js:NAME, [ PATH1, PATH2, ... ]
397
- js:NAME, 'URI', [ PATH1, PATH2, ... ]
396
+ js :NAME, [ PATH1, PATH2, ... ]
397
+ js :NAME, 'URI', [ PATH1, PATH2, ... ]
398
398
  }
399
399
  ```
400
400
 
data/UPGRADING CHANGED
@@ -3,15 +3,15 @@
3
3
  ##################################################
4
4
 
5
5
  Please note that sinatra-assetpack `img` helper method
6
- no more set the image width and height because this default
7
- behavior is not desirable with most recent CSS techniques
6
+ no longer sets the image width and height. This default
7
+ behavior is not desirable with more recent CSS techniques
8
8
  regarding high resolutions images for "retina" displays
9
- ans "responsive" design CSS using for exemple width:100%.
9
+ and "responsive" design CSS using, for example, width:100%.
10
10
 
11
11
  <img src="retina.jpg" width="1200" height="600">
12
12
 
13
- Is now simply this (unless you explicity set them) :
13
+ Is now simply this (unless you explicitly set them) :
14
14
 
15
15
  <img src="retina.jpg">
16
16
 
17
- See https://github.com/rstacruz/sinatra-assetpack/pull/121
17
+ See https://github.com/rstacruz/sinatra-assetpack/pull/121
@@ -9,7 +9,7 @@ module Sinatra
9
9
  # Returns a list of formats that can be served.
10
10
  # Anything not in this list will be rejected.
11
11
  def self.supported_formats
12
- @supported_formats ||= %w(css js png jpg gif svg otf eot ttf woff htc)
12
+ @supported_formats ||= %w(css js png jpg gif svg otf eot ttf woff htc ico)
13
13
  end
14
14
 
15
15
  # Returns a map of what MIME format each Tilt type returns.
@@ -37,7 +37,7 @@ module Sinatra
37
37
  out
38
38
  end
39
39
 
40
- # Clear Tilt::Cache (used for primarily for tests)
40
+ # Clear Tilt::Cache (used primarily for tests)
41
41
  def self.clear_tilt_cache!(cache, app)
42
42
  cache.clear
43
43
  #app.clear_tilt_cache = false # Maybe it can be an option on app we can enable/disable?
@@ -10,12 +10,17 @@ module Sinatra
10
10
  end
11
11
 
12
12
  def img(src, options={})
13
- attrs = { :src => HtmlHelpers.get_file_uri(src, settings.assets) }
13
+ attrs = { :src => image_path(src) }
14
14
  attrs = attrs.merge(options)
15
15
 
16
16
  "<img#{HtmlHelpers.kv attrs} />"
17
17
  end
18
18
 
19
+ def image_path(src)
20
+ file_path = HtmlHelpers.get_file_uri(src, settings.assets)
21
+ File.join(request.script_name, file_path)
22
+ end
23
+
19
24
  def show_asset_pack(type, *args)
20
25
  names = Array.new
21
26
  while args.first.is_a?(Symbol)
@@ -216,7 +216,7 @@ module Sinatra
216
216
  # Returns the local file for a given URI path.
217
217
  # Returns nil if a file is not found.
218
218
  def local_file_for(request)
219
- request.squeeze!('/')
219
+ request = request.squeeze('/')
220
220
  serve_path, from = served.detect { |path, _| request.start_with?(path) }
221
221
 
222
222
  return if !from
@@ -124,9 +124,9 @@ module Sinatra
124
124
  file_path = HtmlHelpers.get_file_uri(file, @assets)
125
125
 
126
126
  if js?
127
- "<script src='#{file_path}'#{kv options}></script>"
127
+ "<script src='#{e(file_path)}'#{kv(options)}></script>"
128
128
  elsif css?
129
- "<link rel='stylesheet' href='#{file_path}'#{kv options} />"
129
+ "<link rel='stylesheet' href='#{e(file_path)}'#{kv(options)} />"
130
130
  end
131
131
  end
132
132
  end
@@ -1,6 +1,6 @@
1
1
  module Sinatra
2
2
  module AssetPack
3
- VERSION = "0.3.1"
3
+ VERSION = "0.3.2"
4
4
 
5
5
  # @deprecated Please use AssetPack::VERSION instead
6
6
  def self.version
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
22
22
  s.add_dependency 'jsmin'
23
23
  s.add_dependency 'rack-test'
24
24
  s.add_dependency 'sinatra'
25
- s.add_dependency 'tilt', '>= 1.3.0'
25
+ s.add_dependency 'tilt', '>= 1.3.0', '< 2.0'
26
26
 
27
27
  # Supported preprocessors (each is optional)
28
28
  s.add_development_dependency 'coffee-script'
@@ -76,5 +76,11 @@ class Main < Sinatra::Base
76
76
  != css :application, :media => 'screen'
77
77
  }.strip
78
78
  end
79
+
80
+ get '/helpers/email' do
81
+ haml %{
82
+ != img '/images/email.png'
83
+ }.strip
84
+ end
79
85
  end
80
86
 
@@ -6,6 +6,8 @@ class HelpersTest < UnitTest
6
6
  Main.get('/helper/css/all') { css :application, :sq }
7
7
  Main.get('/helper/css/app') { css :application }
8
8
  Main.get('/helper/css/sq') { css :sq }
9
+ Main.get('/helper/foo_path') { image_path '/images/foo.jpg' }
10
+ Main.get('/helper/email_path') { image_path '/images/email.png' }
9
11
 
10
12
  test "img non-existing" do
11
13
  get '/helper/foo'
@@ -26,6 +28,26 @@ class HelpersTest < UnitTest
26
28
  assert body =~ %r{src='/images/email.[a-f0-9]{32}.png'}
27
29
  end
28
30
 
31
+ test "image_path non-existing" do
32
+ get '/helper/foo_path'
33
+
34
+ assert body == "/images/foo.jpg"
35
+ end
36
+
37
+ test "image_path existing (development)" do
38
+ app.stubs(:development?).returns(true)
39
+ get '/helper/email_path'
40
+
41
+ assert body == "/images/email.png"
42
+ end
43
+
44
+ test "image_path existing (production)" do
45
+ app.stubs(:development?).returns(false)
46
+ get '/helper/email_path'
47
+
48
+ assert body =~ %r{\A/images/email.[a-f0-9]{32}.png\z}
49
+ end
50
+
29
51
  test "css" do
30
52
  re = Array.new
31
53
  get '/helper/css/app'; re << body
@@ -32,4 +32,13 @@ class LocalFileTest < UnitTest
32
32
  fn = App.assets.local_file_for '/images/404.jpg'
33
33
  assert fn.nil?
34
34
  end
35
+
36
+ test "local file for (with remote url)" do
37
+ url = 'http://example.com/images/200.jpg'
38
+ copy = url.dup
39
+ fn = App.assets.local_file_for copy
40
+ assert fn.nil?
41
+ assert_equal url, copy
42
+ end
43
+
35
44
  end
@@ -19,6 +19,18 @@ class SubpathTest < UnitTest
19
19
  assert body =~ %r{link rel='stylesheet' href='/subpath/css/application.[a-f0-9]{32}.css' media='screen'}
20
20
  end
21
21
 
22
+ test "helpers img (mounted on a subpath, development)" do
23
+ Main.settings.stubs(:environment).returns(:development)
24
+ get '/subpath/helpers/email'
25
+ assert body =~ %r{src='/subpath/images/email.png'}
26
+ end
27
+
28
+ test "helpers img (mounted on a subpath, production)" do
29
+ Main.settings.stubs(:environment).returns(:production)
30
+ get '/subpath/helpers/email'
31
+ assert body =~ %r{src='/subpath/images/email.[a-f0-9]{32}.png'}
32
+ end
33
+
22
34
  test '/subpath/js/hello.js (plain js)' do
23
35
  get '/subpath/js/hello.js'
24
36
  assert body == '$(function() { alert("Hello"); });'
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.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rico Sta. Cruz
@@ -30,160 +30,166 @@ cert_chain:
30
30
  kzgF4O2OL+8O23we4E1LvfRn5gV77Dij6s9V4HHzMBuLwnNb8T+6lOnUWbtiIddD
31
31
  e8c8i7PlrzhVJ/8sXUJsCkyE8d2MyRyjlxM=
32
32
  -----END CERTIFICATE-----
33
- date: 2013-08-01 00:00:00.000000000 Z
33
+ date: 2014-01-10 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: jsmin
37
37
  requirement: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  type: :runtime
43
43
  prerelease: false
44
44
  version_requirements: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - '>='
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: rack-test
51
51
  requirement: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - '>='
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  type: :runtime
57
57
  prerelease: false
58
58
  version_requirements: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - '>='
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  - !ruby/object:Gem::Dependency
64
64
  name: sinatra
65
65
  requirement: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - '>='
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - '>='
74
+ - - ">="
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  - !ruby/object:Gem::Dependency
78
78
  name: tilt
79
79
  requirement: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - '>='
81
+ - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: 1.3.0
84
+ - - "<"
85
+ - !ruby/object:Gem::Version
86
+ version: '2.0'
84
87
  type: :runtime
85
88
  prerelease: false
86
89
  version_requirements: !ruby/object:Gem::Requirement
87
90
  requirements:
88
- - - '>='
91
+ - - ">="
89
92
  - !ruby/object:Gem::Version
90
93
  version: 1.3.0
94
+ - - "<"
95
+ - !ruby/object:Gem::Version
96
+ version: '2.0'
91
97
  - !ruby/object:Gem::Dependency
92
98
  name: coffee-script
93
99
  requirement: !ruby/object:Gem::Requirement
94
100
  requirements:
95
- - - '>='
101
+ - - ">="
96
102
  - !ruby/object:Gem::Version
97
103
  version: '0'
98
104
  type: :development
99
105
  prerelease: false
100
106
  version_requirements: !ruby/object:Gem::Requirement
101
107
  requirements:
102
- - - '>='
108
+ - - ">="
103
109
  - !ruby/object:Gem::Version
104
110
  version: '0'
105
111
  - !ruby/object:Gem::Dependency
106
112
  name: haml
107
113
  requirement: !ruby/object:Gem::Requirement
108
114
  requirements:
109
- - - '>='
115
+ - - ">="
110
116
  - !ruby/object:Gem::Version
111
117
  version: '0'
112
118
  type: :development
113
119
  prerelease: false
114
120
  version_requirements: !ruby/object:Gem::Requirement
115
121
  requirements:
116
- - - '>='
122
+ - - ">="
117
123
  - !ruby/object:Gem::Version
118
124
  version: '0'
119
125
  - !ruby/object:Gem::Dependency
120
126
  name: less
121
127
  requirement: !ruby/object:Gem::Requirement
122
128
  requirements:
123
- - - '>='
129
+ - - ">="
124
130
  - !ruby/object:Gem::Version
125
131
  version: '0'
126
132
  type: :development
127
133
  prerelease: false
128
134
  version_requirements: !ruby/object:Gem::Requirement
129
135
  requirements:
130
- - - '>='
136
+ - - ">="
131
137
  - !ruby/object:Gem::Version
132
138
  version: '0'
133
139
  - !ruby/object:Gem::Dependency
134
140
  name: sass
135
141
  requirement: !ruby/object:Gem::Requirement
136
142
  requirements:
137
- - - '>='
143
+ - - ">="
138
144
  - !ruby/object:Gem::Version
139
145
  version: '0'
140
146
  type: :development
141
147
  prerelease: false
142
148
  version_requirements: !ruby/object:Gem::Requirement
143
149
  requirements:
144
- - - '>='
150
+ - - ">="
145
151
  - !ruby/object:Gem::Version
146
152
  version: '0'
147
153
  - !ruby/object:Gem::Dependency
148
154
  name: stylus
149
155
  requirement: !ruby/object:Gem::Requirement
150
156
  requirements:
151
- - - '>='
157
+ - - ">="
152
158
  - !ruby/object:Gem::Version
153
159
  version: '0'
154
160
  type: :development
155
161
  prerelease: false
156
162
  version_requirements: !ruby/object:Gem::Requirement
157
163
  requirements:
158
- - - '>='
164
+ - - ">="
159
165
  - !ruby/object:Gem::Version
160
166
  version: '0'
161
167
  - !ruby/object:Gem::Dependency
162
168
  name: uglifier
163
169
  requirement: !ruby/object:Gem::Requirement
164
170
  requirements:
165
- - - '>='
171
+ - - ">="
166
172
  - !ruby/object:Gem::Version
167
173
  version: '0'
168
174
  type: :development
169
175
  prerelease: false
170
176
  version_requirements: !ruby/object:Gem::Requirement
171
177
  requirements:
172
- - - '>='
178
+ - - ">="
173
179
  - !ruby/object:Gem::Version
174
180
  version: '0'
175
181
  - !ruby/object:Gem::Dependency
176
182
  name: yui-compressor
177
183
  requirement: !ruby/object:Gem::Requirement
178
184
  requirements:
179
- - - '>='
185
+ - - ">="
180
186
  - !ruby/object:Gem::Version
181
187
  version: '0'
182
188
  type: :development
183
189
  prerelease: false
184
190
  version_requirements: !ruby/object:Gem::Requirement
185
191
  requirements:
186
- - - '>='
192
+ - - ">="
187
193
  - !ruby/object:Gem::Version
188
194
  version: '0'
189
195
  description: Package your assets for Sinatra.
@@ -193,8 +199,8 @@ executables: []
193
199
  extensions: []
194
200
  extra_rdoc_files: []
195
201
  files:
196
- - .gitignore
197
- - .travis.yml
202
+ - ".gitignore"
203
+ - ".travis.yml"
198
204
  - CHANGELOG.md
199
205
  - CONTRIBUTING.md
200
206
  - Gemfile
@@ -327,20 +333,20 @@ homepage: http://github.com/rstacruz/sinatra-assetpack
327
333
  licenses:
328
334
  - MIT
329
335
  metadata: {}
330
- post_install_message: |-
336
+ post_install_message: |
331
337
  ##################################################
332
338
  # NOTE FOR UPGRADING FROM PRE-3.0.0 VERSION #
333
339
  ##################################################
334
340
 
335
341
  Please note that sinatra-assetpack `img` helper method
336
- no more set the image width and height because this default
337
- behavior is not desirable with most recent CSS techniques
342
+ no longer sets the image width and height. This default
343
+ behavior is not desirable with more recent CSS techniques
338
344
  regarding high resolutions images for "retina" displays
339
- ans "responsive" design CSS using for exemple width:100%.
345
+ and "responsive" design CSS using, for example, width:100%.
340
346
 
341
347
  <img src="retina.jpg" width="1200" height="600">
342
348
 
343
- Is now simply this (unless you explicity set them) :
349
+ Is now simply this (unless you explicitly set them) :
344
350
 
345
351
  <img src="retina.jpg">
346
352
 
@@ -350,17 +356,17 @@ require_paths:
350
356
  - lib
351
357
  required_ruby_version: !ruby/object:Gem::Requirement
352
358
  requirements:
353
- - - '>='
359
+ - - ">="
354
360
  - !ruby/object:Gem::Version
355
361
  version: 1.9.2
356
362
  required_rubygems_version: !ruby/object:Gem::Requirement
357
363
  requirements:
358
- - - '>='
364
+ - - ">="
359
365
  - !ruby/object:Gem::Version
360
366
  version: '0'
361
367
  requirements: []
362
368
  rubyforge_project:
363
- rubygems_version: 2.0.3
369
+ rubygems_version: 2.2.0
364
370
  signing_key:
365
371
  specification_version: 4
366
372
  summary: Asset packager for Sinatra.
metadata.gz.sig CHANGED
Binary file