asset_hat 0.3.1 → 0.4.0
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.
- data/Gemfile +2 -0
 - data/Gemfile.lock +37 -0
 - data/HISTORY +10 -0
 - data/README.rdoc +117 -75
 - data/Rakefile +4 -4
 - data/VERSION.yml +2 -2
 - data/asset_hat.gemspec +69 -7
 - data/config/assets.yml +46 -24
 - data/doc/classes/AssetHat.html +183 -118
 - data/doc/classes/AssetHat/CSS.html +21 -21
 - data/doc/classes/AssetHat/CSS/Engines.html +10 -10
 - data/doc/classes/AssetHat/JS.html +13 -13
 - data/doc/classes/AssetHat/JS/Engines.html +10 -10
 - data/doc/classes/AssetHat/JS/Vendors.html +85 -22
 - data/doc/classes/AssetHatHelper.html +94 -19
 - data/doc/created.rid +1 -1
 - data/doc/files/HISTORY.html +20 -2
 - data/doc/files/LICENSE.html +1 -1
 - data/doc/files/README_rdoc.html +87 -31
 - data/doc/files/lib/asset_hat/capistrano_rb.html +1 -1
 - data/doc/files/lib/asset_hat/css_rb.html +1 -1
 - data/doc/files/lib/asset_hat/initializers/action_view_rb.html +49 -0
 - data/doc/files/lib/asset_hat/initializers/cache_last_commit_ids_rb.html +49 -0
 - data/doc/files/lib/asset_hat/js/vendors_rb.html +1 -1
 - data/doc/files/lib/asset_hat/js_rb.html +1 -1
 - data/doc/files/lib/asset_hat/railtie_rb.html +61 -0
 - data/doc/files/lib/asset_hat/tasks/css_rb.html +1 -1
 - data/doc/files/lib/asset_hat/tasks/js_rb.html +1 -1
 - data/doc/files/lib/asset_hat/tasks_rb.html +2 -1
 - data/doc/files/lib/asset_hat/unicorn_rb.html +58 -0
 - data/doc/files/lib/asset_hat/vcs_rb.html +1 -1
 - data/doc/files/lib/asset_hat/version_rb.html +1 -1
 - data/doc/files/{app/helpers → lib}/asset_hat_helper_rb.html +3 -3
 - data/doc/files/lib/asset_hat_rb.html +9 -1
 - data/doc/files/lib/tasks/asset_hat_rake.html +54 -0
 - data/doc/fr_file_index.html +6 -1
 - data/doc/fr_method_index.html +60 -52
 - data/lib/asset_hat.rb +104 -59
 - data/lib/asset_hat/initializers/action_view.rb +1 -0
 - data/lib/asset_hat/initializers/cache_last_commit_ids.rb +1 -0
 - data/lib/asset_hat/js/vendors.rb +198 -72
 - data/lib/asset_hat/railtie.rb +19 -0
 - data/lib/asset_hat/tasks.rb +5 -2
 - data/lib/asset_hat/unicorn.rb +9 -0
 - data/lib/asset_hat/vcs.rb +3 -2
 - data/{app/helpers → lib}/asset_hat_helper.rb +184 -29
 - data/{tasks → lib/tasks}/asset_hat.rake +0 -0
 - data/rails/init.rb +2 -2
 - data/test/asset_hat_helper_test.rb +731 -148
 - data/test/asset_hat_test.rb +23 -2
 - data/test/test_helper.rb +4 -8
 - metadata +311 -30
 
    
        data/config/assets.yml
    CHANGED
    
    | 
         @@ -1,34 +1,51 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            #  
     | 
| 
       2 
     | 
    
         
            -
            #  
     | 
| 
      
 1 
     | 
    
         
            +
            # Here, you can upgrade your layouts and views to AssetHat. For example, find
         
     | 
| 
      
 2 
     | 
    
         
            +
            # this sort of code in your app:
         
     | 
| 
      
 3 
     | 
    
         
            +
            #
         
     | 
| 
      
 4 
     | 
    
         
            +
            #     stylesheet_link_tag 'reset', 'application'
         
     | 
| 
      
 5 
     | 
    
         
            +
            #     javascript_include_tag(
         
     | 
| 
      
 6 
     | 
    
         
            +
            #       Rails.env.production? ? '<Google CDN URL>' : 'jquery-1.5.2')
         
     | 
| 
      
 7 
     | 
    
         
            +
            #     javascript_include_tag 'utilities', 'application'
         
     | 
| 
      
 8 
     | 
    
         
            +
            #
         
     | 
| 
      
 9 
     | 
    
         
            +
            # Create matching bundles in this file (no `.css` or `.js` suffixes needed;
         
     | 
| 
      
 10 
     | 
    
         
            +
            # ERb is supported if you need it):
         
     | 
| 
       3 
11 
     | 
    
         
             
            #
         
     | 
| 
       4 
12 
     | 
    
         
             
            #     css:
         
     | 
| 
       5 
     | 
    
         
            -
            #       engine: cssmin
         
     | 
| 
       6 
13 
     | 
    
         
             
            #       bundles:
         
     | 
| 
       7 
14 
     | 
    
         
             
            #         application:
         
     | 
| 
       8 
15 
     | 
    
         
             
            #           - reset
         
     | 
| 
       9 
16 
     | 
    
         
             
            #           - application
         
     | 
| 
       10 
     | 
    
         
            -
            #           - clearfix
         
     | 
| 
       11 
     | 
    
         
            -
            #         admin:
         
     | 
| 
       12 
     | 
    
         
            -
            #           - reset
         
     | 
| 
       13 
     | 
    
         
            -
            #           - admin
         
     | 
| 
       14 
     | 
    
         
            -
            #           - clearfix
         
     | 
| 
       15 
17 
     | 
    
         
             
            #     js:
         
     | 
| 
       16 
     | 
    
         
            -
            #       engine: jsmin
         
     | 
| 
       17 
18 
     | 
    
         
             
            #       vendors:
         
     | 
| 
       18 
19 
     | 
    
         
             
            #         jquery:
         
     | 
| 
       19 
     | 
    
         
            -
            #           version: 1. 
     | 
| 
      
 20 
     | 
    
         
            +
            #           version: 1.5.2
         
     | 
| 
       20 
21 
     | 
    
         
             
            #       bundles:
         
     | 
| 
       21 
     | 
    
         
            -
            #          
     | 
| 
       22 
     | 
    
         
            -
            #           - init
         
     | 
| 
       23 
     | 
    
         
            -
            #           - third-party-plugin.min
         
     | 
| 
       24 
     | 
    
         
            -
            #             # Here, the suffix `.min` indicates that the code has already
         
     | 
| 
       25 
     | 
    
         
            -
            #             # been minified, and should not be re-minified.
         
     | 
| 
       26 
     | 
    
         
            -
            #         common:
         
     | 
| 
      
 22 
     | 
    
         
            +
            #         application:
         
     | 
| 
       27 
23 
     | 
    
         
             
            #           - utilities
         
     | 
| 
       28 
24 
     | 
    
         
             
            #           - application
         
     | 
| 
      
 25 
     | 
    
         
            +
            #
         
     | 
| 
      
 26 
     | 
    
         
            +
            # Then, simplify your layouts and views to match your bundles:
         
     | 
| 
      
 27 
     | 
    
         
            +
            #
         
     | 
| 
      
 28 
     | 
    
         
            +
            #     include_css :bundle => 'application'
         
     | 
| 
      
 29 
     | 
    
         
            +
            #     include_js  :jquery, :bundle => 'application'
         
     | 
| 
      
 30 
     | 
    
         
            +
            #
         
     | 
| 
      
 31 
     | 
    
         
            +
            # This makes it really easy to reuse sets of CSS/JS files across layouts.
         
     | 
| 
      
 32 
     | 
    
         
            +
            #
         
     | 
| 
      
 33 
     | 
    
         
            +
            # Lastly, set up your deployment script to run `rake asset_hat:minify`
         
     | 
| 
      
 34 
     | 
    
         
            +
            # automatically. This creates minified versions of your CSS/JS; your original
         
     | 
| 
      
 35 
     | 
    
         
            +
            # code is untouched. If you deploy with Capistrano, here's an example recipe:
         
     | 
| 
      
 36 
     | 
    
         
            +
            # https://github.com/mintdigital/asset_hat/blob/master/lib/asset_hat/capistrano.rb
         
     | 
| 
      
 37 
     | 
    
         
            +
            #
         
     | 
| 
      
 38 
     | 
    
         
            +
            # That's it! In development, individual CSS/JS files are loaded separately,
         
     | 
| 
      
 39 
     | 
    
         
            +
            # and your local copy of jQuery is used. In production, your minified CSS/JS
         
     | 
| 
      
 40 
     | 
    
         
            +
            # bundles are loaded, and jQuery is loaded from Google's CDN.
         
     | 
| 
      
 41 
     | 
    
         
            +
            #
         
     | 
| 
      
 42 
     | 
    
         
            +
            # More info: https://github.com/mintdigital/asset_hat/#readme
         
     | 
| 
       29 
43 
     | 
    
         | 
| 
       30 
44 
     | 
    
         
             
            css:
         
     | 
| 
       31 
45 
     | 
    
         
             
              engine: cssmin
         
     | 
| 
      
 46 
     | 
    
         
            +
              # Available minification engines:
         
     | 
| 
      
 47 
     | 
    
         
            +
              # http://mintdigital.github.com/asset_hat/doc/classes/AssetHat/CSS/Engines.html
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
       32 
49 
     | 
    
         
             
              bundles:
         
     | 
| 
       33 
50 
     | 
    
         
             
                css-bundle-1:
         
     | 
| 
       34 
51 
     | 
    
         
             
                  - css-file-1-1
         
     | 
| 
         @@ -38,12 +55,21 @@ css: 
     | 
|
| 
       38 
55 
     | 
    
         
             
                  - css-file-2-1
         
     | 
| 
       39 
56 
     | 
    
         
             
                  - css-file-2-2
         
     | 
| 
       40 
57 
     | 
    
         
             
                  - css-file-2-3
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
                  - css-file-3-1
         
     | 
| 
       43 
     | 
    
         
            -
                  - css-file-3-2
         
     | 
| 
       44 
     | 
    
         
            -
                  - css-file-3-3
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
       45 
59 
     | 
    
         
             
            js:
         
     | 
| 
       46 
60 
     | 
    
         
             
              engine: jsmin
         
     | 
| 
      
 61 
     | 
    
         
            +
              # Available minification engines:
         
     | 
| 
      
 62 
     | 
    
         
            +
              # http://mintdigital.github.com/asset_hat/doc/classes/AssetHat/JS/Engines.html
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
              # Enable if you're using jQuery or other popular JS:
         
     | 
| 
      
 65 
     | 
    
         
            +
              #
         
     | 
| 
      
 66 
     | 
    
         
            +
              # vendors:
         
     | 
| 
      
 67 
     | 
    
         
            +
              #   jquery:
         
     | 
| 
      
 68 
     | 
    
         
            +
              #     version: 1.5.2
         
     | 
| 
      
 69 
     | 
    
         
            +
              #
         
     | 
| 
      
 70 
     | 
    
         
            +
              # Supported vendors:
         
     | 
| 
      
 71 
     | 
    
         
            +
              # http://mintdigital.github.com/asset_hat/doc/classes/AssetHat/JS/Vendors.html
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
       47 
73 
     | 
    
         
             
              bundles:
         
     | 
| 
       48 
74 
     | 
    
         
             
                js-bundle-1:
         
     | 
| 
       49 
75 
     | 
    
         
             
                  - js-file-1-1
         
     | 
| 
         @@ -53,7 +79,3 @@ js: 
     | 
|
| 
       53 
79 
     | 
    
         
             
                  - js-file-2-1
         
     | 
| 
       54 
80 
     | 
    
         
             
                  - js-file-2-2
         
     | 
| 
       55 
81 
     | 
    
         
             
                  - js-file-2-3
         
     | 
| 
       56 
     | 
    
         
            -
                js-bundle-3:
         
     | 
| 
       57 
     | 
    
         
            -
                  - js-file-3-1
         
     | 
| 
       58 
     | 
    
         
            -
                  - js-file-3-2
         
     | 
| 
       59 
     | 
    
         
            -
                  - js-file-3-3
         
     | 
    
        data/doc/classes/AssetHat.html
    CHANGED
    
    | 
         @@ -33,11 +33,14 @@ 
     | 
|
| 
       33 
33 
     | 
    
         
             
                      <li>
         
     | 
| 
       34 
34 
     | 
    
         
             
                        <a href="../files/lib/asset_hat/css_rb.html">lib/asset_hat/css.rb</a>
         
     | 
| 
       35 
35 
     | 
    
         
             
                      </li>
         
     | 
| 
      
 36 
     | 
    
         
            +
                      <li class='other'>
         
     | 
| 
      
 37 
     | 
    
         
            +
                        <a href="../files/lib/asset_hat/js_rb.html">lib/asset_hat/js.rb</a>
         
     | 
| 
      
 38 
     | 
    
         
            +
                      </li>
         
     | 
| 
       36 
39 
     | 
    
         
             
                      <li class='other'>
         
     | 
| 
       37 
40 
     | 
    
         
             
                        <a href="../files/lib/asset_hat/js/vendors_rb.html">lib/asset_hat/js/vendors.rb</a>
         
     | 
| 
       38 
41 
     | 
    
         
             
                      </li>
         
     | 
| 
       39 
42 
     | 
    
         
             
                      <li class='other'>
         
     | 
| 
       40 
     | 
    
         
            -
                        <a href="../files/lib/asset_hat/ 
     | 
| 
      
 43 
     | 
    
         
            +
                        <a href="../files/lib/asset_hat/railtie_rb.html">lib/asset_hat/railtie.rb</a>
         
     | 
| 
       41 
44 
     | 
    
         
             
                      </li>
         
     | 
| 
       42 
45 
     | 
    
         
             
                      <li class='other'>
         
     | 
| 
       43 
46 
     | 
    
         
             
                        <a href="../files/lib/asset_hat/vcs_rb.html">lib/asset_hat/vcs.rb</a>
         
     | 
| 
         @@ -57,67 +60,32 @@ 
     | 
|
| 
       57 
60 
     | 
    
         
             
                    <div id='text'>
         
     | 
| 
       58 
61 
     | 
    
         
             
                      <div id='description'>
         
     | 
| 
       59 
62 
     | 
    
         
             
                        <p>
         
     | 
| 
       60 
     | 
    
         
            -
                        Your assets are covered.
         
     | 
| 
       61 
     | 
    
         
            -
                        </ 
     | 
| 
       62 
     | 
    
         
            -
                        <p>
         
     | 
| 
       63 
     | 
    
         
            -
                        With Rails’ default asset caching, <a
         
     | 
| 
       64 
     | 
    
         
            -
                        href="AssetHat/CSS.html">CSS</a> and <a href="AssetHat/JS.html">JS</a> are
         
     | 
| 
       65 
     | 
    
         
            -
                        concatenated (not even minified) at runtime when that bundle is first
         
     | 
| 
       66 
     | 
    
         
            -
                        requested. Not good enough. <a href="AssetHat.html">AssetHat</a> can
         
     | 
| 
       67 
     | 
    
         
            -
                        automatically:
         
     | 
| 
       68 
     | 
    
         
            -
                        </p>
         
     | 
| 
       69 
     | 
    
         
            -
                        <ul>
         
     | 
| 
       70 
     | 
    
         
            -
                        <li>Easily <b>minify</b> and <b>bundle</b> <a href="AssetHat/CSS.html">CSS</a>
         
     | 
| 
       71 
     | 
    
         
            -
                        and <a href="AssetHat/JS.html">JS</a> on deploy to reduce file sizes and
         
     | 
| 
       72 
     | 
    
         
            -
                        HTTP requests.
         
     | 
| 
       73 
     | 
    
         
            -
                        
         
     | 
| 
       74 
     | 
    
         
            -
                        </li>
         
     | 
| 
       75 
     | 
    
         
            -
                        <li>Load popular <strong>third-party JS</strong> (like jQuery and Prototype)
         
     | 
| 
       76 
     | 
    
         
            -
                        from <a href="http://code.google.com/apis/ajaxlibs/"><strong>Google's
         
     | 
| 
       77 
     | 
    
         
            -
                        CDN</strong></a> when in production, or from localhost in development.
         
     | 
| 
       78 
     | 
    
         
            -
                        
         
     | 
| 
       79 
     | 
    
         
            -
                        </li>
         
     | 
| 
       80 
     | 
    
         
            -
                        <li>Force image URLs in your <a href="AssetHat/CSS.html">CSS</a> to use
         
     | 
| 
       81 
     | 
    
         
            -
                        <strong>CDN subdomains</strong>, not just the current host.
         
     | 
| 
       82 
     | 
    
         
            -
                        
         
     | 
| 
       83 
     | 
    
         
            -
                        </li>
         
     | 
| 
       84 
     | 
    
         
            -
                        <li>Add an image’s last <a href="http://git-scm.com/">Git</a> commit ID
         
     | 
| 
       85 
     | 
    
         
            -
                        to its <a href="AssetHat/CSS.html">CSS</a> URLs to <strong>bust browser
         
     | 
| 
       86 
     | 
    
         
            -
                        caches</strong> (e.g., <tt>/images/foo.png?ab12cd3</tt>).
         
     | 
| 
       87 
     | 
    
         
            -
                        
         
     | 
| 
       88 
     | 
    
         
            -
                        </li>
         
     | 
| 
       89 
     | 
    
         
            -
                        </ul>
         
     | 
| 
       90 
     | 
    
         
            -
                        <p>
         
     | 
| 
       91 
     | 
    
         
            -
                        After setup, you can use these in your layouts and views:
         
     | 
| 
       92 
     | 
    
         
            -
                        </p>
         
     | 
| 
       93 
     | 
    
         
            -
                        <pre><%= include_css :bundle => 'application' %>
  # => <link href="/stylesheets/bundles/application.min.css"
  #          media="screen,projection" rel="stylesheet" type="text/css" />

<%= include_js :bundles => ['plugins', 'common'] %>
  # => <script src="/javascripts/bundles/plugins.min.js"
  #            type="text/javascript"></script>
  #    <script src="/javascripts/bundles/common.min.js"
  #            type="text/javascript"></script></pre>
         
     | 
| 
       94 
     | 
    
         
            -
                        <p>
         
     | 
| 
       95 
     | 
    
         
            -
                        And this in your deploy script:
         
     | 
| 
       96 
     | 
    
         
            -
                        </p>
         
     | 
| 
       97 
     | 
    
         
            -
                        <pre>rake asset_hat:minify</pre>
         
     | 
| 
       98 
     | 
    
         
            -
                        <p>
         
     | 
| 
       99 
     | 
    
         
            -
                        See <a href="../files/README_rdoc.html">README.rdoc</a> for more.
         
     | 
| 
      
 63 
     | 
    
         
            +
                        Your assets are covered. See <a
         
     | 
| 
      
 64 
     | 
    
         
            +
                        href="../files/README_rdoc.html">README.rdoc</a> for more.
         
     | 
| 
       100 
65 
     | 
    
         
             
                        </p>
         
     | 
| 
       101 
66 
     | 
    
         
             
                      </div>
         
     | 
| 
       102 
67 
     | 
    
         
             
                      <div id='method-list'>
         
     | 
| 
       103 
68 
     | 
    
         
             
                        <h2>Methods</h2>
         
     | 
| 
       104 
69 
     | 
    
         
             
                        <h3>public class</h3>
         
     | 
| 
       105 
70 
     | 
    
         
             
                        <ol>
         
     | 
| 
       106 
     | 
    
         
            -
                          <li><a href="# 
     | 
| 
      
 71 
     | 
    
         
            +
                          <li><a href="#M000010">asset_exists?</a></li>
         
     | 
| 
       107 
72 
     | 
    
         
             
                          <li><a href="#M000006">assets_dir</a></li>
         
     | 
| 
       108 
     | 
    
         
            -
                          <li><a href="# 
     | 
| 
       109 
     | 
    
         
            -
                          <li><a href="# 
     | 
| 
       110 
     | 
    
         
            -
                          <li><a href="# 
     | 
| 
       111 
     | 
    
         
            -
                          <li><a href="# 
     | 
| 
       112 
     | 
    
         
            -
                          <li><a href="# 
     | 
| 
       113 
     | 
    
         
            -
                          <li><a href="# 
     | 
| 
       114 
     | 
    
         
            -
                          <li><a href="# 
     | 
| 
      
 73 
     | 
    
         
            +
                          <li><a href="#M000007">assets_path</a></li>
         
     | 
| 
      
 74 
     | 
    
         
            +
                          <li><a href="#M000014">bundle_filenames</a></li>
         
     | 
| 
      
 75 
     | 
    
         
            +
                          <li><a href="#M000015">bundle_filepaths</a></li>
         
     | 
| 
      
 76 
     | 
    
         
            +
                          <li><a href="#M000008">bundles_dir</a></li>
         
     | 
| 
      
 77 
     | 
    
         
            +
                          <li><a href="#M000009">bundles_path</a></li>
         
     | 
| 
      
 78 
     | 
    
         
            +
                          <li><a href="#M000011">cache?</a></li>
         
     | 
| 
      
 79 
     | 
    
         
            +
                          <li><a href="#M000004">cache_last_commit_ids</a></li>
         
     | 
| 
      
 80 
     | 
    
         
            +
                          <li><a href="#M000018">clear_html_cache</a></li>
         
     | 
| 
      
 81 
     | 
    
         
            +
                          <li><a href="#M000016">compute_asset_host</a></li>
         
     | 
| 
       115 
82 
     | 
    
         
             
                          <li><a href="#M000005">config</a></li>
         
     | 
| 
       116 
     | 
    
         
            -
                          <li><a href="# 
     | 
| 
       117 
     | 
    
         
            -
                          <li><a href="# 
     | 
| 
       118 
     | 
    
         
            -
                          <li><a href="# 
     | 
| 
       119 
     | 
    
         
            -
                          <li><a href="# 
     | 
| 
       120 
     | 
    
         
            -
                          <li><a href="# 
     | 
| 
      
 83 
     | 
    
         
            +
                          <li><a href="#M000012">consider_all_requests_local?</a></li>
         
     | 
| 
      
 84 
     | 
    
         
            +
                          <li><a href="#M000003">last_bundle_commit_id</a></li>
         
     | 
| 
      
 85 
     | 
    
         
            +
                          <li><a href="#M000002">last_commit_id</a></li>
         
     | 
| 
      
 86 
     | 
    
         
            +
                          <li><a href="#M000013">min_filepath</a></li>
         
     | 
| 
      
 87 
     | 
    
         
            +
                          <li><a href="#M000017">ssl_asset_host_differs?</a></li>
         
     | 
| 
      
 88 
     | 
    
         
            +
                          <li><a href="#M000001">version</a></li>
         
     | 
| 
       121 
89 
     | 
    
         
             
                        </ol>
         
     | 
| 
       122 
90 
     | 
    
         
             
                      </div>
         
     | 
| 
       123 
91 
     | 
    
         
             
                      <div id='section'>
         
     | 
| 
         @@ -153,13 +121,33 @@ 
     | 
|
| 
       153 
121 
     | 
    
         
             
                              <tr class='top-aligned-row context-row'>
         
     | 
| 
       154 
122 
     | 
    
         
             
                                <td class='context-item-name'>ASSETS_DIR</td>
         
     | 
| 
       155 
123 
     | 
    
         
             
                                <td>=</td>
         
     | 
| 
       156 
     | 
    
         
            -
                                <td class='context-item-value'>defined?(Rails.public_path) ? Rails.public_path : 'public'</td>
         
     | 
| 
      
 124 
     | 
    
         
            +
                                <td class='context-item-value'>defined?(Rails.public_path) && Rails.public_path.present? ?     Rails.public_path : 'public'</td>
         
     | 
| 
       157 
125 
     | 
    
         
             
                                <td> </td>
         
     | 
| 
       158 
126 
     | 
    
         
             
                                <td class='context-item-desc'>
         
     | 
| 
       159 
127 
     | 
    
         | 
| 
       160 
128 
     | 
    
         
             
                                  Base directory in which all assets are kept, e.g., ‘public/’.
         
     | 
| 
       161 
129 
     | 
    
         
             
                                </td>
         
     | 
| 
       162 
130 
     | 
    
         
             
                              </tr>
         
     | 
| 
      
 131 
     | 
    
         
            +
                              <tr class='top-aligned-row context-row'>
         
     | 
| 
      
 132 
     | 
    
         
            +
                                <td class='context-item-name'>STYLESHEETS_PATH</td>
         
     | 
| 
      
 133 
     | 
    
         
            +
                                <td>=</td>
         
     | 
| 
      
 134 
     | 
    
         
            +
                                <td class='context-item-value'>'/stylesheets'</td>
         
     | 
| 
      
 135 
     | 
    
         
            +
                                <td> </td>
         
     | 
| 
      
 136 
     | 
    
         
            +
                                <td class='context-item-desc'>
         
     | 
| 
      
 137 
     | 
    
         
            +
                                  
         
     | 
| 
      
 138 
     | 
    
         
            +
                                  Root URL path for all stylesheets. For public-facing use.
         
     | 
| 
      
 139 
     | 
    
         
            +
                                </td>
         
     | 
| 
      
 140 
     | 
    
         
            +
                              </tr>
         
     | 
| 
      
 141 
     | 
    
         
            +
                              <tr class='top-aligned-row context-row'>
         
     | 
| 
      
 142 
     | 
    
         
            +
                                <td class='context-item-name'>JAVASCRIPTS_PATH</td>
         
     | 
| 
      
 143 
     | 
    
         
            +
                                <td>=</td>
         
     | 
| 
      
 144 
     | 
    
         
            +
                                <td class='context-item-value'>'/javascripts'</td>
         
     | 
| 
      
 145 
     | 
    
         
            +
                                <td> </td>
         
     | 
| 
      
 146 
     | 
    
         
            +
                                <td class='context-item-desc'>
         
     | 
| 
      
 147 
     | 
    
         
            +
                                  
         
     | 
| 
      
 148 
     | 
    
         
            +
                                  Root URL path for all JavaScripts. For public-facing use.
         
     | 
| 
      
 149 
     | 
    
         
            +
                                </td>
         
     | 
| 
      
 150 
     | 
    
         
            +
                              </tr>
         
     | 
| 
       163 
151 
     | 
    
         
             
                              <tr class='top-aligned-row context-row'>
         
     | 
| 
       164 
152 
     | 
    
         
             
                                <td class='context-item-name'>STYLESHEETS_DIR</td>
         
     | 
| 
       165 
153 
     | 
    
         
             
                                <td>=</td>
         
     | 
| 
         @@ -168,7 +156,7 @@ 
     | 
|
| 
       168 
156 
     | 
    
         
             
                                <td class='context-item-desc'>
         
     | 
| 
       169 
157 
     | 
    
         | 
| 
       170 
158 
     | 
    
         
             
                                  Directory in which all stylesheets are kept, e.g.,
         
     | 
| 
       171 
     | 
    
         
            -
                                  ‘public/stylesheets 
     | 
| 
      
 159 
     | 
    
         
            +
                                  ‘public/stylesheets’. For internal filesystem use.
         
     | 
| 
       172 
160 
     | 
    
         
             
                                </td>
         
     | 
| 
       173 
161 
     | 
    
         
             
                              </tr>
         
     | 
| 
       174 
162 
     | 
    
         
             
                              <tr class='top-aligned-row context-row'>
         
     | 
| 
         @@ -179,7 +167,7 @@ 
     | 
|
| 
       179 
167 
     | 
    
         
             
                                <td class='context-item-desc'>
         
     | 
| 
       180 
168 
     | 
    
         | 
| 
       181 
169 
     | 
    
         
             
                                  Directory in which all JavaScripts are kept, e.g.,
         
     | 
| 
       182 
     | 
    
         
            -
                                  ‘public/javascripts 
     | 
| 
      
 170 
     | 
    
         
            +
                                  ‘public/javascripts’. For internal filesystem use.
         
     | 
| 
       183 
171 
     | 
    
         
             
                                </td>
         
     | 
| 
       184 
172 
     | 
    
         
             
                              </tr>
         
     | 
| 
       185 
173 
     | 
    
         
             
                              <tr class='top-aligned-row context-row'>
         
     | 
| 
         @@ -207,8 +195,8 @@ 
     | 
|
| 
       207 
195 
     | 
    
         
             
                        </div>
         
     | 
| 
       208 
196 
     | 
    
         
             
                        <div id='methods'>
         
     | 
| 
       209 
197 
     | 
    
         
             
                          <h2>Public class methods</h2>
         
     | 
| 
       210 
     | 
    
         
            -
                          <div class='method public-class' id='method- 
     | 
| 
       211 
     | 
    
         
            -
                            <a name=' 
     | 
| 
      
 198 
     | 
    
         
            +
                          <div class='method public-class' id='method-M000010'>
         
     | 
| 
      
 199 
     | 
    
         
            +
                            <a name='M000010'></a>
         
     | 
| 
       212 
200 
     | 
    
         
             
                            <div class='synopsis'>
         
     | 
| 
       213 
201 
     | 
    
         
             
                              <span class='name'>asset_exists?</span>
         
     | 
| 
       214 
202 
     | 
    
         
             
                              <span class='arguments'>(filename, type)</span>
         
     | 
| 
         @@ -223,10 +211,10 @@ 
     | 
|
| 
       223 
211 
     | 
    
         
             
                              </p>
         
     | 
| 
       224 
212 
     | 
    
         
             
                            </div>
         
     | 
| 
       225 
213 
     | 
    
         
             
                            <div class='source'>
         
     | 
| 
       226 
     | 
    
         
            -
                              <a class='source-toggle' href='#' onclick="toggleCode(' 
     | 
| 
      
 214 
     | 
    
         
            +
                              <a class='source-toggle' href='#' onclick="toggleCode('M000010-source'); return false">
         
     | 
| 
       227 
215 
     | 
    
         
             
                                [show source]
         
     | 
| 
       228 
216 
     | 
    
         
             
                              </a>
         
     | 
| 
       229 
     | 
    
         
            -
                              <pre id=' 
     | 
| 
      
 217 
     | 
    
         
            +
                              <pre id='M000010-source'>     <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 154</span>
154:   <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">asset_exists?</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-identifier">type</span>)
155:     <span class="ruby-comment cmt"># Process arguments</span>
156:     <span class="ruby-identifier">type</span> = <span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_sym</span>
157:     <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>)
158:       <span class="ruby-identifier">raise</span> <span class="ruby-node">%{Unknown type "#{type}"; should be one of: #{TYPES.join(', ')}.}</span>
159:       <span class="ruby-keyword kw">return</span>
160:     <span class="ruby-keyword kw">end</span>
161: 
162:     <span class="ruby-comment cmt"># Default to `{:css => {}, :js => {}}`</span>
163:     <span class="ruby-ivar">@asset_exists</span> <span class="ruby-operator">||=</span> <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> {}) }
164: 
165:     <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@asset_exists</span>[<span class="ruby-identifier">type</span>][<span class="ruby-identifier">filename</span>].<span class="ruby-identifier">nil?</span>
166:       <span class="ruby-ivar">@asset_exists</span>[<span class="ruby-identifier">type</span>][<span class="ruby-identifier">filename</span>] =
167:         <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">assets_dir</span>(<span class="ruby-identifier">type</span>), <span class="ruby-identifier">filename</span>))
168:     <span class="ruby-keyword kw">end</span>
169:     <span class="ruby-ivar">@asset_exists</span>[<span class="ruby-identifier">type</span>][<span class="ruby-identifier">filename</span>]
170:   <span class="ruby-keyword kw">end</span></pre>
         
     | 
| 
       230 
218 
     | 
    
         
             
                            </div>
         
     | 
| 
       231 
219 
     | 
    
         
             
                          </div>
         
     | 
| 
       232 
220 
     | 
    
         
             
                          <div class='method public-class' id='method-M000006'>
         
     | 
| 
         @@ -239,7 +227,7 @@ 
     | 
|
| 
       239 
227 
     | 
    
         
             
                              <p>
         
     | 
| 
       240 
228 
     | 
    
         
             
                              Returns the relative path to the directory where the original <a
         
     | 
| 
       241 
229 
     | 
    
         
             
                              href="AssetHat/CSS.html">CSS</a> or <a href="AssetHat/JS.html">JS</a> files
         
     | 
| 
       242 
     | 
    
         
            -
                              are stored.
         
     | 
| 
      
 230 
     | 
    
         
            +
                              are stored. For internal filesystem use.
         
     | 
| 
       243 
231 
     | 
    
         
             
                              </p>
         
     | 
| 
       244 
232 
     | 
    
         
             
                              <p>
         
     | 
| 
       245 
233 
     | 
    
         
             
                              <tt>type</tt> argument: <tt>:css</tt> or <tt>:js</tt>
         
     | 
| 
         @@ -249,11 +237,34 @@ 
     | 
|
| 
       249 
237 
     | 
    
         
             
                              <a class='source-toggle' href='#' onclick="toggleCode('M000006-source'); return false">
         
     | 
| 
       250 
238 
     | 
    
         
             
                                [show source]
         
     | 
| 
       251 
239 
     | 
    
         
             
                              </a>
         
     | 
| 
       252 
     | 
    
         
            -
                              <pre id='M000006-source'>    <span class="ruby-comment cmt"># File lib/asset_hat.rb, line  
     | 
| 
      
 240 
     | 
    
         
            +
                              <pre id='M000006-source'>    <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 63</span>
63:   <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">assets_dir</span>(<span class="ruby-identifier">type</span>)
64:     <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_sym</span>
65:     <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:css</span> ; <span class="ruby-constant">STYLESHEETS_DIR</span>
66:     <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:js</span>  ; <span class="ruby-constant">JAVASCRIPTS_DIR</span>
67:     <span class="ruby-keyword kw">else</span>
68:       <span class="ruby-identifier">raise</span> <span class="ruby-node">%{Unknown type "#{type}"; should be one of: #{TYPES.join(', ')}.}</span>
69:       <span class="ruby-keyword kw">nil</span>
70:     <span class="ruby-keyword kw">end</span>
71:   <span class="ruby-keyword kw">end</span></pre>
         
     | 
| 
       253 
241 
     | 
    
         
             
                            </div>
         
     | 
| 
       254 
242 
     | 
    
         
             
                          </div>
         
     | 
| 
       255 
     | 
    
         
            -
                          <div class='method public-class' id='method- 
     | 
| 
       256 
     | 
    
         
            -
                            <a name=' 
     | 
| 
      
 243 
     | 
    
         
            +
                          <div class='method public-class' id='method-M000007'>
         
     | 
| 
      
 244 
     | 
    
         
            +
                            <a name='M000007'></a>
         
     | 
| 
      
 245 
     | 
    
         
            +
                            <div class='synopsis'>
         
     | 
| 
      
 246 
     | 
    
         
            +
                              <span class='name'>assets_path</span>
         
     | 
| 
      
 247 
     | 
    
         
            +
                              <span class='arguments'>(type)</span>
         
     | 
| 
      
 248 
     | 
    
         
            +
                            </div>
         
     | 
| 
      
 249 
     | 
    
         
            +
                            <div class='description'>
         
     | 
| 
      
 250 
     | 
    
         
            +
                              <p>
         
     | 
| 
      
 251 
     | 
    
         
            +
                              Returns the root URL path where the original <a
         
     | 
| 
      
 252 
     | 
    
         
            +
                              href="AssetHat/CSS.html">CSS</a> or <a href="AssetHat/JS.html">JS</a> files
         
     | 
| 
      
 253 
     | 
    
         
            +
                              are stored. For external URL-building use.
         
     | 
| 
      
 254 
     | 
    
         
            +
                              </p>
         
     | 
| 
      
 255 
     | 
    
         
            +
                              <p>
         
     | 
| 
      
 256 
     | 
    
         
            +
                              <tt>type</tt> argument: <tt>:css</tt> or <tt>:js</tt>
         
     | 
| 
      
 257 
     | 
    
         
            +
                              </p>
         
     | 
| 
      
 258 
     | 
    
         
            +
                            </div>
         
     | 
| 
      
 259 
     | 
    
         
            +
                            <div class='source'>
         
     | 
| 
      
 260 
     | 
    
         
            +
                              <a class='source-toggle' href='#' onclick="toggleCode('M000007-source'); return false">
         
     | 
| 
      
 261 
     | 
    
         
            +
                                [show source]
         
     | 
| 
      
 262 
     | 
    
         
            +
                              </a>
         
     | 
| 
      
 263 
     | 
    
         
            +
                              <pre id='M000007-source'>    <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 77</span>
77:   <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">assets_path</span>(<span class="ruby-identifier">type</span>)
78:     <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_sym</span>
79:     <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:css</span> ; <span class="ruby-constant">STYLESHEETS_PATH</span>
80:     <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:js</span>  ; <span class="ruby-constant">JAVASCRIPTS_PATH</span>
81:     <span class="ruby-keyword kw">else</span>
82:       <span class="ruby-identifier">raise</span> <span class="ruby-node">%{Unknown type "#{type}"; should be one of: #{TYPES.join(', ')}.}</span>
83:       <span class="ruby-keyword kw">nil</span>
84:     <span class="ruby-keyword kw">end</span>
85:   <span class="ruby-keyword kw">end</span></pre>
         
     | 
| 
      
 264 
     | 
    
         
            +
                            </div>
         
     | 
| 
      
 265 
     | 
    
         
            +
                          </div>
         
     | 
| 
      
 266 
     | 
    
         
            +
                          <div class='method public-class' id='method-M000014'>
         
     | 
| 
      
 267 
     | 
    
         
            +
                            <a name='M000014'></a>
         
     | 
| 
       257 
268 
     | 
    
         
             
                            <div class='synopsis'>
         
     | 
| 
       258 
269 
     | 
    
         
             
                              <span class='name'>bundle_filenames</span>
         
     | 
| 
       259 
270 
     | 
    
         
             
                              <span class='arguments'>(bundle, type)</span>
         
     | 
| 
         @@ -262,17 +273,17 @@ 
     | 
|
| 
       262 
273 
     | 
    
         
             
                              <p>
         
     | 
| 
       263 
274 
     | 
    
         
             
                              Returns the extension-less names of files in the given bundle:
         
     | 
| 
       264 
275 
     | 
    
         
             
                              </p>
         
     | 
| 
       265 
     | 
    
         
            -
                              <pre>AssetHat.bundle_filenames('application', :css)
  # => ['reset', 'application' 
     | 
| 
      
 276 
     | 
    
         
            +
                              <pre>AssetHat.bundle_filenames('application', :css)
  # => ['reset', 'application']
AssetHat.bundle_filenames('non-existent-file', :css)
  # => nil</pre>
         
     | 
| 
       266 
277 
     | 
    
         
             
                            </div>
         
     | 
| 
       267 
278 
     | 
    
         
             
                            <div class='source'>
         
     | 
| 
       268 
     | 
    
         
            -
                              <a class='source-toggle' href='#' onclick="toggleCode(' 
     | 
| 
      
 279 
     | 
    
         
            +
                              <a class='source-toggle' href='#' onclick="toggleCode('M000014-source'); return false">
         
     | 
| 
       269 
280 
     | 
    
         
             
                                [show source]
         
     | 
| 
       270 
281 
     | 
    
         
             
                              </a>
         
     | 
| 
       271 
     | 
    
         
            -
                              <pre id=' 
     | 
| 
      
 282 
     | 
    
         
            +
                              <pre id='M000014-source'>     <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 210</span>
210:   <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>)
211:     <span class="ruby-comment cmt"># Process arguments</span>
212:     <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>)
213:       <span class="ruby-identifier">raise</span> <span class="ruby-node">%{Unknown type "#{type}"; should be one of: #{TYPES.join(', ')}.}</span>
214:       <span class="ruby-keyword kw">return</span>
215:     <span class="ruby-keyword kw">end</span>
216: 
217:     <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>
218:   <span class="ruby-keyword kw">end</span></pre>
         
     | 
| 
       272 
283 
     | 
    
         
             
                            </div>
         
     | 
| 
       273 
284 
     | 
    
         
             
                          </div>
         
     | 
| 
       274 
     | 
    
         
            -
                          <div class='method public-class' id='method- 
     | 
| 
       275 
     | 
    
         
            -
                            <a name=' 
     | 
| 
      
 285 
     | 
    
         
            +
                          <div class='method public-class' id='method-M000015'>
         
     | 
| 
      
 286 
     | 
    
         
            +
                            <a name='M000015'></a>
         
     | 
| 
       276 
287 
     | 
    
         
             
                            <div class='synopsis'>
         
     | 
| 
       277 
288 
     | 
    
         
             
                              <span class='name'>bundle_filepaths</span>
         
     | 
| 
       278 
289 
     | 
    
         
             
                              <span class='arguments'>(bundle, type)</span>
         
     | 
| 
         @@ -281,17 +292,17 @@ 
     | 
|
| 
       281 
292 
     | 
    
         
             
                              <p>
         
     | 
| 
       282 
293 
     | 
    
         
             
                              Returns the full paths of files in the given bundle:
         
     | 
| 
       283 
294 
     | 
    
         
             
                              </p>
         
     | 
| 
       284 
     | 
    
         
            -
                              <pre>AssetHat.bundle_filenames('application', :css)
  # => ['/path/to/app/public/stylesheets/reset.css',
        '/path/to/app/public/stylesheets/application.css' 
     | 
| 
      
 295 
     | 
    
         
            +
                              <pre>AssetHat.bundle_filenames('application', :css)
  # => ['/path/to/app/public/stylesheets/reset.css',
        '/path/to/app/public/stylesheets/application.css']
AssetHat.bundle_filenames('non-existent-file', :css)
  # => nil</pre>
         
     | 
| 
       285 
296 
     | 
    
         
             
                            </div>
         
     | 
| 
       286 
297 
     | 
    
         
             
                            <div class='source'>
         
     | 
| 
       287 
     | 
    
         
            -
                              <a class='source-toggle' href='#' onclick="toggleCode(' 
     | 
| 
      
 298 
     | 
    
         
            +
                              <a class='source-toggle' href='#' onclick="toggleCode('M000015-source'); return false">
         
     | 
| 
       288 
299 
     | 
    
         
             
                                [show source]
         
     | 
| 
       289 
300 
     | 
    
         
             
                              </a>
         
     | 
| 
       290 
     | 
    
         
            -
                              <pre id=' 
     | 
| 
      
 301 
     | 
    
         
            +
                              <pre id='M000015-source'>     <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 227</span>
227:   <span class="ruby-keyword kw">def</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>)
228:     <span class="ruby-comment cmt"># Process arguments</span>
229:     <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>)
230:       <span class="ruby-identifier">raise</span> <span class="ruby-node">%{Unknown type "#{type}"; should be one of: #{TYPES.join(', ')}.}</span>
231:       <span class="ruby-keyword kw">return</span>
232:     <span class="ruby-keyword kw">end</span>
233: 
234:     <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>)
235:     <span class="ruby-identifier">filenames</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>)
236:     <span class="ruby-identifier">filepaths</span> = <span class="ruby-identifier">filenames</span>.<span class="ruby-identifier">present?</span> <span class="ruby-value">?
237: </span>      <span class="ruby-identifier">filenames</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">fn</span><span class="ruby-operator">|</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">dir</span>, <span class="ruby-node">"#{fn}.#{type}"</span>) } <span class="ruby-operator">:</span> <span class="ruby-keyword kw">nil</span>
238:   <span class="ruby-keyword kw">end</span></pre>
         
     | 
| 
       291 
302 
     | 
    
         
             
                            </div>
         
     | 
| 
       292 
303 
     | 
    
         
             
                          </div>
         
     | 
| 
       293 
     | 
    
         
            -
                          <div class='method public-class' id='method- 
     | 
| 
       294 
     | 
    
         
            -
                            <a name=' 
     | 
| 
      
 304 
     | 
    
         
            +
                          <div class='method public-class' id='method-M000008'>
         
     | 
| 
      
 305 
     | 
    
         
            +
                            <a name='M000008'></a>
         
     | 
| 
       295 
306 
     | 
    
         
             
                            <div class='synopsis'>
         
     | 
| 
       296 
307 
     | 
    
         
             
                              <span class='name'>bundles_dir</span>
         
     | 
| 
       297 
308 
     | 
    
         
             
                              <span class='arguments'>(*args)</span>
         
     | 
| 
         @@ -300,7 +311,7 @@ 
     | 
|
| 
       300 
311 
     | 
    
         
             
                              <p>
         
     | 
| 
       301 
312 
     | 
    
         
             
                              Returns the relative path to the directory where <a
         
     | 
| 
       302 
313 
     | 
    
         
             
                              href="AssetHat/CSS.html">CSS</a> or <a href="AssetHat/JS.html">JS</a>
         
     | 
| 
       303 
     | 
    
         
            -
                              bundles are stored.
         
     | 
| 
      
 314 
     | 
    
         
            +
                              bundles are stored. For internal filesystem use.
         
     | 
| 
       304 
315 
     | 
    
         
             
                              </p>
         
     | 
| 
       305 
316 
     | 
    
         
             
                              <p>
         
     | 
| 
       306 
317 
     | 
    
         
             
                              Usage:
         
     | 
| 
         @@ -317,14 +328,47 @@ 
     | 
|
| 
       317 
328 
     | 
    
         
             
                              </dl>
         
     | 
| 
       318 
329 
     | 
    
         
             
                            </div>
         
     | 
| 
       319 
330 
     | 
    
         
             
                            <div class='source'>
         
     | 
| 
       320 
     | 
    
         
            -
                              <a class='source-toggle' href='#' onclick="toggleCode(' 
     | 
| 
      
 331 
     | 
    
         
            +
                              <a class='source-toggle' href='#' onclick="toggleCode('M000008-source'); return false">
         
     | 
| 
       321 
332 
     | 
    
         
             
                                [show source]
         
     | 
| 
       322 
333 
     | 
    
         
             
                              </a>
         
     | 
| 
       323 
     | 
    
         
            -
                              <pre id=' 
     | 
| 
      
 334 
     | 
    
         
            +
                              <pre id='M000008-source'>     <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 105</span>
105:   <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">bundles_dir</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
106:     <span class="ruby-identifier">options</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">extract_options!</span>
107:     <span class="ruby-identifier">options</span>.<span class="ruby-identifier">symbolize_keys!</span>.<span class="ruby-identifier">reverse_merge!</span>(<span class="ruby-identifier">:ssl</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">false</span>)
108:     <span class="ruby-identifier">type</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">first</span>
109: 
110:     <span class="ruby-identifier">dir</span> = <span class="ruby-identifier">type</span>.<span class="ruby-identifier">present?</span> <span class="ruby-value">? </span><span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">assets_dir</span>(<span class="ruby-identifier">type</span>), <span class="ruby-value str">'bundles'</span>) <span class="ruby-operator">:</span> <span class="ruby-value str">'bundles'</span>
111:     <span class="ruby-identifier">dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">dir</span>, <span class="ruby-value str">'ssl'</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:ssl</span>]
112:     <span class="ruby-identifier">dir</span>
113:   <span class="ruby-keyword kw">end</span></pre>
         
     | 
| 
       324 
335 
     | 
    
         
             
                            </div>
         
     | 
| 
       325 
336 
     | 
    
         
             
                          </div>
         
     | 
| 
       326 
337 
     | 
    
         
             
                          <div class='method public-class' id='method-M000009'>
         
     | 
| 
       327 
338 
     | 
    
         
             
                            <a name='M000009'></a>
         
     | 
| 
      
 339 
     | 
    
         
            +
                            <div class='synopsis'>
         
     | 
| 
      
 340 
     | 
    
         
            +
                              <span class='name'>bundles_path</span>
         
     | 
| 
      
 341 
     | 
    
         
            +
                              <span class='arguments'>(type, options={})</span>
         
     | 
| 
      
 342 
     | 
    
         
            +
                            </div>
         
     | 
| 
      
 343 
     | 
    
         
            +
                            <div class='description'>
         
     | 
| 
      
 344 
     | 
    
         
            +
                              <p>
         
     | 
| 
      
 345 
     | 
    
         
            +
                              Returns the root URL path where <a href="AssetHat/CSS.html">CSS</a> or <a
         
     | 
| 
      
 346 
     | 
    
         
            +
                              href="AssetHat/JS.html">JS</a> bundles are stored. For external
         
     | 
| 
      
 347 
     | 
    
         
            +
                              URL-building use.
         
     | 
| 
      
 348 
     | 
    
         
            +
                              </p>
         
     | 
| 
      
 349 
     | 
    
         
            +
                              <p>
         
     | 
| 
      
 350 
     | 
    
         
            +
                              Usage:
         
     | 
| 
      
 351 
     | 
    
         
            +
                              </p>
         
     | 
| 
      
 352 
     | 
    
         
            +
                              <pre>AssetHat.bundles_path(:css)
  # => 'public/stylesheets/bundles'
AssetHat.bundles_path(:js, :ssl => true)
  # => 'public/javascripts/bundles/ssl</pre>
         
     | 
| 
      
 353 
     | 
    
         
            +
                              <p>
         
     | 
| 
      
 354 
     | 
    
         
            +
                              Options:
         
     | 
| 
      
 355 
     | 
    
         
            +
                              </p>
         
     | 
| 
      
 356 
     | 
    
         
            +
                              <dl>
         
     | 
| 
      
 357 
     | 
    
         
            +
                              <dt>ssl</dt><dd>Set this to <tt>true</tt> if the stylesheet references images via SSL.
         
     | 
| 
      
 358 
     | 
    
         
            +
                              Defaults to <tt>false</tt>.
         
     | 
| 
      
 359 
     | 
    
         
            +
                              
         
     | 
| 
      
 360 
     | 
    
         
            +
                              </dd>
         
     | 
| 
      
 361 
     | 
    
         
            +
                              </dl>
         
     | 
| 
      
 362 
     | 
    
         
            +
                            </div>
         
     | 
| 
      
 363 
     | 
    
         
            +
                            <div class='source'>
         
     | 
| 
      
 364 
     | 
    
         
            +
                              <a class='source-toggle' href='#' onclick="toggleCode('M000009-source'); return false">
         
     | 
| 
      
 365 
     | 
    
         
            +
                                [show source]
         
     | 
| 
      
 366 
     | 
    
         
            +
                              </a>
         
     | 
| 
      
 367 
     | 
    
         
            +
                              <pre id='M000009-source'>     <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 129</span>
129:   <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">bundles_path</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">options</span>={})
130:     <span class="ruby-identifier">type</span> = <span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_sym</span>
131:     <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>)
132:       <span class="ruby-identifier">raise</span> <span class="ruby-node">%{Unknown type "#{type}"; should be one of: #{TYPES.join(', ')}.}</span>
133:       <span class="ruby-keyword kw">return</span>
134:     <span class="ruby-keyword kw">end</span>
135: 
136:     <span class="ruby-identifier">path</span> =  <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">type</span>
137:             <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:css</span> ; <span class="ruby-constant">STYLESHEETS_PATH</span>
138:             <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:js</span>  ; <span class="ruby-constant">JAVASCRIPTS_PATH</span>
139:             <span class="ruby-keyword kw">else</span> <span class="ruby-keyword kw">nil</span>
140:             <span class="ruby-keyword kw">end</span>
141:     <span class="ruby-identifier">path</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">'/bundles'</span>
142:     <span class="ruby-identifier">path</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">'/ssl'</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:ssl</span>]
143:     <span class="ruby-identifier">path</span>
144:   <span class="ruby-keyword kw">end</span></pre>
         
     | 
| 
      
 368 
     | 
    
         
            +
                            </div>
         
     | 
| 
      
 369 
     | 
    
         
            +
                          </div>
         
     | 
| 
      
 370 
     | 
    
         
            +
                          <div class='method public-class' id='method-M000011'>
         
     | 
| 
      
 371 
     | 
    
         
            +
                            <a name='M000011'></a>
         
     | 
| 
       328 
372 
     | 
    
         
             
                            <div class='synopsis'>
         
     | 
| 
       329 
373 
     | 
    
         
             
                              <span class='name'>cache?</span>
         
     | 
| 
       330 
374 
     | 
    
         
             
                              <span class='arguments'>()</span>
         
     | 
| 
         @@ -334,19 +378,19 @@ 
     | 
|
| 
       334 
378 
     | 
    
         
             
                              Returns <tt>true</tt> if bundles should be included as single minified
         
     | 
| 
       335 
379 
     | 
    
         
             
                              files (e.g., in production), or <tt>false</tt> if bundles should be
         
     | 
| 
       336 
380 
     | 
    
         
             
                              included as separate, unminified files (e.g., in development). To modify
         
     | 
| 
       337 
     | 
    
         
            -
                              this value, set <tt>config.action_controller.perform_caching 
     | 
| 
       338 
     | 
    
         
            -
                              your environment.
         
     | 
| 
      
 381 
     | 
    
         
            +
                              this value, set <tt>config.action_controller.perform_caching</tt> (boolean)
         
     | 
| 
      
 382 
     | 
    
         
            +
                              in your environment.
         
     | 
| 
       339 
383 
     | 
    
         
             
                              </p>
         
     | 
| 
       340 
384 
     | 
    
         
             
                            </div>
         
     | 
| 
       341 
385 
     | 
    
         
             
                            <div class='source'>
         
     | 
| 
       342 
     | 
    
         
            -
                              <a class='source-toggle' href='#' onclick="toggleCode(' 
     | 
| 
      
 386 
     | 
    
         
            +
                              <a class='source-toggle' href='#' onclick="toggleCode('M000011-source'); return false">
         
     | 
| 
       343 
387 
     | 
    
         
             
                                [show source]
         
     | 
| 
       344 
388 
     | 
    
         
             
                              </a>
         
     | 
| 
       345 
     | 
    
         
            -
                              <pre id=' 
     | 
| 
      
 389 
     | 
    
         
            +
                              <pre id='M000011-source'>     <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 178</span>
178:   <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">cache?</span> ; <span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">perform_caching</span> ; <span class="ruby-keyword kw">end</span></pre>
         
     | 
| 
       346 
390 
     | 
    
         
             
                            </div>
         
     | 
| 
       347 
391 
     | 
    
         
             
                          </div>
         
     | 
| 
       348 
     | 
    
         
            -
                          <div class='method public-class' id='method- 
     | 
| 
       349 
     | 
    
         
            -
                            <a name=' 
     | 
| 
      
 392 
     | 
    
         
            +
                          <div class='method public-class' id='method-M000004'>
         
     | 
| 
      
 393 
     | 
    
         
            +
                            <a name='M000004'></a>
         
     | 
| 
       350 
394 
     | 
    
         
             
                            <div class='synopsis'>
         
     | 
| 
       351 
395 
     | 
    
         
             
                              <span class='name'>cache_last_commit_ids</span>
         
     | 
| 
       352 
396 
     | 
    
         
             
                              <span class='arguments'>()</span>
         
     | 
| 
         @@ -358,27 +402,27 @@ 
     | 
|
| 
       358 
402 
     | 
    
         
             
                              </p>
         
     | 
| 
       359 
403 
     | 
    
         
             
                            </div>
         
     | 
| 
       360 
404 
     | 
    
         
             
                            <div class='source'>
         
     | 
| 
       361 
     | 
    
         
            -
                              <a class='source-toggle' href='#' onclick="toggleCode(' 
     | 
| 
      
 405 
     | 
    
         
            +
                              <a class='source-toggle' href='#' onclick="toggleCode('M000004-source'); return false">
         
     | 
| 
       362 
406 
     | 
    
         
             
                                [show source]
         
     | 
| 
       363 
407 
     | 
    
         
             
                              </a>
         
     | 
| 
       364 
     | 
    
         
            -
                              <pre id=' 
     | 
| 
      
 408 
     | 
    
         
            +
                              <pre id='M000004-source'>    <span class="ruby-comment cmt"># File lib/asset_hat/vcs.rb, line 75</span>
75:   <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">cache_last_commit_ids</span>
76:     <span class="ruby-constant">AssetHat</span><span class="ruby-operator">::</span><span class="ruby-constant">TYPES</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">type</span><span class="ruby-operator">|</span>
77:       <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">config</span>[<span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_s</span>].<span class="ruby-identifier">blank?</span> <span class="ruby-operator">||</span>
78:               <span class="ruby-constant">AssetHat</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">blank?</span>
79: 
80:       <span class="ruby-constant">AssetHat</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">keys</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">bundle</span><span class="ruby-operator">|</span>
81:         <span class="ruby-comment cmt"># Memoize commit ID for this bundle</span>
82:         <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">last_bundle_commit_id</span>(<span class="ruby-identifier">bundle</span>, <span class="ruby-identifier">type</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">cache?</span>
83: 
84:         <span class="ruby-comment cmt"># Memoize commit IDs for each file in this bundle</span>
85:         <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">bundle_filepaths</span>(<span class="ruby-identifier">bundle</span>, <span class="ruby-identifier">type</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">filepath</span><span class="ruby-operator">|</span>
86:           <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">last_commit_id</span>(<span class="ruby-identifier">filepath</span>)
87:         <span class="ruby-keyword kw">end</span>
88:       <span class="ruby-keyword kw">end</span>
89:     <span class="ruby-keyword kw">end</span>
90:   <span class="ruby-keyword kw">end</span></pre>
         
     | 
| 
       365 
409 
     | 
    
         
             
                            </div>
         
     | 
| 
       366 
410 
     | 
    
         
             
                          </div>
         
     | 
| 
       367 
     | 
    
         
            -
                          <div class='method public-class' id='method- 
     | 
| 
       368 
     | 
    
         
            -
                            <a name=' 
     | 
| 
      
 411 
     | 
    
         
            +
                          <div class='method public-class' id='method-M000018'>
         
     | 
| 
      
 412 
     | 
    
         
            +
                            <a name='M000018'></a>
         
     | 
| 
       369 
413 
     | 
    
         
             
                            <div class='synopsis'>
         
     | 
| 
       370 
414 
     | 
    
         
             
                              <span class='name'>clear_html_cache</span>
         
     | 
| 
       371 
415 
     | 
    
         
             
                              <span class='arguments'>()</span>
         
     | 
| 
       372 
416 
     | 
    
         
             
                            </div>
         
     | 
| 
       373 
417 
     | 
    
         
             
                            <div class='source'>
         
     | 
| 
       374 
     | 
    
         
            -
                              <a class='source-toggle' href='#' onclick="toggleCode(' 
     | 
| 
      
 418 
     | 
    
         
            +
                              <a class='source-toggle' href='#' onclick="toggleCode('M000018-source'); return false">
         
     | 
| 
       375 
419 
     | 
    
         
             
                                [show source]
         
     | 
| 
       376 
420 
     | 
    
         
             
                              </a>
         
     | 
| 
       377 
     | 
    
         
            -
                              <pre id=' 
     | 
| 
      
 421 
     | 
    
         
            +
                              <pre id='M000018-source'>     <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 294</span>
294:   <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">clear_html_cache</span>
295:     <span class="ruby-identifier">html_cache</span> = {}
296:   <span class="ruby-keyword kw">end</span></pre>
         
     | 
| 
       378 
422 
     | 
    
         
             
                            </div>
         
     | 
| 
       379 
423 
     | 
    
         
             
                          </div>
         
     | 
| 
       380 
     | 
    
         
            -
                          <div class='method public-class' id='method- 
     | 
| 
       381 
     | 
    
         
            -
                            <a name=' 
     | 
| 
      
 424 
     | 
    
         
            +
                          <div class='method public-class' id='method-M000016'>
         
     | 
| 
      
 425 
     | 
    
         
            +
                            <a name='M000016'></a>
         
     | 
| 
       382 
426 
     | 
    
         
             
                            <div class='synopsis'>
         
     | 
| 
       383 
427 
     | 
    
         
             
                              <span class='name'>compute_asset_host</span>
         
     | 
| 
       384 
428 
     | 
    
         
             
                              <span class='arguments'>(asset_host, source, options={})</span>
         
     | 
| 
         @@ -387,7 +431,7 @@ 
     | 
|
| 
       387 
431 
     | 
    
         
             
                              <p>
         
     | 
| 
       388 
432 
     | 
    
         
             
                              Reads <tt>ActionController::Base.asset_host</tt>, which can be a String or
         
     | 
| 
       389 
433 
     | 
    
         
             
                              Proc, and returns a String. Should behave just like Rails 2.3.x’s
         
     | 
| 
       390 
     | 
    
         
            -
                              private `<a href="AssetHat.html# 
     | 
| 
      
 434 
     | 
    
         
            +
                              private `<a href="AssetHat.html#M000016">compute_asset_host</a>` method,
         
     | 
| 
       391 
435 
     | 
    
         
             
                              but with a simulated request.
         
     | 
| 
       392 
436 
     | 
    
         
             
                              </p>
         
     | 
| 
       393 
437 
     | 
    
         
             
                              <p>
         
     | 
| 
         @@ -410,10 +454,10 @@ 
     | 
|
| 
       410 
454 
     | 
    
         
             
                              </dl>
         
     | 
| 
       411 
455 
     | 
    
         
             
                            </div>
         
     | 
| 
       412 
456 
     | 
    
         
             
                            <div class='source'>
         
     | 
| 
       413 
     | 
    
         
            -
                              <a class='source-toggle' href='#' onclick="toggleCode(' 
     | 
| 
      
 457 
     | 
    
         
            +
                              <a class='source-toggle' href='#' onclick="toggleCode('M000016-source'); return false">
         
     | 
| 
       414 
458 
     | 
    
         
             
                                [show source]
         
     | 
| 
       415 
459 
     | 
    
         
             
                              </a>
         
     | 
| 
       416 
     | 
    
         
            -
                              <pre id=' 
     | 
| 
      
 460 
     | 
    
         
            +
                              <pre id='M000016-source'>     <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 263</span>
263:   <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">compute_asset_host</span>(<span class="ruby-identifier">asset_host</span>, <span class="ruby-identifier">source</span>, <span class="ruby-identifier">options</span>={})
264:     <span class="ruby-identifier">host</span> = <span class="ruby-identifier">asset_host</span>
265:     <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">host</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Proc</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">host</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:call</span>)
266:       <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">host</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Proc</span>) <span class="ruby-operator">?</span>
267:            <span class="ruby-identifier">host</span>.<span class="ruby-identifier">arity</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">host</span>.<span class="ruby-identifier">method</span>(<span class="ruby-identifier">:call</span>).<span class="ruby-identifier">arity</span>
268:       <span class="ruby-keyword kw">when</span> <span class="ruby-value">2</span>
269:         <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">ActionDispatch</span>)
270:           <span class="ruby-identifier">request_class</span> = <span class="ruby-constant">ActionDispatch</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>
271:         <span class="ruby-keyword kw">else</span> <span class="ruby-comment cmt"># Rails 2.x</span>
272:           <span class="ruby-identifier">request_class</span> = <span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>
273:         <span class="ruby-keyword kw">end</span>
274:         <span class="ruby-identifier">request</span> = <span class="ruby-identifier">request_class</span>.<span class="ruby-identifier">new</span>(
275:           <span class="ruby-value str">'HTTPS'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:ssl</span>] <span class="ruby-operator">?</span> <span class="ruby-value str">'on'</span> <span class="ruby-operator">:</span> <span class="ruby-value str">'off'</span>)
276:         <span class="ruby-identifier">host</span> = <span class="ruby-identifier">host</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">source</span>, <span class="ruby-identifier">request</span>)
277:       <span class="ruby-keyword kw">else</span>
278:         <span class="ruby-identifier">host</span> = <span class="ruby-identifier">host</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">source</span>)
279:       <span class="ruby-keyword kw">end</span>
280:     <span class="ruby-keyword kw">else</span>
281:       <span class="ruby-identifier">host</span> <span class="ruby-operator">%=</span> (<span class="ruby-identifier">source</span>.<span class="ruby-identifier">hash</span> <span class="ruby-operator">%</span> <span class="ruby-value">4</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">host</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/%d/</span>
282:     <span class="ruby-keyword kw">end</span>
283:     <span class="ruby-identifier">host</span>
284:   <span class="ruby-keyword kw">end</span></pre>
         
     | 
| 
       417 
461 
     | 
    
         
             
                            </div>
         
     | 
| 
       418 
462 
     | 
    
         
             
                          </div>
         
     | 
| 
       419 
463 
     | 
    
         
             
                          <div class='method public-class' id='method-M000005'>
         
     | 
| 
         @@ -431,11 +475,32 @@ 
     | 
|
| 
       431 
475 
     | 
    
         
             
                              <a class='source-toggle' href='#' onclick="toggleCode('M000005-source'); return false">
         
     | 
| 
       432 
476 
     | 
    
         
             
                                [show source]
         
     | 
| 
       433 
477 
     | 
    
         
             
                              </a>
         
     | 
| 
       434 
     | 
    
         
            -
                              <pre id='M000005-source'>    <span class="ruby-comment cmt"># File lib/asset_hat.rb, line  
     | 
| 
      
 478 
     | 
    
         
            +
                              <pre id='M000005-source'>    <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 47</span>
47:   <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">config</span>
48:     <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-constant">CONFIG_FILEPATH</span>)
49:       <span class="ruby-identifier">raise</span> <span class="ruby-value str">'`config/assets.yml` is missing! '</span> <span class="ruby-operator">+</span>
50:             <span class="ruby-value str">'Run `rake asset_hat:config` to generate it.'</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">return</span>
51:     <span class="ruby-keyword kw">end</span>
52: 
53:     <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>
54:       <span class="ruby-ivar">@config</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load</span>(<span class="ruby-constant">ERB</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-constant">CONFIG_FILEPATH</span>)).<span class="ruby-identifier">result</span>)
55:     <span class="ruby-keyword kw">end</span>
56:     <span class="ruby-ivar">@config</span>
57:   <span class="ruby-keyword kw">end</span></pre>
         
     | 
| 
       435 
479 
     | 
    
         
             
                            </div>
         
     | 
| 
       436 
480 
     | 
    
         
             
                          </div>
         
     | 
| 
       437 
     | 
    
         
            -
                          <div class='method public-class' id='method- 
     | 
| 
       438 
     | 
    
         
            -
                            <a name=' 
     | 
| 
      
 481 
     | 
    
         
            +
                          <div class='method public-class' id='method-M000012'>
         
     | 
| 
      
 482 
     | 
    
         
            +
                            <a name='M000012'></a>
         
     | 
| 
      
 483 
     | 
    
         
            +
                            <div class='synopsis'>
         
     | 
| 
      
 484 
     | 
    
         
            +
                              <span class='name'>consider_all_requests_local?</span>
         
     | 
| 
      
 485 
     | 
    
         
            +
                              <span class='arguments'>()</span>
         
     | 
| 
      
 486 
     | 
    
         
            +
                            </div>
         
     | 
| 
      
 487 
     | 
    
         
            +
                            <div class='description'>
         
     | 
| 
      
 488 
     | 
    
         
            +
                              <p>
         
     | 
| 
      
 489 
     | 
    
         
            +
                              Returns the value of
         
     | 
| 
      
 490 
     | 
    
         
            +
                              <tt>Rails.application.config.consider_all_requests_local</tt> or its
         
     | 
| 
      
 491 
     | 
    
         
            +
                              equivalent in older versions of Rails. To modify this value, set
         
     | 
| 
      
 492 
     | 
    
         
            +
                              <tt>config.consider_all_requests_local</tt> (boolean) in your environment.
         
     | 
| 
      
 493 
     | 
    
         
            +
                              </p>
         
     | 
| 
      
 494 
     | 
    
         
            +
                            </div>
         
     | 
| 
      
 495 
     | 
    
         
            +
                            <div class='source'>
         
     | 
| 
      
 496 
     | 
    
         
            +
                              <a class='source-toggle' href='#' onclick="toggleCode('M000012-source'); return false">
         
     | 
| 
      
 497 
     | 
    
         
            +
                                [show source]
         
     | 
| 
      
 498 
     | 
    
         
            +
                              </a>
         
     | 
| 
      
 499 
     | 
    
         
            +
                              <pre id='M000012-source'>     <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 185</span>
185:   <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">consider_all_requests_local?</span>
186:     <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">Rails</span>) <span class="ruby-operator">&&</span> <span class="ruby-constant">Rails</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:application</span>)
187:       <span class="ruby-constant">Rails</span>.<span class="ruby-identifier">application</span>.<span class="ruby-identifier">config</span>.<span class="ruby-identifier">consider_all_requests_local</span>
188:     <span class="ruby-keyword kw">else</span> <span class="ruby-comment cmt"># Rails 2.x</span>
189:       <span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">consider_all_requests_local</span>
190:     <span class="ruby-keyword kw">end</span>
191:   <span class="ruby-keyword kw">end</span></pre>
         
     | 
| 
      
 500 
     | 
    
         
            +
                            </div>
         
     | 
| 
      
 501 
     | 
    
         
            +
                          </div>
         
     | 
| 
      
 502 
     | 
    
         
            +
                          <div class='method public-class' id='method-M000003'>
         
     | 
| 
      
 503 
     | 
    
         
            +
                            <a name='M000003'></a>
         
     | 
| 
       439 
504 
     | 
    
         
             
                            <div class='synopsis'>
         
     | 
| 
       440 
505 
     | 
    
         
             
                              <span class='name'>last_bundle_commit_id</span>
         
     | 
| 
       441 
506 
     | 
    
         
             
                              <span class='arguments'>(bundle, type)</span>
         
     | 
| 
         @@ -452,14 +517,14 @@ 
     | 
|
| 
       452 
517 
     | 
    
         
             
                              </p>
         
     | 
| 
       453 
518 
     | 
    
         
             
                            </div>
         
     | 
| 
       454 
519 
     | 
    
         
             
                            <div class='source'>
         
     | 
| 
       455 
     | 
    
         
            -
                              <a class='source-toggle' href='#' onclick="toggleCode(' 
     | 
| 
      
 520 
     | 
    
         
            +
                              <a class='source-toggle' href='#' onclick="toggleCode('M000003-source'); return false">
         
     | 
| 
       456 
521 
     | 
    
         
             
                                [show source]
         
     | 
| 
       457 
522 
     | 
    
         
             
                              </a>
         
     | 
| 
       458 
     | 
    
         
            -
                              <pre id=' 
     | 
| 
      
 523 
     | 
    
         
            +
                              <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>] =
62:           <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>)
63:       <span class="ruby-keyword kw">end</span>
64:     <span class="ruby-keyword kw">end</span>
65: 
66:     <span class="ruby-ivar">@last_bundle_commit_ids</span>[<span class="ruby-identifier">type</span>][<span class="ruby-identifier">bundle</span>]
67:   <span class="ruby-keyword kw">end</span></pre>
         
     | 
| 
       459 
524 
     | 
    
         
             
                            </div>
         
     | 
| 
       460 
525 
     | 
    
         
             
                          </div>
         
     | 
| 
       461 
     | 
    
         
            -
                          <div class='method public-class' id='method- 
     | 
| 
       462 
     | 
    
         
            -
                            <a name=' 
     | 
| 
      
 526 
     | 
    
         
            +
                          <div class='method public-class' id='method-M000002'>
         
     | 
| 
      
 527 
     | 
    
         
            +
                            <a name='M000002'></a>
         
     | 
| 
       463 
528 
     | 
    
         
             
                            <div class='synopsis'>
         
     | 
| 
       464 
529 
     | 
    
         
             
                              <span class='name'>last_commit_id</span>
         
     | 
| 
       465 
530 
     | 
    
         
             
                              <span class='arguments'>(*args)</span>
         
     | 
| 
         @@ -481,14 +546,14 @@ 
     | 
|
| 
       481 
546 
     | 
    
         
             
                              </dl>
         
     | 
| 
       482 
547 
     | 
    
         
             
                            </div>
         
     | 
| 
       483 
548 
     | 
    
         
             
                            <div class='source'>
         
     | 
| 
       484 
     | 
    
         
            -
                              <a class='source-toggle' href='#' onclick="toggleCode(' 
     | 
| 
      
 549 
     | 
    
         
            +
                              <a class='source-toggle' href='#' onclick="toggleCode('M000002-source'); return false">
         
     | 
| 
       485 
550 
     | 
    
         
             
                                [show source]
         
     | 
| 
       486 
551 
     | 
    
         
             
                              </a>
         
     | 
| 
       487 
     | 
    
         
            -
                              <pre id=' 
     | 
| 
      
 552 
     | 
    
         
            +
                              <pre id='M000002-source'>    <span class="ruby-comment cmt"># File lib/asset_hat/vcs.rb, line 18</span>
18:   <span class="ruby-keyword kw">def</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">args</span>)
19:     <span class="ruby-comment cmt"># Process arguments</span>
20:     <span class="ruby-identifier">options</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">extract_options!</span>
21:     <span class="ruby-identifier">options</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">symbolize_keys</span>.<span class="ruby-identifier">reverse_merge</span>(<span class="ruby-identifier">:vcs</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:git</span>)
22:     <span class="ruby-identifier">filepaths</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">' '</span>)
23: 
24:     <span class="ruby-comment cmt"># Validate options</span>
25:     <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:vcs</span>] <span class="ruby-operator">!=</span> <span class="ruby-identifier">:git</span>
26:       <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Git is currently the only supported VCS.'</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">return</span>
27:     <span class="ruby-keyword kw">end</span>
28: 
29:     <span class="ruby-ivar">@last_commit_ids</span> <span class="ruby-operator">||=</span> {}
30:     <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@last_commit_ids</span>[<span class="ruby-identifier">filepaths</span>].<span class="ruby-identifier">blank?</span>
31:       <span class="ruby-identifier">h</span> = <span class="ruby-node">`git log -1 --pretty=format:%h #{filepaths} 2>/dev/null`</span>
32:         <span class="ruby-comment cmt"># `h` has either the abbreviated Git commit hash or an empty string</span>
33:       <span class="ruby-ivar">@last_commit_ids</span>[<span class="ruby-identifier">filepaths</span>] = <span class="ruby-identifier">h</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">h</span>.<span class="ruby-identifier">present?</span>
34:     <span class="ruby-keyword kw">end</span>
35:     <span class="ruby-ivar">@last_commit_ids</span>[<span class="ruby-identifier">filepaths</span>]
36:   <span class="ruby-keyword kw">end</span></pre>
         
     | 
| 
       488 
553 
     | 
    
         
             
                            </div>
         
     | 
| 
       489 
554 
     | 
    
         
             
                          </div>
         
     | 
| 
       490 
     | 
    
         
            -
                          <div class='method public-class' id='method- 
     | 
| 
       491 
     | 
    
         
            -
                            <a name=' 
     | 
| 
      
 555 
     | 
    
         
            +
                          <div class='method public-class' id='method-M000013'>
         
     | 
| 
      
 556 
     | 
    
         
            +
                            <a name='M000013'></a>
         
     | 
| 
       492 
557 
     | 
    
         
             
                            <div class='synopsis'>
         
     | 
| 
       493 
558 
     | 
    
         
             
                              <span class='name'>min_filepath</span>
         
     | 
| 
       494 
559 
     | 
    
         
             
                              <span class='arguments'>(filepath, extension)</span>
         
     | 
| 
         @@ -500,19 +565,19 @@ 
     | 
|
| 
       500 
565 
     | 
    
         
             
                              <pre>AssetHat.min_filepath('public/stylesheets/bundles/application.css', 'css')
  # => 'public/stylesheets/bundles/application.min.css'</pre>
         
     | 
| 
       501 
566 
     | 
    
         
             
                              <p>
         
     | 
| 
       502 
567 
     | 
    
         
             
                              See also <tt><a
         
     | 
| 
       503 
     | 
    
         
            -
                              href="AssetHat/CSS.html# 
     | 
| 
       504 
     | 
    
         
            -
                              <tt><a href="AssetHat/JS.html# 
     | 
| 
      
 568 
     | 
    
         
            +
                              href="AssetHat/CSS.html#M000019">AssetHat::CSS.min_filepath</a></tt> and
         
     | 
| 
      
 569 
     | 
    
         
            +
                              <tt><a href="AssetHat/JS.html#M000025">AssetHat::JS.min_filepath</a></tt>.
         
     | 
| 
       505 
570 
     | 
    
         
             
                              </p>
         
     | 
| 
       506 
571 
     | 
    
         
             
                            </div>
         
     | 
| 
       507 
572 
     | 
    
         
             
                            <div class='source'>
         
     | 
| 
       508 
     | 
    
         
            -
                              <a class='source-toggle' href='#' onclick="toggleCode(' 
     | 
| 
      
 573 
     | 
    
         
            +
                              <a class='source-toggle' href='#' onclick="toggleCode('M000013-source'); return false">
         
     | 
| 
       509 
574 
     | 
    
         
             
                                [show source]
         
     | 
| 
       510 
575 
     | 
    
         
             
                              </a>
         
     | 
| 
       511 
     | 
    
         
            -
                              <pre id=' 
     | 
| 
      
 576 
     | 
    
         
            +
                              <pre id='M000013-source'>     <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 200</span>
200:   <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>)
201:     <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>)
202:   <span class="ruby-keyword kw">end</span></pre>
         
     | 
| 
       512 
577 
     | 
    
         
             
                            </div>
         
     | 
| 
       513 
578 
     | 
    
         
             
                          </div>
         
     | 
| 
       514 
     | 
    
         
            -
                          <div class='method public-class' id='method- 
     | 
| 
       515 
     | 
    
         
            -
                            <a name=' 
     | 
| 
      
 579 
     | 
    
         
            +
                          <div class='method public-class' id='method-M000017'>
         
     | 
| 
      
 580 
     | 
    
         
            +
                            <a name='M000017'></a>
         
     | 
| 
       516 
581 
     | 
    
         
             
                            <div class='synopsis'>
         
     | 
| 
       517 
582 
     | 
    
         
             
                              <span class='name'>ssl_asset_host_differs?</span>
         
     | 
| 
       518 
583 
     | 
    
         
             
                              <span class='arguments'>()</span>
         
     | 
| 
         @@ -524,14 +589,14 @@ 
     | 
|
| 
       524 
589 
     | 
    
         
             
                              </p>
         
     | 
| 
       525 
590 
     | 
    
         
             
                            </div>
         
     | 
| 
       526 
591 
     | 
    
         
             
                            <div class='source'>
         
     | 
| 
       527 
     | 
    
         
            -
                              <a class='source-toggle' href='#' onclick="toggleCode(' 
     | 
| 
      
 592 
     | 
    
         
            +
                              <a class='source-toggle' href='#' onclick="toggleCode('M000017-source'); return false">
         
     | 
| 
       528 
593 
     | 
    
         
             
                                [show source]
         
     | 
| 
       529 
594 
     | 
    
         
             
                              </a>
         
     | 
| 
       530 
     | 
    
         
            -
                              <pre id=' 
     | 
| 
      
 595 
     | 
    
         
            +
                              <pre id='M000017-source'>     <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 288</span>
288:   <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">ssl_asset_host_differs?</span>
289:     <span class="ruby-identifier">asset_host</span> = <span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">asset_host</span>
290:     <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">compute_asset_host</span>(<span class="ruby-identifier">asset_host</span>, <span class="ruby-value str">'x.png'</span>) <span class="ruby-operator">!=</span>
291:       <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">compute_asset_host</span>(<span class="ruby-identifier">asset_host</span>, <span class="ruby-value str">'x.png'</span>, <span class="ruby-identifier">:ssl</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">true</span>)
292:   <span class="ruby-keyword kw">end</span></pre>
         
     | 
| 
       531 
596 
     | 
    
         
             
                            </div>
         
     | 
| 
       532 
597 
     | 
    
         
             
                          </div>
         
     | 
| 
       533 
     | 
    
         
            -
                          <div class='method public-class' id='method- 
     | 
| 
       534 
     | 
    
         
            -
                            <a name=' 
     | 
| 
      
 598 
     | 
    
         
            +
                          <div class='method public-class' id='method-M000001'>
         
     | 
| 
      
 599 
     | 
    
         
            +
                            <a name='M000001'></a>
         
     | 
| 
       535 
600 
     | 
    
         
             
                            <div class='synopsis'>
         
     | 
| 
       536 
601 
     | 
    
         
             
                              <span class='name'>version</span>
         
     | 
| 
       537 
602 
     | 
    
         
             
                              <span class='arguments'>()</span>
         
     | 
| 
         @@ -542,10 +607,10 @@ 
     | 
|
| 
       542 
607 
     | 
    
         
             
                              </p>
         
     | 
| 
       543 
608 
     | 
    
         
             
                            </div>
         
     | 
| 
       544 
609 
     | 
    
         
             
                            <div class='source'>
         
     | 
| 
       545 
     | 
    
         
            -
                              <a class='source-toggle' href='#' onclick="toggleCode(' 
     | 
| 
      
 610 
     | 
    
         
            +
                              <a class='source-toggle' href='#' onclick="toggleCode('M000001-source'); return false">
         
     | 
| 
       546 
611 
     | 
    
         
             
                                [show source]
         
     | 
| 
       547 
612 
     | 
    
         
             
                              </a>
         
     | 
| 
       548 
     | 
    
         
            -
                              <pre id=' 
     | 
| 
      
 613 
     | 
    
         
            +
                              <pre id='M000001-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>
         
     | 
| 
       549 
614 
     | 
    
         
             
                            </div>
         
     | 
| 
       550 
615 
     | 
    
         
             
                          </div>
         
     | 
| 
       551 
616 
     | 
    
         
             
                        </div>
         
     |