asset-resource 0.2.1 → 0.2.2

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.1"
2
+ VERSION = "0.2.2"
3
3
  end
4
4
 
5
5
  if defined?(Rails)
@@ -91,6 +91,7 @@ private ######################################################################
91
91
  end
92
92
 
93
93
  def translator(type, &block)
94
+ return default_translator unless type
94
95
  translators[type.to_sym] = block if block_given?
95
96
  translators[type.to_sym]
96
97
  end
@@ -4,7 +4,7 @@ require "asset_resource/middleware"
4
4
  describe AssetResource::Middleware do
5
5
 
6
6
  let(:app) { lambda { |env| [ 200, {}, ['bar'] ]} }
7
- let(:middleware) { AssetResource::Middleware.new(app, :base_path => asset_fixture) }
7
+ let(:middleware) { AssetResource::Middleware.new(app, :base_path => asset_fixture("normal")) }
8
8
 
9
9
  before(:each) do
10
10
  Artifice.activate_with(middleware)
@@ -52,4 +52,13 @@ describe AssetResource::Middleware do
52
52
  data.should_not include "#c55000"
53
53
  end
54
54
 
55
+ describe "with a blank file extension" do
56
+ let(:middleware) { AssetResource::Middleware.new(app, :base_path => asset_fixture("blank_extension")) }
57
+
58
+ it "should render properly without" do
59
+ data = RestClient.get("http://localhost/assets/styles.css")
60
+ data.should include "somedata"
61
+ end
62
+ end
63
+
55
64
  end
@@ -0,0 +1 @@
1
+ somedata
@@ -0,0 +1,3 @@
1
+ $(document).ready(function() {
2
+ console.log('hello!');
3
+ });
@@ -0,0 +1,3 @@
1
+ #header {
2
+ color: #c55000;
3
+ }
@@ -0,0 +1,9 @@
1
+ @brand: #1e5500;
2
+
3
+ #header {
4
+ color: @brand;
5
+ }
6
+
7
+ h2 {
8
+ color: @brand;
9
+ }
@@ -0,0 +1,7 @@
1
+ $brand: #5a5500
2
+
3
+ #header
4
+ color: $brand
5
+
6
+ h3
7
+ color: $brand
metadata CHANGED
@@ -1,26 +1,26 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asset-resource
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 1
10
- version: 0.2.1
9
+ - 2
10
+ version: 0.2.2
11
11
  platform: ruby
12
12
  authors:
13
- - David Dollar
13
+ - |
14
+ David Dollar
15
+
14
16
  autorequire:
15
17
  bindir: bin
16
18
  cert_chain: []
17
19
 
18
- date: 2010-08-16 00:00:00 -04:00
20
+ date: 2010-08-23 00:00:00 -04:00
19
21
  default_executable:
20
22
  dependencies:
21
23
  - !ruby/object:Gem::Dependency
22
- name: artifice
23
- prerelease: false
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
@@ -31,11 +31,11 @@ dependencies:
31
31
  - 0
32
32
  - 5
33
33
  version: "0.5"
34
- type: :development
34
+ type: :runtime
35
+ name: artifice
36
+ prerelease: false
35
37
  version_requirements: *id001
36
38
  - !ruby/object:Gem::Dependency
37
- name: fakefs
38
- prerelease: false
39
39
  requirement: &id002 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
@@ -47,11 +47,11 @@ dependencies:
47
47
  - 2
48
48
  - 1
49
49
  version: 0.2.1
50
- type: :development
50
+ type: :runtime
51
+ name: fakefs
52
+ prerelease: false
51
53
  version_requirements: *id002
52
54
  - !ruby/object:Gem::Dependency
53
- name: haml
54
- prerelease: false
55
55
  requirement: &id003 !ruby/object:Gem::Requirement
56
56
  none: false
57
57
  requirements:
@@ -63,11 +63,11 @@ dependencies:
63
63
  - 0
64
64
  - 9
65
65
  version: 3.0.9
66
- type: :development
66
+ type: :runtime
67
+ name: haml
68
+ prerelease: false
67
69
  version_requirements: *id003
68
70
  - !ruby/object:Gem::Dependency
69
- name: less
70
- prerelease: false
71
71
  requirement: &id004 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
@@ -79,11 +79,11 @@ dependencies:
79
79
  - 2
80
80
  - 21
81
81
  version: 1.2.21
82
- type: :development
82
+ type: :runtime
83
+ name: less
84
+ prerelease: false
83
85
  version_requirements: *id004
84
86
  - !ruby/object:Gem::Dependency
85
- name: rake
86
- prerelease: false
87
87
  requirement: &id005 !ruby/object:Gem::Requirement
88
88
  none: false
89
89
  requirements:
@@ -95,11 +95,11 @@ dependencies:
95
95
  - 8
96
96
  - 7
97
97
  version: 0.8.7
98
- type: :development
98
+ type: :runtime
99
+ name: rake
100
+ prerelease: false
99
101
  version_requirements: *id005
100
102
  - !ruby/object:Gem::Dependency
101
- name: rest-client
102
- prerelease: false
103
103
  requirement: &id006 !ruby/object:Gem::Requirement
104
104
  none: false
105
105
  requirements:
@@ -111,11 +111,11 @@ dependencies:
111
111
  - 5
112
112
  - 1
113
113
  version: 1.5.1
114
- type: :development
114
+ type: :runtime
115
+ name: rest-client
116
+ prerelease: false
115
117
  version_requirements: *id006
116
118
  - !ruby/object:Gem::Dependency
117
- name: rcov
118
- prerelease: false
119
119
  requirement: &id007 !ruby/object:Gem::Requirement
120
120
  none: false
121
121
  requirements:
@@ -127,11 +127,11 @@ dependencies:
127
127
  - 9
128
128
  - 8
129
129
  version: 0.9.8
130
- type: :development
130
+ type: :runtime
131
+ name: rcov
132
+ prerelease: false
131
133
  version_requirements: *id007
132
134
  - !ruby/object:Gem::Dependency
133
- name: rspec
134
- prerelease: false
135
135
  requirement: &id008 !ruby/object:Gem::Requirement
136
136
  none: false
137
137
  requirements:
@@ -143,19 +143,21 @@ dependencies:
143
143
  - 0
144
144
  - 0
145
145
  version: 2.0.0
146
- type: :development
146
+ type: :runtime
147
+ name: rspec
148
+ prerelease: false
147
149
  version_requirements: *id008
148
150
  description: Manage CSS/JS assets as dynamic resources rather than static files
149
- email: ddollar@gmail.com
151
+ email: |
152
+ <ddollar@gmail.com>
153
+
150
154
  executables: []
151
155
 
152
156
  extensions: []
153
157
 
154
- extra_rdoc_files:
155
- - README.md
158
+ extra_rdoc_files: []
159
+
156
160
  files:
157
- - README.md
158
- - Rakefile
159
161
  - lib/asset-resource.rb
160
162
  - lib/asset_resource.rb
161
163
  - lib/asset_resource/framework/rails2.rb
@@ -164,14 +166,19 @@ files:
164
166
  - lib/asset_resource/middleware.rb
165
167
  - spec/asset_resource/middleware_spec.rb
166
168
  - spec/asset_resource_spec.rb
169
+ - spec/fixtures/blank_extension/styles/somefile
170
+ - spec/fixtures/normal/scripts/sample.js
171
+ - spec/fixtures/normal/styles/_no.css
172
+ - spec/fixtures/normal/styles/sample.less
173
+ - spec/fixtures/normal/styles/sample.sass
167
174
  - spec/spec_helper.rb
168
- has_rdoc: false
175
+ has_rdoc: true
169
176
  homepage: http://github.com/ddollar/asset-resource
170
177
  licenses: []
171
178
 
172
179
  post_install_message:
173
- rdoc_options:
174
- - --charset=UTF-8
180
+ rdoc_options: []
181
+
175
182
  require_paths:
176
183
  - lib
177
184
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -194,12 +201,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
201
  version: "0"
195
202
  requirements: []
196
203
 
197
- rubyforge_project:
204
+ rubyforge_project: nowarning
198
205
  rubygems_version: 1.3.7
199
206
  signing_key:
200
207
  specification_version: 3
201
208
  summary: Manage CSS/JS assets as dynamic resources rather than static files
202
- test_files:
203
- - spec/asset_resource/middleware_spec.rb
204
- - spec/asset_resource_spec.rb
205
- - spec/spec_helper.rb
209
+ test_files: []
210
+
data/README.md DELETED
@@ -1,86 +0,0 @@
1
- # AssetResource
2
-
3
- Serve up your CSS and Javascript as first-class resources.
4
-
5
- Supports in-line rendering of engines such as Sass and Less. These files will
6
- be served with 24-hour HTTP cache expiry.
7
-
8
- Built-in configuration and helpers for Rails 2.x, Rails 3.x and Sinatra.
9
-
10
- ## Usage
11
-
12
- ### Rails 2.x
13
-
14
- # public/stylesheets/*.{css|less|sass}
15
- # public/javascripts/*.js
16
-
17
- # config/environment.rb
18
- config.gem "asset-resource"
19
-
20
- # app/views/layouts/application.html.erb
21
- <html>
22
- <head>
23
- <%= asset_resource_javascripts %>
24
- <%= asset_resource_stylesheets %>
25
- </head>
26
- </html>
27
-
28
- ### Rails 3.x
29
-
30
- # public/stylesheets/*.{css|less|sass}
31
- # public/javascripts/*.js
32
-
33
- # Gemfile
34
- gem "asset-resource"
35
-
36
- # app/views/layouts/application.html.erb
37
- <html>
38
- <head>
39
- <%= asset_resource_javascripts %>
40
- <%= asset_resource_stylesheets %>
41
- </head>
42
- </html>
43
-
44
- ### Sinatra
45
-
46
- # assets/styles/*.{css|less|sass}
47
- # assets/scripts/*.js
48
-
49
- # app.rb
50
- require "asset_resource"
51
-
52
- class App < Sinatra::Base
53
- register Sinatra::AssetResource
54
- end
55
-
56
- __END__
57
-
58
- @@ layout
59
- %html
60
- %head
61
- = asset_resource_scripts
62
- = asset_resource_styles
63
-
64
- ## Technical Details
65
-
66
- `AssetResource::Middleware` serves requests at `/assets/stylesheets.css` and
67
- `/assets/javascripts.js`.
68
-
69
- The gem will add appropriate view helpers to your framework of choice.
70
-
71
- You can use the middleware yourself like this:
72
-
73
- use AssetResource::Middleware,
74
- :base_path => "public",
75
- :handlers => { :javascripts => "text/javascript",
76
- :stylesheets => "text/css" }
77
-
78
- ## Copyright
79
-
80
- MIT License
81
-
82
- ## Author
83
-
84
- David Dollar
85
-
86
- [http://daviddollar.org](http://daviddollar.org)
data/Rakefile DELETED
@@ -1,58 +0,0 @@
1
- require "rake"
2
- require "rspec"
3
- require "rspec/core/rake_task"
4
-
5
- $:.unshift File.expand_path("../lib", __FILE__)
6
- require "asset_resource"
7
-
8
- task :default => :spec
9
-
10
- desc "Run all specs"
11
- Rspec::Core::RakeTask.new(:spec) do |t|
12
- t.pattern = 'spec/**/*_spec.rb'
13
- end
14
-
15
- desc "Generate RCov code coverage report"
16
- task :rcov => "rcov:build" do
17
- %x{ open coverage/index.html }
18
- end
19
-
20
- Rspec::Core::RakeTask.new("rcov:build") do |t|
21
- t.pattern = 'spec/**/*_spec.rb'
22
- t.rcov = true
23
- t.rcov_opts = [ "--exclude", Gem.default_dir , "--exclude", "spec" ]
24
- end
25
-
26
- ######################################################
27
-
28
- begin
29
- require 'jeweler'
30
- Jeweler::Tasks.new do |s|
31
- s.name = "asset-resource"
32
- s.version = AssetResource::VERSION
33
-
34
- s.summary = "Manage CSS/JS assets as dynamic resources rather than static files"
35
- s.description = s.summary
36
- s.author = "David Dollar"
37
- s.email = "ddollar@gmail.com"
38
- s.homepage = "http://github.com/ddollar/asset-resource"
39
-
40
- s.platform = Gem::Platform::RUBY
41
- s.has_rdoc = false
42
-
43
- s.files = %w(Rakefile README.md) + Dir["{bin,lib}/**/*"]
44
- s.require_path = "lib"
45
-
46
- s.add_development_dependency 'artifice', '~> 0.5'
47
- s.add_development_dependency 'fakefs', '~> 0.2.1'
48
- s.add_development_dependency 'haml', '~> 3.0.9'
49
- s.add_development_dependency 'less', '~> 1.2.21'
50
- s.add_development_dependency 'rake', '~> 0.8.7'
51
- s.add_development_dependency 'rest-client', '~> 1.5.1'
52
- s.add_development_dependency 'rcov', '~> 0.9.8'
53
- s.add_development_dependency 'rspec', '~> 2.0.0'
54
- end
55
- Jeweler::GemcutterTasks.new
56
- rescue LoadError
57
- puts "Jeweler not available. Install it with: sudo gem install jeweler"
58
- end