engine-assets 0.4.2 → 0.5.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/.gitignore +5 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +38 -0
- data/LICENSE +18 -17
- data/RAILS_VERSIONS +5 -0
- data/README.md +55 -0
- data/Rakefile +253 -26
- data/VERSION +1 -1
- data/app/controllers/engine_assets/assets_controller.rb +7 -1
- data/config/routes.rb +12 -1
- data/engine-assets.gemspec +53 -20
- data/features/rails.feature +127 -0
- data/features/step_definitions/rails_steps.rb +112 -0
- data/features/support/env.rb +15 -0
- data/features/support/rails.rb +125 -0
- data/features/support/terminal.rb +83 -0
- data/init.rb +1 -0
- data/lib/engine-assets.rb +8 -2
- data/lib/engine_assets/engine.rb +3 -0
- data/lib/engine_assets/extensions/rails/assets.rb +6 -0
- data/lib/engine_assets/public_locator.rb +20 -5
- data/spec/{controllers → app/controllers/engine_assets}/javascripts_controller_spec.rb +2 -2
- data/spec/{controllers → app/controllers/engine_assets}/stylesheets_controller_spec.rb +2 -2
- data/spec/lib/engine-assets_spec.rb +7 -0
- data/spec/lib/engine_assets/public_locator_spec.rb +28 -4
- data/spec/shared/assets_controller_spec.rb +39 -0
- data/spec/shared/assets_routing_spec.rb +59 -0
- data/spec/spec.opts +2 -2
- data/spec/spec_helper.rb +61 -22
- data/spec/support/Gemfile-2.3.5 +7 -0
- data/spec/support/Gemfile-2.3.5.lock +38 -0
- data/spec/support/Gemfile-2.3.9 +7 -0
- data/spec/support/Gemfile-2.3.9.lock +38 -0
- data/spec/support/Gemfile-3.0.0 +16 -0
- data/spec/support/Gemfile-3.0.0.lock +90 -0
- data/spec/support/rails.rb +32 -0
- data/spec/support/terminal.rb +54 -0
- metadata +123 -25
- data/README.rdoc +0 -18
- data/TODO.md +0 -4
- data/rails/init.rb +0 -7
- data/spec/spec_suite.rb +0 -26
- data/spec/support/shared/assets_controller_spec.rb +0 -34
- data/spec/support/shared/assets_routing_spec.rb +0 -55
data/README.rdoc
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
= engine-assets
|
2
|
-
|
3
|
-
Description goes here.
|
4
|
-
|
5
|
-
== Note on Patches/Pull Requests
|
6
|
-
|
7
|
-
* Fork the project.
|
8
|
-
* Make your feature addition or bug fix.
|
9
|
-
* Add tests for it. This is important so I don't break it in a
|
10
|
-
future version unintentionally.
|
11
|
-
* Commit, do not mess with rakefile, version, or history.
|
12
|
-
(if you want to have your own version, that is fine but
|
13
|
-
bump version in a commit by itself I can ignore when I pull)
|
14
|
-
* Send me a pull request. Bonus points for topic branches.
|
15
|
-
|
16
|
-
== Copyright
|
17
|
-
|
18
|
-
Copyright (c) 2009 Corey Innis. See LICENSE for details.
|
data/TODO.md
DELETED
data/rails/init.rb
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
dir = File.dirname(__FILE__)
|
2
|
-
$LOAD_PATH.unshift(File.join(dir, '..', 'app'))
|
3
|
-
|
4
|
-
require 'engine-assets'
|
5
|
-
require 'controllers/engine_assets/assets_controller'
|
6
|
-
require 'controllers/engine_assets/javascripts_controller'
|
7
|
-
require 'controllers/engine_assets/stylesheets_controller'
|
data/spec/spec_suite.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
class SpecSuite
|
2
|
-
def files
|
3
|
-
Dir["#{dir}/../spec/**/*_spec.rb"]
|
4
|
-
end
|
5
|
-
|
6
|
-
def run
|
7
|
-
$LOAD_PATH.unshift(File.join(dir, '..'))
|
8
|
-
$LOAD_PATH.unshift(File.join(dir, '..', 'lib'))
|
9
|
-
|
10
|
-
ARGV.concat ["--options", "#{dir}/spec.opts"]
|
11
|
-
|
12
|
-
files.each do |file|
|
13
|
-
require file
|
14
|
-
end
|
15
|
-
result = ::Spec::Runner::CommandLine.run
|
16
|
-
exit result
|
17
|
-
end
|
18
|
-
|
19
|
-
def dir
|
20
|
-
@dir ||= File.dirname(__FILE__)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
if $0 == __FILE__
|
25
|
-
SpecSuite.new.run
|
26
|
-
end
|
@@ -1,34 +0,0 @@
|
|
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
|
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'config/routes'
|
3
|
-
|
4
|
-
describe "A controller routed as an AssetsController", :shared => true do
|
5
|
-
attr_reader :prefix, :format
|
6
|
-
|
7
|
-
describe "routing" do
|
8
|
-
attr_reader :path, :route
|
9
|
-
|
10
|
-
context "given a simple path" do
|
11
|
-
before do
|
12
|
-
@path = "/#{prefix}/asset.#{format}"
|
13
|
-
@route = { :controller => "engine_assets/#{prefix}", :action => 'show', :path => 'asset', :format => format }
|
14
|
-
end
|
15
|
-
|
16
|
-
it "recognizes the path" do
|
17
|
-
params_from(:get, path).should == route
|
18
|
-
end
|
19
|
-
|
20
|
-
it "generates the path from a URL helper" do
|
21
|
-
send("#{prefix}_path", :asset, :format => format).should == path
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
context "given a complex path of nested directories" do
|
26
|
-
before do
|
27
|
-
@path = "/#{prefix}/path/to/asset.#{format}"
|
28
|
-
@route = { :controller => "engine_assets/#{prefix}", :action => 'show', :path => 'path/to/asset', :format => format }
|
29
|
-
end
|
30
|
-
|
31
|
-
it "recognizes the path" do
|
32
|
-
params_from(:get, path).should == route
|
33
|
-
end
|
34
|
-
|
35
|
-
it "generates the path from a URL helper" do
|
36
|
-
CGI.unescape(send("#{prefix}_path", 'path/to/asset', :format => format)).should == CGI.unescape(path)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
context "given a complex path of dotted components" do
|
41
|
-
before do
|
42
|
-
@path = "/#{prefix}/path.to/asset.one.#{format}"
|
43
|
-
@route = { :controller => "engine_assets/#{prefix}", :action => 'show', :path => 'path.to/asset.one', :format => format }
|
44
|
-
end
|
45
|
-
|
46
|
-
it "recognizes the path" do
|
47
|
-
params_from(:get, path).should == route
|
48
|
-
end
|
49
|
-
|
50
|
-
it "generates the path from a URL helper" do
|
51
|
-
CGI.unescape(send("#{prefix}_path", 'path.to/asset.one', :format => format)).should == CGI.unescape(path)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|