engine-assets 0.2.0 → 0.2.1
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/VERSION +1 -1
 - data/app/controllers/engine_assets/assets_controller.rb +5 -1
 - data/config/routes.rb +1 -1
 - data/engine-assets.gemspec +22 -7
 - data/lib/engine-assets.rb +1 -0
 - data/lib/engine_assets/extensions/rails/plugin.rb +12 -0
 - data/rails/init.rb +0 -13
 - data/spec/controllers/javascripts_controller_spec.rb +9 -0
 - data/spec/controllers/stylesheets_controller_spec.rb +9 -0
 - data/spec/routing/javascripts_routing_spec.rb +5 -33
 - data/spec/routing/stylesheets_routing_spec.rb +5 -8
 - data/spec/spec_helper.rb +3 -0
 - data/spec/support/fixtures/app/views/engine_assets/javascripts/dual.js.erb +2 -0
 - data/spec/support/fixtures/app/views/engine_assets/javascripts/solo.js.erb +2 -0
 - data/spec/support/fixtures/app/views/engine_assets/stylesheets/dual.css.erb +2 -0
 - data/spec/support/fixtures/app/views/engine_assets/stylesheets/solo.css.erb +2 -0
 - data/spec/support/fixtures/public/javascripts/dual.js +2 -0
 - data/spec/support/fixtures/public/stylesheets/dual.css +2 -0
 - data/spec/support/helpers/fixture_helper.rb +8 -0
 - data/spec/support/shared/assets_controller_spec.rb +34 -0
 - data/spec/support/shared/assets_routing_spec.rb +54 -0
 - metadata +19 -4
 - data/spec/support/fixtures/app/views/javascripts/asset.js.erb +0 -2
 - data/spec/support/fixtures/public/javascripts/asset.js +0 -2
 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            0.2. 
     | 
| 
      
 1 
     | 
    
         
            +
            0.2.1
         
     | 
| 
         @@ -10,7 +10,11 @@ class EngineAssets::AssetsController < ApplicationController 
     | 
|
| 
       10 
10 
     | 
    
         
             
                if(flat_file)
         
     | 
| 
       11 
11 
     | 
    
         
             
                  render(:file => flat_file)
         
     | 
| 
       12 
12 
     | 
    
         
             
                else
         
     | 
| 
       13 
     | 
    
         
            -
                   
     | 
| 
      
 13 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 14 
     | 
    
         
            +
                    render(:template => File.join('engine_assets', controller_name, params[:path]), :layout => false)
         
     | 
| 
      
 15 
     | 
    
         
            +
                  rescue ActionView::MissingTemplate
         
     | 
| 
      
 16 
     | 
    
         
            +
                    head :not_found
         
     | 
| 
      
 17 
     | 
    
         
            +
                  end
         
     | 
| 
       14 
18 
     | 
    
         
             
                end
         
     | 
| 
       15 
19 
     | 
    
         
             
              end
         
     | 
| 
       16 
20 
     | 
    
         | 
    
        data/config/routes.rb
    CHANGED
    
    | 
         @@ -3,7 +3,7 @@ ActionController::Routing::Routes.draw do |map| 
     | 
|
| 
       3 
3 
     | 
    
         
             
                map.send(type, "#{type}/:path.:format", {
         
     | 
| 
       4 
4 
     | 
    
         
             
                  :controller => "engine_assets/#{type}",
         
     | 
| 
       5 
5 
     | 
    
         
             
                  :action     => :show,
         
     | 
| 
       6 
     | 
    
         
            -
                  :path       => /[A-Za-z0-9 
     | 
| 
      
 6 
     | 
    
         
            +
                  :path       => /[A-Za-z0-9\/._-]+?/   # e.g., path/to/file.ext
         
     | 
| 
       7 
7 
     | 
    
         
             
                })
         
     | 
| 
       8 
8 
     | 
    
         
             
              end
         
     | 
| 
       9 
9 
     | 
    
         
             
            end
         
     | 
    
        data/engine-assets.gemspec
    CHANGED
    
    | 
         @@ -5,11 +5,11 @@ 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       7 
7 
     | 
    
         
             
              s.name = %q{engine-assets}
         
     | 
| 
       8 
     | 
    
         
            -
              s.version = "0.2. 
     | 
| 
      
 8 
     | 
    
         
            +
              s.version = "0.2.1"
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         
     | 
| 
       11 
11 
     | 
    
         
             
              s.authors = ["Corey Innis"]
         
     | 
| 
       12 
     | 
    
         
            -
              s.date = %q{2009-11- 
     | 
| 
      
 12 
     | 
    
         
            +
              s.date = %q{2009-11-07}
         
     | 
| 
       13 
13 
     | 
    
         
             
              s.description = %q{A Rails Engine, which enables Rails Engines to provide assets (javascript, css and images)}
         
     | 
| 
       14 
14 
     | 
    
         
             
              s.email = %q{support@coolerator.net}
         
     | 
| 
       15 
15 
     | 
    
         
             
              s.extra_rdoc_files = [
         
     | 
| 
         @@ -30,17 +30,27 @@ Gem::Specification.new do |s| 
     | 
|
| 
       30 
30 
     | 
    
         
             
                 "config/routes.rb",
         
     | 
| 
       31 
31 
     | 
    
         
             
                 "engine-assets.gemspec",
         
     | 
| 
       32 
32 
     | 
    
         
             
                 "lib/engine-assets.rb",
         
     | 
| 
      
 33 
     | 
    
         
            +
                 "lib/engine_assets/extensions/rails/plugin.rb",
         
     | 
| 
       33 
34 
     | 
    
         
             
                 "lib/engine_assets/extensions/rails/routes.rb",
         
     | 
| 
       34 
35 
     | 
    
         
             
                 "lib/engine_assets/public_locator.rb",
         
     | 
| 
       35 
36 
     | 
    
         
             
                 "rails/init.rb",
         
     | 
| 
      
 37 
     | 
    
         
            +
                 "spec/controllers/javascripts_controller_spec.rb",
         
     | 
| 
      
 38 
     | 
    
         
            +
                 "spec/controllers/stylesheets_controller_spec.rb",
         
     | 
| 
       36 
39 
     | 
    
         
             
                 "spec/routing/javascripts_routing_spec.rb",
         
     | 
| 
       37 
40 
     | 
    
         
             
                 "spec/routing/stylesheets_routing_spec.rb",
         
     | 
| 
       38 
41 
     | 
    
         
             
                 "spec/spec.opts",
         
     | 
| 
       39 
42 
     | 
    
         
             
                 "spec/spec_helper.rb",
         
     | 
| 
       40 
43 
     | 
    
         
             
                 "spec/spec_suite.rb",
         
     | 
| 
       41 
     | 
    
         
            -
                 "spec/support/fixtures/app/views/javascripts/ 
     | 
| 
       42 
     | 
    
         
            -
                 "spec/support/fixtures/ 
     | 
| 
       43 
     | 
    
         
            -
                 "spec/support/ 
     | 
| 
      
 44 
     | 
    
         
            +
                 "spec/support/fixtures/app/views/engine_assets/javascripts/dual.js.erb",
         
     | 
| 
      
 45 
     | 
    
         
            +
                 "spec/support/fixtures/app/views/engine_assets/javascripts/solo.js.erb",
         
     | 
| 
      
 46 
     | 
    
         
            +
                 "spec/support/fixtures/app/views/engine_assets/stylesheets/dual.css.erb",
         
     | 
| 
      
 47 
     | 
    
         
            +
                 "spec/support/fixtures/app/views/engine_assets/stylesheets/solo.css.erb",
         
     | 
| 
      
 48 
     | 
    
         
            +
                 "spec/support/fixtures/public/javascripts/dual.js",
         
     | 
| 
      
 49 
     | 
    
         
            +
                 "spec/support/fixtures/public/stylesheets/dual.css",
         
     | 
| 
      
 50 
     | 
    
         
            +
                 "spec/support/helpers/fixture_helper.rb",
         
     | 
| 
      
 51 
     | 
    
         
            +
                 "spec/support/helpers/textmate_helper.rb",
         
     | 
| 
      
 52 
     | 
    
         
            +
                 "spec/support/shared/assets_controller_spec.rb",
         
     | 
| 
      
 53 
     | 
    
         
            +
                 "spec/support/shared/assets_routing_spec.rb"
         
     | 
| 
       44 
54 
     | 
    
         
             
              ]
         
     | 
| 
       45 
55 
     | 
    
         
             
              s.homepage = %q{http://github.com/coreyti/engine-assets}
         
     | 
| 
       46 
56 
     | 
    
         
             
              s.rdoc_options = ["--charset=UTF-8"]
         
     | 
| 
         @@ -48,11 +58,16 @@ Gem::Specification.new do |s| 
     | 
|
| 
       48 
58 
     | 
    
         
             
              s.rubygems_version = %q{1.3.5}
         
     | 
| 
       49 
59 
     | 
    
         
             
              s.summary = %q{Rails Engines with assets.}
         
     | 
| 
       50 
60 
     | 
    
         
             
              s.test_files = [
         
     | 
| 
       51 
     | 
    
         
            -
                "spec/ 
     | 
| 
      
 61 
     | 
    
         
            +
                "spec/controllers/javascripts_controller_spec.rb",
         
     | 
| 
      
 62 
     | 
    
         
            +
                 "spec/controllers/stylesheets_controller_spec.rb",
         
     | 
| 
      
 63 
     | 
    
         
            +
                 "spec/routing/javascripts_routing_spec.rb",
         
     | 
| 
       52 
64 
     | 
    
         
             
                 "spec/routing/stylesheets_routing_spec.rb",
         
     | 
| 
       53 
65 
     | 
    
         
             
                 "spec/spec_helper.rb",
         
     | 
| 
       54 
66 
     | 
    
         
             
                 "spec/spec_suite.rb",
         
     | 
| 
       55 
     | 
    
         
            -
                 "spec/support/helpers/ 
     | 
| 
      
 67 
     | 
    
         
            +
                 "spec/support/helpers/fixture_helper.rb",
         
     | 
| 
      
 68 
     | 
    
         
            +
                 "spec/support/helpers/textmate_helper.rb",
         
     | 
| 
      
 69 
     | 
    
         
            +
                 "spec/support/shared/assets_controller_spec.rb",
         
     | 
| 
      
 70 
     | 
    
         
            +
                 "spec/support/shared/assets_routing_spec.rb"
         
     | 
| 
       56 
71 
     | 
    
         
             
              ]
         
     | 
| 
       57 
72 
     | 
    
         | 
| 
       58 
73 
     | 
    
         
             
              if s.respond_to? :specification_version then
         
     | 
    
        data/lib/engine-assets.rb
    CHANGED
    
    
| 
         @@ -0,0 +1,12 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class Rails::Plugin
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Loader
         
     | 
| 
      
 3 
     | 
    
         
            +
                def register_plugin_as_loaded_with_engine_assets(plugin)
         
     | 
| 
      
 4 
     | 
    
         
            +
                  register_plugin_as_loaded_without_engine_assets(plugin)
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                  if(plugin.engine? && File.exist?(public_dir = File.join(plugin.directory, 'public')))
         
     | 
| 
      
 7 
     | 
    
         
            +
                    EngineAssets::PublicLocator.paths << public_dir
         
     | 
| 
      
 8 
     | 
    
         
            +
                  end
         
     | 
| 
      
 9 
     | 
    
         
            +
                end
         
     | 
| 
      
 10 
     | 
    
         
            +
                alias_method_chain :register_plugin_as_loaded, :engine_assets
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
            end
         
     | 
    
        data/rails/init.rb
    CHANGED
    
    | 
         @@ -5,16 +5,3 @@ require 'engine-assets' 
     | 
|
| 
       5 
5 
     | 
    
         
             
            require 'controllers/engine_assets/assets_controller'
         
     | 
| 
       6 
6 
     | 
    
         
             
            require 'controllers/engine_assets/javascripts_controller'
         
     | 
| 
       7 
7 
     | 
    
         
             
            require 'controllers/engine_assets/stylesheets_controller'
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
            class Rails::Plugin
         
     | 
| 
       10 
     | 
    
         
            -
              class Loader
         
     | 
| 
       11 
     | 
    
         
            -
                def register_plugin_as_loaded_with_engine_assets(plugin)
         
     | 
| 
       12 
     | 
    
         
            -
                  register_plugin_as_loaded_without_engine_assets(plugin)
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
                  if(plugin.engine? && File.exist?(public_dir = File.join(plugin.directory, 'public')))
         
     | 
| 
       15 
     | 
    
         
            -
                    EngineAssets::PublicLocator.paths << public_dir
         
     | 
| 
       16 
     | 
    
         
            -
                  end
         
     | 
| 
       17 
     | 
    
         
            -
                end
         
     | 
| 
       18 
     | 
    
         
            -
                alias_method_chain :register_plugin_as_loaded, :engine_assets
         
     | 
| 
       19 
     | 
    
         
            -
              end
         
     | 
| 
       20 
     | 
    
         
            -
            end
         
     | 
| 
         @@ -1,38 +1,10 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            describe EngineAssets::JavascriptsController do
         
     | 
| 
       4 
     | 
    
         
            -
               
     | 
| 
       5 
     | 
    
         
            -
                 
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
                context "given a simple path" do
         
     | 
| 
       8 
     | 
    
         
            -
                  before do
         
     | 
| 
       9 
     | 
    
         
            -
                    @path = '/javascripts/asset.js'
         
     | 
| 
       10 
     | 
    
         
            -
                  end
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
                  it "is able to recognize the path" do
         
     | 
| 
       13 
     | 
    
         
            -
                    pending "my ability to overcome the challenges of spec'ing this working behavior"
         
     | 
| 
       14 
     | 
    
         
            -
                    { :get => path }.should be_routable
         
     | 
| 
       15 
     | 
    
         
            -
                  end
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
                  it "is able to generate the path" do
         
     | 
| 
       18 
     | 
    
         
            -
                    javascripts_path(:asset, :format => :js).should == path
         
     | 
| 
       19 
     | 
    
         
            -
                  end
         
     | 
| 
       20 
     | 
    
         
            -
                end
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
                context "given a complex path" do
         
     | 
| 
       23 
     | 
    
         
            -
                  before do
         
     | 
| 
       24 
     | 
    
         
            -
                    @path = '/javascripts/path/to/asset.js'
         
     | 
| 
       25 
     | 
    
         
            -
                  end
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                  it "is able to recognize the path" do
         
     | 
| 
       28 
     | 
    
         
            -
                    pending "my ability to overcome the challenges of spec'ing this working behavior"
         
     | 
| 
       29 
     | 
    
         
            -
                    { :get => path }.should be_routable
         
     | 
| 
       30 
     | 
    
         
            -
                  end
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
                  it "is able to generate the path" do
         
     | 
| 
       33 
     | 
    
         
            -
                    pending "my ability to overcome the challenges of spec'ing this working behavior"
         
     | 
| 
       34 
     | 
    
         
            -
                    javascripts_path('path/to/asset', :format => :js).should == path
         
     | 
| 
       35 
     | 
    
         
            -
                  end
         
     | 
| 
       36 
     | 
    
         
            -
                end
         
     | 
| 
      
 4 
     | 
    
         
            +
              before do
         
     | 
| 
      
 5 
     | 
    
         
            +
                @prefix = 'javascripts'
         
     | 
| 
      
 6 
     | 
    
         
            +
                @format = 'js'
         
     | 
| 
       37 
7 
     | 
    
         
             
              end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              it_should_behave_like "A controller routed as an AssetsController"
         
     | 
| 
       38 
10 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,13 +1,10 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            describe EngineAssets::StylesheetsController do
         
     | 
| 
       4 
     | 
    
         
            -
               
     | 
| 
       5 
     | 
    
         
            -
                 
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
                end
         
     | 
| 
       8 
     | 
    
         
            -
                
         
     | 
| 
       9 
     | 
    
         
            -
                it "generates valid paths" do
         
     | 
| 
       10 
     | 
    
         
            -
                  stylesheets_path(:asset, :format => :css).should == '/stylesheets/asset.css'
         
     | 
| 
       11 
     | 
    
         
            -
                end
         
     | 
| 
      
 4 
     | 
    
         
            +
              before do
         
     | 
| 
      
 5 
     | 
    
         
            +
                @prefix = 'stylesheets'
         
     | 
| 
      
 6 
     | 
    
         
            +
                @format = 'css'
         
     | 
| 
       12 
7 
     | 
    
         
             
              end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              it_should_behave_like "A controller routed as an AssetsController"
         
     | 
| 
       13 
10 
     | 
    
         
             
            end
         
     | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | 
         @@ -10,7 +10,10 @@ require 'engine-assets' 
     | 
|
| 
       10 
10 
     | 
    
         
             
            require 'spec'
         
     | 
| 
       11 
11 
     | 
    
         
             
            require 'spec/autorun'
         
     | 
| 
       12 
12 
     | 
    
         
             
            require 'spec/rails'
         
     | 
| 
      
 13 
     | 
    
         
            +
            require 'support/helpers/fixture_helper'
         
     | 
| 
       13 
14 
     | 
    
         
             
            require 'support/helpers/textmate_helper'
         
     | 
| 
      
 15 
     | 
    
         
            +
            require 'support/shared/assets_controller_spec'
         
     | 
| 
      
 16 
     | 
    
         
            +
            require 'support/shared/assets_routing_spec'
         
     | 
| 
       14 
17 
     | 
    
         | 
| 
       15 
18 
     | 
    
         
             
            Spec::Runner.configure do |config|
         
     | 
| 
       16 
19 
     | 
    
         
             
              include Support::Helpers
         
     | 
| 
         @@ -0,0 +1,8 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Support
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Helpers
         
     | 
| 
      
 3 
     | 
    
         
            +
                def load_view_fixtures(controller_class)
         
     | 
| 
      
 4 
     | 
    
         
            +
                  controller_class.prepend_view_path(File.join(File.dirname(__FILE__), '..', 'fixtures', 'app', 'views'))
         
     | 
| 
      
 5 
     | 
    
         
            +
                  EngineAssets::PublicLocator.paths << File.join(File.dirname(__FILE__), '..', 'fixtures', 'public')
         
     | 
| 
      
 6 
     | 
    
         
            +
                end
         
     | 
| 
      
 7 
     | 
    
         
            +
              end
         
     | 
| 
      
 8 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,34 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe "A controller acting as an AssetsController", :shared => true do
         
     | 
| 
      
 4 
     | 
    
         
            +
              attr_reader :format
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
              integrate_views
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
              before do
         
     | 
| 
      
 9 
     | 
    
         
            +
                load_view_fixtures(@controller.class)
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              describe "response" do
         
     | 
| 
      
 13 
     | 
    
         
            +
                context "with a matching file found in 'public'" do
         
     | 
| 
      
 14 
     | 
    
         
            +
                  it "renders that file" do
         
     | 
| 
      
 15 
     | 
    
         
            +
                    get :show, :path => 'dual', :format => format
         
     | 
| 
      
 16 
     | 
    
         
            +
                    response.body.should match("dual.#{format}, should be rendered")
         
     | 
| 
      
 17 
     | 
    
         
            +
                  end
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                context "with a matching file found in 'app'" do
         
     | 
| 
      
 21 
     | 
    
         
            +
                  it "renders that file" do
         
     | 
| 
      
 22 
     | 
    
         
            +
                    get :show, :path => 'solo', :format => format
         
     | 
| 
      
 23 
     | 
    
         
            +
                    response.body.should match("solo.#{format}.erb, should be rendered")
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                context "without a matching file" do
         
     | 
| 
      
 28 
     | 
    
         
            +
                  it "renders 404" do
         
     | 
| 
      
 29 
     | 
    
         
            +
                    get :show, :path => 'none', :format => format
         
     | 
| 
      
 30 
     | 
    
         
            +
                    response.response_code.should == 404 
         
     | 
| 
      
 31 
     | 
    
         
            +
                  end
         
     | 
| 
      
 32 
     | 
    
         
            +
                end
         
     | 
| 
      
 33 
     | 
    
         
            +
              end
         
     | 
| 
      
 34 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,54 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe "A controller routed as an AssetsController", :shared => true do
         
     | 
| 
      
 4 
     | 
    
         
            +
              attr_reader :prefix, :format
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
              describe "routing" do
         
     | 
| 
      
 7 
     | 
    
         
            +
                attr_reader :path, :route
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                context "given a simple path" do
         
     | 
| 
      
 10 
     | 
    
         
            +
                  before do
         
     | 
| 
      
 11 
     | 
    
         
            +
                    @path  = "/#{prefix}/asset.#{format}"
         
     | 
| 
      
 12 
     | 
    
         
            +
                    @route = { :controller => "engine_assets/#{prefix}", :action => 'show', :path => 'asset', :format => format }
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                  it "recognizes the path" do
         
     | 
| 
      
 16 
     | 
    
         
            +
                    params_from(:get, path).should == route
         
     | 
| 
      
 17 
     | 
    
         
            +
                  end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                  it "generates the path from a URL helper" do
         
     | 
| 
      
 20 
     | 
    
         
            +
                    send("#{prefix}_path", :asset, :format => format).should == path
         
     | 
| 
      
 21 
     | 
    
         
            +
                  end
         
     | 
| 
      
 22 
     | 
    
         
            +
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                context "given a complex path of nested directories" do
         
     | 
| 
      
 25 
     | 
    
         
            +
                  before do
         
     | 
| 
      
 26 
     | 
    
         
            +
                    @path = "/#{prefix}/path/to/asset.#{format}"
         
     | 
| 
      
 27 
     | 
    
         
            +
                    @route = { :controller => "engine_assets/#{prefix}", :action => 'show', :path => 'path/to/asset', :format => format }
         
     | 
| 
      
 28 
     | 
    
         
            +
                  end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                  it "recognizes the path" do
         
     | 
| 
      
 31 
     | 
    
         
            +
                    params_from(:get, path).should == route
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                  it "generates the path from a URL helper" do
         
     | 
| 
      
 35 
     | 
    
         
            +
                    CGI.unescape(send("#{prefix}_path", 'path/to/asset', :format => format)).should == CGI.unescape(path)
         
     | 
| 
      
 36 
     | 
    
         
            +
                  end
         
     | 
| 
      
 37 
     | 
    
         
            +
                end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                context "given a complex path of dotted components" do
         
     | 
| 
      
 40 
     | 
    
         
            +
                  before do
         
     | 
| 
      
 41 
     | 
    
         
            +
                    @path = "/#{prefix}/path.to/asset.one.#{format}"
         
     | 
| 
      
 42 
     | 
    
         
            +
                    @route = { :controller => "engine_assets/#{prefix}", :action => 'show', :path => 'path.to/asset.one', :format => format }
         
     | 
| 
      
 43 
     | 
    
         
            +
                  end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                  it "recognizes the path" do
         
     | 
| 
      
 46 
     | 
    
         
            +
                    params_from(:get, path).should == route
         
     | 
| 
      
 47 
     | 
    
         
            +
                  end
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                  it "generates the path from a URL helper" do
         
     | 
| 
      
 50 
     | 
    
         
            +
                    CGI.unescape(send("#{prefix}_path", 'path.to/asset.one', :format => format)).should == CGI.unescape(path)
         
     | 
| 
      
 51 
     | 
    
         
            +
                  end
         
     | 
| 
      
 52 
     | 
    
         
            +
                end
         
     | 
| 
      
 53 
     | 
    
         
            +
              end
         
     | 
| 
      
 54 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: engine-assets
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.2. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.2.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors: 
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Corey Innis
         
     | 
| 
         @@ -9,7 +9,7 @@ autorequire: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
            date: 2009-11- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2009-11-07 00:00:00 -05:00
         
     | 
| 
       13 
13 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -45,17 +45,27 @@ files: 
     | 
|
| 
       45 
45 
     | 
    
         
             
            - config/routes.rb
         
     | 
| 
       46 
46 
     | 
    
         
             
            - engine-assets.gemspec
         
     | 
| 
       47 
47 
     | 
    
         
             
            - lib/engine-assets.rb
         
     | 
| 
      
 48 
     | 
    
         
            +
            - lib/engine_assets/extensions/rails/plugin.rb
         
     | 
| 
       48 
49 
     | 
    
         
             
            - lib/engine_assets/extensions/rails/routes.rb
         
     | 
| 
       49 
50 
     | 
    
         
             
            - lib/engine_assets/public_locator.rb
         
     | 
| 
       50 
51 
     | 
    
         
             
            - rails/init.rb
         
     | 
| 
      
 52 
     | 
    
         
            +
            - spec/controllers/javascripts_controller_spec.rb
         
     | 
| 
      
 53 
     | 
    
         
            +
            - spec/controllers/stylesheets_controller_spec.rb
         
     | 
| 
       51 
54 
     | 
    
         
             
            - spec/routing/javascripts_routing_spec.rb
         
     | 
| 
       52 
55 
     | 
    
         
             
            - spec/routing/stylesheets_routing_spec.rb
         
     | 
| 
       53 
56 
     | 
    
         
             
            - spec/spec.opts
         
     | 
| 
       54 
57 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
       55 
58 
     | 
    
         
             
            - spec/spec_suite.rb
         
     | 
| 
       56 
     | 
    
         
            -
            - spec/support/fixtures/app/views/javascripts/ 
     | 
| 
       57 
     | 
    
         
            -
            - spec/support/fixtures/ 
     | 
| 
      
 59 
     | 
    
         
            +
            - spec/support/fixtures/app/views/engine_assets/javascripts/dual.js.erb
         
     | 
| 
      
 60 
     | 
    
         
            +
            - spec/support/fixtures/app/views/engine_assets/javascripts/solo.js.erb
         
     | 
| 
      
 61 
     | 
    
         
            +
            - spec/support/fixtures/app/views/engine_assets/stylesheets/dual.css.erb
         
     | 
| 
      
 62 
     | 
    
         
            +
            - spec/support/fixtures/app/views/engine_assets/stylesheets/solo.css.erb
         
     | 
| 
      
 63 
     | 
    
         
            +
            - spec/support/fixtures/public/javascripts/dual.js
         
     | 
| 
      
 64 
     | 
    
         
            +
            - spec/support/fixtures/public/stylesheets/dual.css
         
     | 
| 
      
 65 
     | 
    
         
            +
            - spec/support/helpers/fixture_helper.rb
         
     | 
| 
       58 
66 
     | 
    
         
             
            - spec/support/helpers/textmate_helper.rb
         
     | 
| 
      
 67 
     | 
    
         
            +
            - spec/support/shared/assets_controller_spec.rb
         
     | 
| 
      
 68 
     | 
    
         
            +
            - spec/support/shared/assets_routing_spec.rb
         
     | 
| 
       59 
69 
     | 
    
         
             
            has_rdoc: true
         
     | 
| 
       60 
70 
     | 
    
         
             
            homepage: http://github.com/coreyti/engine-assets
         
     | 
| 
       61 
71 
     | 
    
         
             
            licenses: []
         
     | 
| 
         @@ -85,8 +95,13 @@ signing_key: 
     | 
|
| 
       85 
95 
     | 
    
         
             
            specification_version: 3
         
     | 
| 
       86 
96 
     | 
    
         
             
            summary: Rails Engines with assets.
         
     | 
| 
       87 
97 
     | 
    
         
             
            test_files: 
         
     | 
| 
      
 98 
     | 
    
         
            +
            - spec/controllers/javascripts_controller_spec.rb
         
     | 
| 
      
 99 
     | 
    
         
            +
            - spec/controllers/stylesheets_controller_spec.rb
         
     | 
| 
       88 
100 
     | 
    
         
             
            - spec/routing/javascripts_routing_spec.rb
         
     | 
| 
       89 
101 
     | 
    
         
             
            - spec/routing/stylesheets_routing_spec.rb
         
     | 
| 
       90 
102 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
       91 
103 
     | 
    
         
             
            - spec/spec_suite.rb
         
     | 
| 
      
 104 
     | 
    
         
            +
            - spec/support/helpers/fixture_helper.rb
         
     | 
| 
       92 
105 
     | 
    
         
             
            - spec/support/helpers/textmate_helper.rb
         
     | 
| 
      
 106 
     | 
    
         
            +
            - spec/support/shared/assets_controller_spec.rb
         
     | 
| 
      
 107 
     | 
    
         
            +
            - spec/support/shared/assets_routing_spec.rb
         
     |