asset-resource 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module AssetResource
2
- VERSION = "0.2.2"
2
+ VERSION = "0.3.0"
3
3
  end
4
4
 
5
5
  if defined?(Rails)
@@ -17,6 +17,9 @@ class AssetResource::Middleware
17
17
  handle :styles, "text/css"
18
18
  end
19
19
 
20
+ translator :css, &passthrough_translator
21
+ translator :js, &passthrough_translator
22
+
20
23
  translator :less do |filename|
21
24
  begin
22
25
  require "less"
@@ -83,6 +86,10 @@ private ######################################################################
83
86
  end
84
87
 
85
88
  def default_translator
89
+ lambda { |filename| "" }
90
+ end
91
+
92
+ def passthrough_translator
86
93
  lambda { |filename| File.read(filename) }
87
94
  end
88
95
 
@@ -55,9 +55,18 @@ describe AssetResource::Middleware do
55
55
  describe "with a blank file extension" do
56
56
  let(:middleware) { AssetResource::Middleware.new(app, :base_path => asset_fixture("blank_extension")) }
57
57
 
58
- it "should render properly without" do
58
+ it "should not try to render files with no extension" do
59
59
  data = RestClient.get("http://localhost/assets/styles.css")
60
- data.should include "somedata"
60
+ data.should include "#c55000"
61
+ end
62
+ end
63
+
64
+ describe "with images" do
65
+ let(:middleware) { AssetResource::Middleware.new(app, :base_path => asset_fixture("with_images")) }
66
+
67
+ it "should not render unknown file types" do
68
+ data = RestClient.get("http://localhost/assets/styles.css")
69
+ data.should == "test\n"
61
70
  end
62
71
  end
63
72
 
@@ -0,0 +1,3 @@
1
+ #header {
2
+ color: #c55000;
3
+ }
@@ -0,0 +1 @@
1
+ test
metadata CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 2
9
- - 2
10
- version: 0.2.2
8
+ - 3
9
+ - 0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - |
@@ -137,12 +137,14 @@ dependencies:
137
137
  requirements:
138
138
  - - ~>
139
139
  - !ruby/object:Gem::Version
140
- hash: 15
140
+ hash: 62196421
141
141
  segments:
142
142
  - 2
143
143
  - 0
144
144
  - 0
145
- version: 2.0.0
145
+ - beta
146
+ - 19
147
+ version: 2.0.0.beta.19
146
148
  type: :runtime
147
149
  name: rspec
148
150
  prerelease: false
@@ -166,11 +168,15 @@ files:
166
168
  - lib/asset_resource/middleware.rb
167
169
  - spec/asset_resource/middleware_spec.rb
168
170
  - spec/asset_resource_spec.rb
169
- - spec/fixtures/blank_extension/styles/somefile
171
+ - spec/fixtures/blank_extension/styles/no_extension
172
+ - spec/fixtures/blank_extension/styles/sample.css
170
173
  - spec/fixtures/normal/scripts/sample.js
171
174
  - spec/fixtures/normal/styles/_no.css
172
175
  - spec/fixtures/normal/styles/sample.less
173
176
  - spec/fixtures/normal/styles/sample.sass
177
+ - spec/fixtures/with_images/styles/image.gif
178
+ - spec/fixtures/with_images/styles/image.png
179
+ - spec/fixtures/with_images/styles/sample.css
174
180
  - spec/spec_helper.rb
175
181
  has_rdoc: true
176
182
  homepage: http://github.com/ddollar/asset-resource