asset_hat 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +10 -0
- data/README.rdoc +3 -1
- data/Rakefile +2 -2
- data/VERSION.yml +4 -4
- data/asset_hat.gemspec +7 -8
- data/doc/classes/AssetHat.html +1 -1
- data/doc/classes/AssetHat/JS/Engines.html +1 -1
- data/doc/created.rid +1 -1
- data/doc/files/HISTORY.html +45 -28
- data/doc/files/README_rdoc.html +4 -2
- data/lib/asset_hat.rb +1 -1
- data/lib/asset_hat/js.rb +1 -1
- data/lib/asset_hat/tasks/css.rb +2 -2
- data/lib/asset_hat/tasks/js.rb +3 -3
- data/test/asset_hat_helper_test.rb +20 -0
- data/test/asset_hat_test.rb +7 -0
- metadata +11 -11
data/HISTORY
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
= HISTORY
|
2
2
|
|
3
|
+
== Version 0.3.1 (2011-04-02)
|
4
|
+
* IMPROVEMENT: Added tolerance for `.css` and `.js` extensions in assets.yml,
|
5
|
+
even though you don't need them.
|
6
|
+
* IMPROVEMENT: Added support for symbols as bundle names, e.g.,
|
7
|
+
`include_js :bundle => :application`. Thanks,
|
8
|
+
daphonz[https://github.com/daphonz]!
|
9
|
+
* FIX: Worked around a JSMin bug that causes an error when JS ends with a
|
10
|
+
comment and no line break.
|
11
|
+
|
12
|
+
== Version 0.3.0 (2010-12-08)
|
3
13
|
* FEATURE: Added ERb support in `config/assets.yml`.
|
4
14
|
* FEATURE: Added support for auto-creating SSL versions of every stylesheet.
|
5
15
|
* FEATURE: Added support for loading remote JS via SSL. Includes loading
|
data/README.rdoc
CHANGED
@@ -38,7 +38,9 @@ And this in your deploy script:
|
|
38
38
|
|
39
39
|
rake asset_hat:minify
|
40
40
|
|
41
|
-
Tested with Rails 2.3.x. For
|
41
|
+
Tested with Rails 2.3.x. For a quick overview, see
|
42
|
+
{the AssetHat website}[http://mintdigital.github.com/asset_hat/].
|
43
|
+
For the gritty details, check the
|
42
44
|
{complete docs}[http://mintdigital.github.com/asset_hat/doc/] and
|
43
45
|
{change history}[http://mintdigital.github.com/asset_hat/doc/files/HISTORY.html].
|
44
46
|
|
data/Rakefile
CHANGED
@@ -14,14 +14,14 @@ begin
|
|
14
14
|
CDN in production. Can rewrite stylesheets to use CDN hosts (not just
|
15
15
|
your web server) and cache-busting hashes for updated images.
|
16
16
|
}.strip.gsub(/\s+/, ' ')
|
17
|
-
gemspec.homepage = 'http://github.com/
|
17
|
+
gemspec.homepage = 'http://mintdigital.github.com/asset_hat'
|
18
18
|
|
19
19
|
gemspec.authors = ['Ron DeVera', 'Mint Digital']
|
20
20
|
gemspec.email = 'hello@rondevera.com'
|
21
21
|
|
22
22
|
gemspec.add_development_dependency 'flexmock', '~> 0.8.6'
|
23
23
|
gemspec.add_development_dependency 'hanna', '~> 0.1.12'
|
24
|
-
gemspec.add_development_dependency 'jeweler', '~> 1.
|
24
|
+
gemspec.add_development_dependency 'jeweler', '~> 1.5.1'
|
25
25
|
gemspec.add_development_dependency 'shoulda', '~> 2.10.2'
|
26
26
|
gemspec.add_runtime_dependency 'cssmin', '~> 1.0.2'
|
27
27
|
gemspec.add_runtime_dependency 'jsmin', '~> 1.0.1'
|
data/VERSION.yml
CHANGED
data/asset_hat.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{asset_hat}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ron DeVera", "Mint Digital"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-04-02}
|
13
13
|
s.description = %q{Minifies, bundles, and optimizes CSS/JS assets ahead of time (e.g., on deploy), not at runtime. Loads popular JS frameworks (like jQuery and Prototype) from localhost in development, and auto-switches to Google's CDN in production. Can rewrite stylesheets to use CDN hosts (not just your web server) and cache-busting hashes for updated images.}
|
14
14
|
s.email = %q{hello@rondevera.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -95,9 +95,9 @@ Gem::Specification.new do |s|
|
|
95
95
|
"test/asset_hat_test.rb",
|
96
96
|
"test/test_helper.rb"
|
97
97
|
]
|
98
|
-
s.homepage = %q{http://github.com/
|
98
|
+
s.homepage = %q{http://mintdigital.github.com/asset_hat}
|
99
99
|
s.require_paths = ["lib"]
|
100
|
-
s.rubygems_version = %q{1.
|
100
|
+
s.rubygems_version = %q{1.5.2}
|
101
101
|
s.summary = %q{Your assets are covered.}
|
102
102
|
s.test_files = [
|
103
103
|
"test/asset_hat_helper_test.rb",
|
@@ -106,20 +106,19 @@ Gem::Specification.new do |s|
|
|
106
106
|
]
|
107
107
|
|
108
108
|
if s.respond_to? :specification_version then
|
109
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
110
109
|
s.specification_version = 3
|
111
110
|
|
112
111
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
113
112
|
s.add_development_dependency(%q<flexmock>, ["~> 0.8.6"])
|
114
113
|
s.add_development_dependency(%q<hanna>, ["~> 0.1.12"])
|
115
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.
|
114
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
|
116
115
|
s.add_development_dependency(%q<shoulda>, ["~> 2.10.2"])
|
117
116
|
s.add_runtime_dependency(%q<cssmin>, ["~> 1.0.2"])
|
118
117
|
s.add_runtime_dependency(%q<jsmin>, ["~> 1.0.1"])
|
119
118
|
else
|
120
119
|
s.add_dependency(%q<flexmock>, ["~> 0.8.6"])
|
121
120
|
s.add_dependency(%q<hanna>, ["~> 0.1.12"])
|
122
|
-
s.add_dependency(%q<jeweler>, ["~> 1.
|
121
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
123
122
|
s.add_dependency(%q<shoulda>, ["~> 2.10.2"])
|
124
123
|
s.add_dependency(%q<cssmin>, ["~> 1.0.2"])
|
125
124
|
s.add_dependency(%q<jsmin>, ["~> 1.0.1"])
|
@@ -127,7 +126,7 @@ Gem::Specification.new do |s|
|
|
127
126
|
else
|
128
127
|
s.add_dependency(%q<flexmock>, ["~> 0.8.6"])
|
129
128
|
s.add_dependency(%q<hanna>, ["~> 0.1.12"])
|
130
|
-
s.add_dependency(%q<jeweler>, ["~> 1.
|
129
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
131
130
|
s.add_dependency(%q<shoulda>, ["~> 2.10.2"])
|
132
131
|
s.add_dependency(%q<cssmin>, ["~> 1.0.2"])
|
133
132
|
s.add_dependency(%q<jsmin>, ["~> 1.0.1"])
|
data/doc/classes/AssetHat.html
CHANGED
@@ -268,7 +268,7 @@
|
|
268
268
|
<a class='source-toggle' href='#' onclick="toggleCode('M000011-source'); return false">
|
269
269
|
[show source]
|
270
270
|
</a>
|
271
|
-
<pre id='M000011-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 169</span>
169: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">bundle_filenames</span>(<span class="ruby-identifier">bundle</span>, <span class="ruby-identifier">type</span>)
170: <span class="ruby-comment cmt"># Process arguments</span>
171: <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">TYPES</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_sym</span>)
172: <span class="ruby-identifier">raise</span> <span class="ruby-node">"Unknown type \"#{type}\"; should be one of: #{TYPES.join(', ')}."</span>
173: <span class="ruby-keyword kw">return</span>
174: <span class="ruby-keyword kw">end</span>
175: 
176: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">config</span>[<span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_s</span>][<span class="ruby-value str">'bundles'</span>][<span class="ruby-identifier">bundle</span>] <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
177: <span class="ruby-keyword kw">end</span></pre>
|
271
|
+
<pre id='M000011-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 169</span>
169: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">bundle_filenames</span>(<span class="ruby-identifier">bundle</span>, <span class="ruby-identifier">type</span>)
170: <span class="ruby-comment cmt"># Process arguments</span>
171: <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">TYPES</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_sym</span>)
172: <span class="ruby-identifier">raise</span> <span class="ruby-node">"Unknown type \"#{type}\"; should be one of: #{TYPES.join(', ')}."</span>
173: <span class="ruby-keyword kw">return</span>
174: <span class="ruby-keyword kw">end</span>
175: 
176: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">config</span>[<span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_s</span>][<span class="ruby-value str">'bundles'</span>][<span class="ruby-identifier">bundle</span>.<span class="ruby-identifier">to_s</span>] <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
177: <span class="ruby-keyword kw">end</span></pre>
|
272
272
|
</div>
|
273
273
|
</div>
|
274
274
|
<div class='method public-class' id='method-M000012'>
|
@@ -80,7 +80,7 @@
|
|
80
80
|
<a class='source-toggle' href='#' onclick="toggleCode('M000026-source'); return false">
|
81
81
|
[show source]
|
82
82
|
</a>
|
83
|
-
<pre id='M000026-source'> <span class="ruby-comment cmt"># File lib/asset_hat/js.rb, line 79</span>
79: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">jsmin</span>(<span class="ruby-identifier">input_string</span>)
80: <span class="ruby-constant">JSMin</span>.<span class="ruby-identifier">minify</span>(<span class="ruby-identifier">input_string</span>)
81: <span class="ruby-keyword kw">end</span></pre>
|
83
|
+
<pre id='M000026-source'> <span class="ruby-comment cmt"># File lib/asset_hat/js.rb, line 79</span>
79: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">jsmin</span>(<span class="ruby-identifier">input_string</span>)
80: <span class="ruby-constant">JSMin</span>.<span class="ruby-identifier">minify</span>(<span class="ruby-identifier">input_string</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"\n"</span>)
81: <span class="ruby-keyword kw">end</span></pre>
|
84
84
|
</div>
|
85
85
|
</div>
|
86
86
|
<div class='method public-class' id='method-M000025'>
|
data/doc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Sat, 02 Apr 2011 23:06:30 -0400
|
data/doc/files/HISTORY.html
CHANGED
@@ -9,14 +9,14 @@
|
|
9
9
|
function popupCode(url) {
|
10
10
|
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
11
11
|
}
|
12
|
-
|
12
|
+
|
13
13
|
function toggleCode(id) {
|
14
14
|
var code = document.getElementById(id)
|
15
|
-
|
15
|
+
|
16
16
|
code.style.display = code.style.display != 'block' ? 'block' : 'none'
|
17
17
|
return true
|
18
18
|
}
|
19
|
-
|
19
|
+
|
20
20
|
// Make codeblocks hidden by default
|
21
21
|
document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
|
22
22
|
//]]>
|
@@ -31,76 +31,93 @@
|
|
31
31
|
</div>
|
32
32
|
<div class='last-update'>
|
33
33
|
Last Update:
|
34
|
-
<span class='datetime'>
|
34
|
+
<span class='datetime'>Sat Apr 02 23:06:23 -0400 2011</span>
|
35
35
|
</div>
|
36
36
|
</div>
|
37
37
|
<div id='content'>
|
38
38
|
<div id='text'>
|
39
39
|
<div id='description'>
|
40
40
|
<h1><a href="HISTORY.html">HISTORY</a></h1>
|
41
|
+
<h2>Version 0.3.1 (2011-04-02)</h2>
|
42
|
+
<ul>
|
43
|
+
<li>IMPROVEMENT: Added tolerance for `.css` and `.js` extensions in assets.yml,
|
44
|
+
even though you don’t need them.
|
45
|
+
|
46
|
+
</li>
|
47
|
+
<li>IMPROVEMENT: Added support for symbols as bundle names, e.g., `include_js
|
48
|
+
:bundle => :application`. Thanks, <a
|
49
|
+
href="https://github.com/daphonz">daphonz</a>!
|
50
|
+
|
51
|
+
</li>
|
52
|
+
<li>FIX: Worked around a JSMin bug that causes an error when JS ends with a
|
53
|
+
comment and no line break.
|
54
|
+
|
55
|
+
</li>
|
56
|
+
</ul>
|
57
|
+
<h2>Version 0.3.0 (2010-12-08)</h2>
|
41
58
|
<ul>
|
42
59
|
<li>FEATURE: Added ERb support in `config/assets.yml`.
|
43
|
-
|
60
|
+
|
44
61
|
</li>
|
45
62
|
<li>FEATURE: Added support for auto-creating SSL versions of every stylesheet.
|
46
|
-
|
63
|
+
|
47
64
|
</li>
|
48
65
|
<li>FEATURE: Added support for loading remote JS via SSL. Includes loading
|
49
66
|
popular JS from `<a
|
50
67
|
href="https://ajax.googleapis.com">ajax.googleapis.com</a>` or your own
|
51
68
|
CDN.
|
52
|
-
|
69
|
+
|
53
70
|
</li>
|
54
71
|
<li>FEATURE: Added support for `FORMAT=long|short|dot` flags for `rake
|
55
72
|
asset_hat:minify`. Useful for shortening output from deployment scripts.
|
56
|
-
|
73
|
+
|
57
74
|
</li>
|
58
75
|
<li>FEATURE: Added support for absolute paths in `config/assets.yml`. Allows
|
59
76
|
pointing to assets directly inside `public/`.
|
60
|
-
|
77
|
+
|
61
78
|
</li>
|
62
79
|
<li>FEATURE: Added `asset_hat:minify:css` and `asset_hat:minify:js` Rake task
|
63
80
|
aliases.
|
64
|
-
|
81
|
+
|
65
82
|
</li>
|
66
83
|
<li>IMPROVEMENT: Updated default CSS minification engine to remove rules that
|
67
84
|
have empty declaration blocks.
|
68
|
-
|
85
|
+
|
69
86
|
</li>
|
70
87
|
<li>IMPROVEMENT: Stopped pre-caching asset commit IDs when launching console.
|
71
|
-
|
88
|
+
|
72
89
|
</li>
|
73
90
|
<li>IMPROVEMENT: Added support for single/double quotation marks in `url()` CSS
|
74
91
|
when adding asset hosts and cache busters
|
75
|
-
|
92
|
+
|
76
93
|
</li>
|
77
94
|
<li>FIX: Fixed adding asset commit IDs to URLs containing “?” in
|
78
95
|
stylesheets.
|
79
|
-
|
96
|
+
|
80
97
|
</li>
|
81
98
|
</ul>
|
82
99
|
<h2>Version 0.2.1 (2010-07-21)</h2>
|
83
100
|
<ul>
|
84
101
|
<li>FEATURE: Added WebFont Loader to supported JS vendors.
|
85
|
-
|
102
|
+
|
86
103
|
</li>
|
87
104
|
<li>FIX: Stopped adding asset hosts to `url(/htc/...)` URLs because IE 6, by
|
88
105
|
default, refuses to run .htc files from other domains, including CDN
|
89
106
|
subdomains.
|
90
|
-
|
107
|
+
|
91
108
|
</li>
|
92
109
|
</ul>
|
93
110
|
<h2>Version 0.2.0 (2010-06-10)</h2>
|
94
111
|
<ul>
|
95
112
|
<li>FEATURE: Added support for loading many more JS vendors from Google’s
|
96
113
|
CDN, including Prototype, MooTools, and SWFObject.
|
97
|
-
|
114
|
+
|
98
115
|
</li>
|
99
116
|
<li>FEATURE: Cleaned up existing docs, and added complete RDoc documentation.
|
100
|
-
|
117
|
+
|
101
118
|
</li>
|
102
119
|
<li>FEATURE: Added example integration script for Capistrano deployments.
|
103
|
-
|
120
|
+
|
104
121
|
</li>
|
105
122
|
</ul>
|
106
123
|
<h2>Version 0.1.5 (2010-03-11)</h2>
|
@@ -108,52 +125,52 @@
|
|
108
125
|
<li>FIX: Fixed fetching asset commit IDs in some environments. The bug was
|
109
126
|
possibly caused by older versions of Git, which fail to read logs properly
|
110
127
|
when given absolute paths, rather than relative paths.
|
111
|
-
|
128
|
+
|
112
129
|
</li>
|
113
130
|
<li>FIX: Stopped app tests from running twice in some environments.
|
114
|
-
|
131
|
+
|
115
132
|
</li>
|
116
133
|
</ul>
|
117
134
|
<h2>Version 0.1.4 (2010-03-03)</h2>
|
118
135
|
<ul>
|
119
136
|
<li>FIX: Fixed config filepaths in `asset_hat:config` task.
|
120
|
-
|
137
|
+
|
121
138
|
</li>
|
122
139
|
</ul>
|
123
140
|
<h2>Version 0.1.3 (2010-03-03)</h2>
|
124
141
|
<ul>
|
125
142
|
<li>FIX: Allowed adding commit IDs and asset hosts to `url(/htc/...)` URLs
|
126
143
|
(e.g., `/htc/iepngfix.htc`) in CSS, not just images.
|
127
|
-
|
144
|
+
|
128
145
|
</li>
|
129
146
|
<li>FIX: Changed `<a
|
130
147
|
href="../classes/AssetHat.html#M000005">AssetHat.config</a>` to memoize
|
131
148
|
only if `cache?` is true. In development environments, this means the
|
132
149
|
config file will be reread with every request.
|
133
|
-
|
150
|
+
|
134
151
|
</li>
|
135
152
|
</ul>
|
136
153
|
<h2>Version 0.1.2 (2010-01-27)</h2>
|
137
154
|
<ul>
|
138
155
|
<li>IMPROVEMENT: Memoized HTML output from `include_css` and `include_js` when
|
139
156
|
`<a href="../classes/AssetHat.html#M000009">AssetHat.cache?</a>` is true.
|
140
|
-
|
157
|
+
|
141
158
|
</li>
|
142
159
|
</ul>
|
143
160
|
<h2>Version 0.1.1 (2010-01-20)</h2>
|
144
161
|
<ul>
|
145
162
|
<li>FIX: Rewrote `AssetHat::VERSION` to be based on `VERSION.yml`.
|
146
|
-
|
163
|
+
|
147
164
|
</li>
|
148
165
|
<li>FIX: Prefixed `AssetHat::CONFIG_FILEPATH` with `RAILS_ROOT`, which fixes
|
149
166
|
ability to run an app’s individual test files.
|
150
|
-
|
167
|
+
|
151
168
|
</li>
|
152
169
|
</ul>
|
153
170
|
<h2>Version 0.1.0 (2010-01-19)</h2>
|
154
171
|
<ul>
|
155
172
|
<li>Initial release.
|
156
|
-
|
173
|
+
|
157
174
|
</li>
|
158
175
|
</ul>
|
159
176
|
</div>
|
data/doc/files/README_rdoc.html
CHANGED
@@ -31,7 +31,7 @@
|
|
31
31
|
</div>
|
32
32
|
<div class='last-update'>
|
33
33
|
Last Update:
|
34
|
-
<span class='datetime'>Wed Dec 08
|
34
|
+
<span class='datetime'>Wed Dec 08 14:43:30 -0500 2010</span>
|
35
35
|
</div>
|
36
36
|
</div>
|
37
37
|
<div id='content'>
|
@@ -79,7 +79,9 @@
|
|
79
79
|
</p>
|
80
80
|
<pre>rake asset_hat:minify</pre>
|
81
81
|
<p>
|
82
|
-
Tested with Rails 2.3.x. For
|
82
|
+
Tested with Rails 2.3.x. For a quick overview, see <a
|
83
|
+
href="http://mintdigital.github.com/asset_hat/">the AssetHat website</a>.
|
84
|
+
For the gritty details, check the <a
|
83
85
|
href="http://mintdigital.github.com/asset_hat/doc/">complete docs</a> and
|
84
86
|
<a
|
85
87
|
href="http://mintdigital.github.com/asset_hat/doc/files/HISTORY.html">change
|
data/lib/asset_hat.rb
CHANGED
data/lib/asset_hat/js.rb
CHANGED
data/lib/asset_hat/tasks/css.rb
CHANGED
@@ -88,7 +88,7 @@ namespace :asset_hat do
|
|
88
88
|
end
|
89
89
|
filepaths = filenames.map do |filename|
|
90
90
|
parts = filename.split(File::SEPARATOR)
|
91
|
-
parts.last << '.' << type
|
91
|
+
parts.last << '.' << type unless parts.last =~ /\.#{type}$/
|
92
92
|
File.join(
|
93
93
|
(parts.first.present? ?
|
94
94
|
AssetHat.assets_dir(type) : # Given path was relative
|
@@ -164,7 +164,7 @@ namespace :asset_hat do
|
|
164
164
|
if opts[:show_intro]
|
165
165
|
print "Minifying #{type.upcase}..."
|
166
166
|
if report_format == 'dot'
|
167
|
-
$stdout.sync = true
|
167
|
+
$stdout.sync = true # Output immediately
|
168
168
|
else
|
169
169
|
puts
|
170
170
|
end
|
data/lib/asset_hat/tasks/js.rb
CHANGED
@@ -41,7 +41,7 @@ namespace :asset_hat do
|
|
41
41
|
|
42
42
|
config = AssetHat.config[type]
|
43
43
|
report_format = ([ENV['FORMAT']] & %w[long short dot])[0] || 'long'
|
44
|
-
$stdout.sync = true if report_format == 'dot'
|
44
|
+
$stdout.sync = true if report_format == 'dot' # Output immediately
|
45
45
|
min_options = {
|
46
46
|
:engine => config['engine']
|
47
47
|
}.reject { |k,v| v.blank? }
|
@@ -54,7 +54,7 @@ namespace :asset_hat do
|
|
54
54
|
end
|
55
55
|
filepaths = filenames.map do |filename|
|
56
56
|
parts = filename.split(File::SEPARATOR)
|
57
|
-
parts.last << '.' << type
|
57
|
+
parts.last << '.' << type unless parts.last =~ /\.#{type}$/
|
58
58
|
File.join(
|
59
59
|
(parts.first.present? ?
|
60
60
|
AssetHat.assets_dir(type) : # Given path was relative
|
@@ -113,7 +113,7 @@ namespace :asset_hat do
|
|
113
113
|
if opts[:show_intro]
|
114
114
|
print "Minifying #{type.upcase}..."
|
115
115
|
if report_format == 'dot'
|
116
|
-
$stdout.sync = true
|
116
|
+
$stdout.sync = true # Output immediately
|
117
117
|
else
|
118
118
|
puts
|
119
119
|
end
|
@@ -118,6 +118,16 @@ class AssetHatHelperTest < ActionView::TestCase
|
|
118
118
|
assert_equal expected, output
|
119
119
|
end
|
120
120
|
|
121
|
+
should 'include a bundle as separate files ' +
|
122
|
+
'with a symbol bundle name' do
|
123
|
+
bundle = 'css-bundle-1'
|
124
|
+
expected = @config['css']['bundles'][bundle].map do |source|
|
125
|
+
css_tag("#{source}.css?#{@asset_id}")
|
126
|
+
end.join("\n")
|
127
|
+
output = include_css(:bundle => bundle.to_sym, :cache => false)
|
128
|
+
assert_equal expected, output
|
129
|
+
end
|
130
|
+
|
121
131
|
should 'include multiple bundles as separate files' do
|
122
132
|
bundles = [1,2,3].map { |i| "css-bundle-#{i}" }
|
123
133
|
expected = bundles.map do |bundle|
|
@@ -403,6 +413,16 @@ class AssetHatHelperTest < ActionView::TestCase
|
|
403
413
|
assert_equal expected, output
|
404
414
|
end
|
405
415
|
|
416
|
+
should 'include a bundle as separate files ' +
|
417
|
+
'with a symbol bundle name' do
|
418
|
+
bundle = 'js-bundle-1'
|
419
|
+
sources = @config['js']['bundles'][bundle]
|
420
|
+
expected = sources.
|
421
|
+
map { |src| js_tag("#{src}.js?#{@asset_id}") }.join("\n")
|
422
|
+
output = include_js(:bundle => bundle.to_sym, :cache => false)
|
423
|
+
assert_equal expected, output
|
424
|
+
end
|
425
|
+
|
406
426
|
should 'include multiple bundles as separate files' do
|
407
427
|
bundles = [1,2,3].map { |i| "js-bundle-#{i}" }
|
408
428
|
expected = bundles.map do |bundle|
|
data/test/asset_hat_test.rb
CHANGED
@@ -228,6 +228,13 @@ class AssetHatTest < ActiveSupport::TestCase
|
|
228
228
|
assert_equal 'foo/bar/baz.min.js',
|
229
229
|
AssetHat::JS.min_filepath('foo/bar/baz.js')
|
230
230
|
end
|
231
|
+
|
232
|
+
context 'with minifying' do
|
233
|
+
should 'minify if a string ends with a comment and no line break' do
|
234
|
+
input = 'foo(); // bar'
|
235
|
+
assert_equal 'foo();', AssetHat::JS.minify(input, :engine => :jsmin)
|
236
|
+
end
|
237
|
+
end # context 'with minifying'
|
231
238
|
end # context 'AssetHat::JS'
|
232
239
|
|
233
240
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asset_hat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 17
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 1
|
10
|
+
version: 0.3.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ron DeVera
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date:
|
19
|
+
date: 2011-04-02 00:00:00 -04:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -59,12 +59,12 @@ dependencies:
|
|
59
59
|
requirements:
|
60
60
|
- - ~>
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
hash:
|
62
|
+
hash: 1
|
63
63
|
segments:
|
64
64
|
- 1
|
65
|
-
-
|
66
|
-
-
|
67
|
-
version: 1.
|
65
|
+
- 5
|
66
|
+
- 1
|
67
|
+
version: 1.5.1
|
68
68
|
type: :development
|
69
69
|
version_requirements: *id003
|
70
70
|
- !ruby/object:Gem::Dependency
|
@@ -203,7 +203,7 @@ files:
|
|
203
203
|
- test/asset_hat_test.rb
|
204
204
|
- test/test_helper.rb
|
205
205
|
has_rdoc: true
|
206
|
-
homepage: http://github.com/
|
206
|
+
homepage: http://mintdigital.github.com/asset_hat
|
207
207
|
licenses: []
|
208
208
|
|
209
209
|
post_install_message:
|
@@ -232,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
232
232
|
requirements: []
|
233
233
|
|
234
234
|
rubyforge_project:
|
235
|
-
rubygems_version: 1.
|
235
|
+
rubygems_version: 1.5.2
|
236
236
|
signing_key:
|
237
237
|
specification_version: 3
|
238
238
|
summary: Your assets are covered.
|