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&#8217; 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>&#x000A;65: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">config</span>&#x000A;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>&#x000A;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>))&#x000A;68: <span class="ruby-keyword kw">end</span>&#x000A;69: <span class="ruby-ivar">@config</span>&#x000A;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>&#x000A;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>)&#x000A;46: <span class="ruby-comment cmt"># Process arguments</span>&#x000A;47: <span class="ruby-identifier">type</span> = <span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_sym</span>&#x000A;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>)&#x000A;49: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Unknown type \&quot;#{type}\&quot;; should be one of: #{TYPES.join(', ')}.&quot;</span>&#x000A;50: <span class="ruby-keyword kw">return</span>&#x000A;51: <span class="ruby-keyword kw">end</span>&#x000A;52: &#x000A;53: <span class="ruby-comment cmt"># Default to `{:css =&gt; {}, :js =&gt; {}}`</span>&#x000A;54: <span class="ruby-ivar">@last_bundle_commit_ids</span> <span class="ruby-operator">||=</span>&#x000A;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">&gt;</span> {}) }&#x000A;56: &#x000A;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>&#x000A;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>)&#x000A;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>)&#x000A;60: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">filepaths</span>.<span class="ruby-identifier">present?</span>&#x000A;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>)&#x000A;62: <span class="ruby-keyword kw">end</span>&#x000A;63: <span class="ruby-keyword kw">end</span>&#x000A;64: &#x000A;65: <span class="ruby-ivar">@last_bundle_commit_ids</span>[<span class="ruby-identifier">type</span>][<span class="ruby-identifier">bundle</span>]&#x000A;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>&#x000A;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>)&#x000A;46: <span class="ruby-comment cmt"># Process arguments</span>&#x000A;47: <span class="ruby-identifier">type</span> = <span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_sym</span>&#x000A;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>)&#x000A;49: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Unknown type \&quot;#{type}\&quot;; should be one of: #{TYPES.join(', ')}.&quot;</span>&#x000A;50: <span class="ruby-keyword kw">return</span>&#x000A;51: <span class="ruby-keyword kw">end</span>&#x000A;52: &#x000A;53: <span class="ruby-comment cmt"># Default to `{:css =&gt; {}, :js =&gt; {}}`</span>&#x000A;54: <span class="ruby-ivar">@last_bundle_commit_ids</span> <span class="ruby-operator">||=</span>&#x000A;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">&gt;</span> {}) }&#x000A;56: &#x000A;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>&#x000A;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>)&#x000A;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>)&#x000A;60: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">filepaths</span>.<span class="ruby-identifier">present?</span>&#x000A;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>)&#x000A;62: <span class="ruby-keyword kw">end</span>&#x000A;63: <span class="ruby-keyword kw">end</span>&#x000A;64: &#x000A;65: <span class="ruby-ivar">@last_bundle_commit_ids</span>[<span class="ruby-identifier">type</span>][<span class="ruby-identifier">bundle</span>]&#x000A;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>&#x000A;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>)&#x000A;125: <span class="ruby-identifier">filepath</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-node">/([^\.]*).#{extension}$/</span>, <span class="ruby-node">&quot;\\1.min.#{extension}&quot;</span>)&#x000A;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&#8217;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>&#x000A;3: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">version</span>&#x000A;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>)&#x000A;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>))&#x000A;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>].&#x000A;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">&amp;</span><span class="ruby-identifier">:blank?</span>).<span class="ruby-identifier">join</span>(<span class="ruby-value str">'.'</span>)&#x000A;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>&#x000A;3: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">version</span>&#x000A;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>)&#x000A;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>))&#x000A;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>].&#x000A;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">&amp;</span><span class="ruby-identifier">:blank?</span>).<span class="ruby-identifier">join</span>(<span class="ruby-value str">'.'</span>)&#x000A;8: <span class="ruby-keyword kw">end</span></pre> </div> </div> </div> </div> </div>