doc/classes/AssetHat.html in asset_hat-0.2.0 vs doc/classes/AssetHat.html in asset_hat-0.2.1
- old
+ new
@@ -60,12 +60,13 @@
Your assets are covered.
</p>
<p>
With Rails’ default asset caching, <a
href="AssetHat/CSS.html">CSS</a> and <a href="AssetHat/JS.html">JS</a> are
- concatenated (not even minified) the first time that bundle is requested.
- Not good enough. <a href="AssetHat.html">AssetHat</a> can automatically:
+ concatenated (not even minified) at runtime when that bundle is first
+ requested. Not good enough. <a href="AssetHat.html">AssetHat</a> can
+ automatically:
</p>
<ul>
<li>Easily <b>minify</b> and <b>bundle</b> <a href="AssetHat/CSS.html">CSS</a>
and <a href="AssetHat/JS.html">JS</a> on deploy to reduce file sizes and
HTTP requests.
@@ -107,14 +108,14 @@
<li><a href="#M000009">bundle_filenames</a></li>
<li><a href="#M000010">bundle_filepaths</a></li>
<li><a href="#M000007">cache?</a></li>
<li><a href="#M000011">clear_html_cache</a></li>
<li><a href="#M000004">config</a></li>
- <li><a href="#M000002">last_bundle_commit_id</a></li>
+ <li><a href="#M000003">last_bundle_commit_id</a></li>
<li><a href="#M000001">last_commit_id</a></li>
<li><a href="#M000008">min_filepath</a></li>
- <li><a href="#M000003">version</a></li>
+ <li><a href="#M000002">version</a></li>
</ol>
</div>
<div id='section'>
<div id='class-list'>
<h2>Classes and Modules</h2>
@@ -336,12 +337,12 @@
[show source]
</a>
<pre id='M000004-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 65</span>
65: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">config</span>
66: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">cache?</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@config</span>.<span class="ruby-identifier">blank?</span>
67: <span class="ruby-ivar">@config</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-constant">CONFIG_FILEPATH</span>, <span class="ruby-value str">'r'</span>))
68: <span class="ruby-keyword kw">end</span>
69: <span class="ruby-ivar">@config</span>
70: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
- <div class='method public-class' id='method-M000002'>
- <a name='M000002'></a>
+ <div class='method public-class' id='method-M000003'>
+ <a name='M000003'></a>
<div class='synopsis'>
<span class='name'>last_bundle_commit_id</span>
<span class='arguments'>(bundle, type)</span>
</div>
<div class='description'>
@@ -354,14 +355,14 @@
which of its files were most recently modified in the repository. If no ID
can be found, `nil` is returned.
</p>
</div>
<div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000002-source'); return false">
+ <a class='source-toggle' href='#' onclick="toggleCode('M000003-source'); return false">
[show source]
</a>
- <pre id='M000002-source'> <span class="ruby-comment cmt"># File lib/asset_hat/vcs.rb, line 45</span>
45: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">last_bundle_commit_id</span>(<span class="ruby-identifier">bundle</span>, <span class="ruby-identifier">type</span>)
46: <span class="ruby-comment cmt"># Process arguments</span>
47: <span class="ruby-identifier">type</span> = <span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_sym</span>
48: <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>)
49: <span class="ruby-identifier">raise</span> <span class="ruby-node">"Unknown type \"#{type}\"; should be one of: #{TYPES.join(', ')}."</span>
50: <span class="ruby-keyword kw">return</span>
51: <span class="ruby-keyword kw">end</span>
52: 
53: <span class="ruby-comment cmt"># Default to `{:css => {}, :js => {}}`</span>
54: <span class="ruby-ivar">@last_bundle_commit_ids</span> <span class="ruby-operator">||=</span>
55: <span class="ruby-constant">TYPES</span>.<span class="ruby-identifier">inject</span>({}) { <span class="ruby-operator">|</span><span class="ruby-identifier">hsh</span>, <span class="ruby-identifier">t</span><span class="ruby-operator">|</span> <span class="ruby-identifier">hsh</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">t</span> =<span class="ruby-operator">></span> {}) }
56: 
57: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@last_bundle_commit_ids</span>[<span class="ruby-identifier">type</span>][<span class="ruby-identifier">bundle</span>].<span class="ruby-identifier">blank?</span>
58: <span class="ruby-identifier">dir</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">assets_dir</span>(<span class="ruby-identifier">type</span>)
59: <span class="ruby-identifier">filepaths</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">bundle_filepaths</span>(<span class="ruby-identifier">bundle</span>, <span class="ruby-identifier">type</span>)
60: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">filepaths</span>.<span class="ruby-identifier">present?</span>
61: <span class="ruby-ivar">@last_bundle_commit_ids</span>[<span class="ruby-identifier">type</span>][<span class="ruby-identifier">bundle</span>] = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">last_commit_id</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">filepaths</span>)
62: <span class="ruby-keyword kw">end</span>
63: <span class="ruby-keyword kw">end</span>
64: 
65: <span class="ruby-ivar">@last_bundle_commit_ids</span>[<span class="ruby-identifier">type</span>][<span class="ruby-identifier">bundle</span>]
66: <span class="ruby-keyword kw">end</span></pre>
+ <pre id='M000003-source'> <span class="ruby-comment cmt"># File lib/asset_hat/vcs.rb, line 45</span>
45: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">last_bundle_commit_id</span>(<span class="ruby-identifier">bundle</span>, <span class="ruby-identifier">type</span>)
46: <span class="ruby-comment cmt"># Process arguments</span>
47: <span class="ruby-identifier">type</span> = <span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_sym</span>
48: <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>)
49: <span class="ruby-identifier">raise</span> <span class="ruby-node">"Unknown type \"#{type}\"; should be one of: #{TYPES.join(', ')}."</span>
50: <span class="ruby-keyword kw">return</span>
51: <span class="ruby-keyword kw">end</span>
52: 
53: <span class="ruby-comment cmt"># Default to `{:css => {}, :js => {}}`</span>
54: <span class="ruby-ivar">@last_bundle_commit_ids</span> <span class="ruby-operator">||=</span>
55: <span class="ruby-constant">TYPES</span>.<span class="ruby-identifier">inject</span>({}) { <span class="ruby-operator">|</span><span class="ruby-identifier">hsh</span>, <span class="ruby-identifier">t</span><span class="ruby-operator">|</span> <span class="ruby-identifier">hsh</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">t</span> =<span class="ruby-operator">></span> {}) }
56: 
57: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@last_bundle_commit_ids</span>[<span class="ruby-identifier">type</span>][<span class="ruby-identifier">bundle</span>].<span class="ruby-identifier">blank?</span>
58: <span class="ruby-identifier">dir</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">assets_dir</span>(<span class="ruby-identifier">type</span>)
59: <span class="ruby-identifier">filepaths</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">bundle_filepaths</span>(<span class="ruby-identifier">bundle</span>, <span class="ruby-identifier">type</span>)
60: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">filepaths</span>.<span class="ruby-identifier">present?</span>
61: <span class="ruby-ivar">@last_bundle_commit_ids</span>[<span class="ruby-identifier">type</span>][<span class="ruby-identifier">bundle</span>] = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">last_commit_id</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">filepaths</span>)
62: <span class="ruby-keyword kw">end</span>
63: <span class="ruby-keyword kw">end</span>
64: 
65: <span class="ruby-ivar">@last_bundle_commit_ids</span>[<span class="ruby-identifier">type</span>][<span class="ruby-identifier">bundle</span>]
66: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
<div class='method public-class' id='method-M000001'>
<a name='M000001'></a>
<div class='synopsis'>
@@ -413,25 +414,25 @@
[show source]
</a>
<pre id='M000008-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 124</span>
124: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">min_filepath</span>(<span class="ruby-identifier">filepath</span>, <span class="ruby-identifier">extension</span>)
125: <span class="ruby-identifier">filepath</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-node">/([^\.]*).#{extension}$/</span>, <span class="ruby-node">"\\1.min.#{extension}"</span>)
126: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
- <div class='method public-class' id='method-M000003'>
- <a name='M000003'></a>
+ <div class='method public-class' id='method-M000002'>
+ <a name='M000002'></a>
<div class='synopsis'>
<span class='name'>version</span>
<span class='arguments'>()</span>
</div>
<div class='description'>
<p>
Returns this gem’s version number. See also VERSION.
</p>
</div>
<div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000003-source'); return false">
+ <a class='source-toggle' href='#' onclick="toggleCode('M000002-source'); return false">
[show source]
</a>
- <pre id='M000003-source'> <span class="ruby-comment cmt"># File lib/asset_hat/version.rb, line 3</span>
3: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">version</span>
4: <span class="ruby-identifier">data_filepath</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword kw">__FILE__</span>), <span class="ruby-node">%w[.. .. VERSION.yml]</span>)
5: <span class="ruby-identifier">data</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">data_filepath</span>, <span class="ruby-value str">'r'</span>))
6: [<span class="ruby-identifier">:major</span>, <span class="ruby-identifier">:minor</span>, <span class="ruby-identifier">:patch</span>, <span class="ruby-identifier">:build</span>].
7: <span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">data</span>[<span class="ruby-identifier">x</span>] }.<span class="ruby-identifier">reject</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">:blank?</span>).<span class="ruby-identifier">join</span>(<span class="ruby-value str">'.'</span>)
8: <span class="ruby-keyword kw">end</span></pre>
+ <pre id='M000002-source'> <span class="ruby-comment cmt"># File lib/asset_hat/version.rb, line 3</span>
3: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">version</span>
4: <span class="ruby-identifier">data_filepath</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword kw">__FILE__</span>), <span class="ruby-node">%w[.. .. VERSION.yml]</span>)
5: <span class="ruby-identifier">data</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">data_filepath</span>, <span class="ruby-value str">'r'</span>))
6: [<span class="ruby-identifier">:major</span>, <span class="ruby-identifier">:minor</span>, <span class="ruby-identifier">:patch</span>, <span class="ruby-identifier">:build</span>].
7: <span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">data</span>[<span class="ruby-identifier">x</span>] }.<span class="ruby-identifier">reject</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">:blank?</span>).<span class="ruby-identifier">join</span>(<span class="ruby-value str">'.'</span>)
8: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>