atd-asset_bundler 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,8 +5,9 @@ require 'action_controller/metal'
5
5
  class AssetBundler::AssetsController < ActionController::Metal
6
6
  include ActionController::Rendering
7
7
  include ActionController::MimeResponds
8
+ include ActionController::Streaming
8
9
 
9
- self.view_paths = %w{app}
10
+ self.view_paths = AssetBundler.paths
10
11
 
11
12
  def go
12
13
  # Always cache resources. It's the responsibility of the asset tag to
@@ -15,7 +16,10 @@ class AssetBundler::AssetsController < ActionController::Metal
15
16
  headers['Expires'] = 1.year.from_now.httpdate
16
17
 
17
18
  begin
18
- go_render(File.join(self.controller_path, self.expansion_for(params[:path])))
19
+ template = find_template(File.join(self.controller_name, self.expansion_for(params[:path])))
20
+ send_file template.identifier,
21
+ :type => formats.first,
22
+ :disposition => 'inline'
19
23
  rescue
20
24
  raise(ActionController::RoutingError,
21
25
  "No route matches #{ request.path.inspect }")
@@ -44,12 +48,4 @@ class AssetBundler::AssetsController < ActionController::Metal
44
48
  def expansion_for(path)
45
49
  expansion?(path.to_s) ? expansions[path.to_sym] : path
46
50
  end
47
-
48
- #
49
- # Renders text file
50
- # Must be overwrited for binary data
51
- #
52
- def go_render(path)
53
- render path
54
- end
55
51
  end
@@ -1,17 +1,7 @@
1
1
  module Assets
2
2
  class ImagesController < AssetBundler::AssetsController
3
- include ActionController::Streaming
4
-
5
3
  respond_to :png, :jpeg, :gif
6
4
 
7
- protected
8
-
9
- def go_render(path)
10
- send_file find_template(path).identifier,
11
- :type => formats.first,
12
- :disposition => 'inline'
13
- end
14
-
15
5
  private
16
6
 
17
7
  def expansion?(path)
@@ -1,5 +1,9 @@
1
+ require 'asset_bundler/version'
2
+ require 'asset_bundler/routing'
3
+ require 'asset_bundler/engine'
4
+ require 'asset_bundler/rails/ext'
5
+
1
6
  module AssetBundler
2
- require 'asset_bundler/version'
3
- require 'asset_bundler/routing'
4
- require 'asset_bundler/engine'
7
+ mattr_accessor :paths
8
+ @@paths = []
5
9
  end
@@ -0,0 +1,9 @@
1
+ require 'rails/engine'
2
+
3
+ class Rails::Engine
4
+ initializer :add_asset_paths do |app|
5
+ paths.app.assets = "app/assets"
6
+
7
+ AssetBundler.paths += paths.app.assets.to_a
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module AssetBundler
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atd-asset_bundler
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Stephen Touset
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-10-29 00:00:00 +02:00
19
+ date: 2010-10-31 01:00:00 +02:00
20
20
  default_executable:
21
21
  dependencies: []
22
22
 
@@ -44,6 +44,7 @@ files:
44
44
  - config/routes.rb
45
45
  - lib/asset_bundler.rb
46
46
  - lib/asset_bundler/engine.rb
47
+ - lib/asset_bundler/rails/ext.rb
47
48
  - lib/asset_bundler/routing.rb
48
49
  - lib/asset_bundler/version.rb
49
50
  has_rdoc: true