butler_static 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +35 -3
  2. data/lib/butler.rb +1 -1
  3. data/lib/butler/version.rb +1 -1
  4. metadata +3 -3
data/README.md CHANGED
@@ -32,7 +32,7 @@ Or install it yourself as:
32
32
 
33
33
  ## Usage
34
34
 
35
- ### Configuration
35
+ <!-- ### Configuration
36
36
 
37
37
  ```ruby
38
38
  # config/environment/production.rb
@@ -47,6 +47,34 @@ config.assets.header_rules = {
47
47
  rule => {http_field => content},
48
48
  rule => {http_field => content}
49
49
  }
50
+ ``` -->
51
+
52
+ ### Integration & Configuration in a Rails environment
53
+
54
+ Tell Rails where to insert Butler in the middleware stack and see if it is working(`$ rake middleware`).
55
+
56
+ ```ruby
57
+ # config/environment/production.rb
58
+
59
+ # Butler Config
60
+ require 'butler'
61
+ config.butler = ActiveSupport::OrderedOptions.new # enable namespaced configuration
62
+ config.butler.enable_butler = true
63
+ config.butler.header_rules = {
64
+ :global => {'Cache-Control' => 'public, max-age=31536000'},
65
+ :fonts => {'Access-Control-Allow-Origin' => '*'}
66
+ }
67
+
68
+ # Use Butler
69
+ enable_butler = config.butler.enable_butler
70
+ path = config.paths['public'].first
71
+ options = {}
72
+ options[:header_rules] = config.butler.header_rules
73
+
74
+ if enable_butler
75
+ config.middleware.delete ActionDispatch::Static # delete ActionDispatch::Static when deploying to Heroku
76
+ config.middleware.insert_before Rack::Cache, ::Butler::Static, path, options
77
+ end
50
78
  ```
51
79
 
52
80
  ### Providing Rules for setting HTTP Headers
@@ -111,8 +139,7 @@ config.assets.header_rules = {
111
139
  :fonts => {'Access-Control-Allow-Origin' => '*'}
112
140
  }
113
141
  ```
114
- That's it. I hope you like Butler.
115
- Shoot me an [email](github@tklemm.eu) or [tweet](https://www.twitter.com/thomasjklemm) if you have any questions or thoughts about how to improve Butler. Enjoy your life!
142
+ [TODO] Implement Railtie so that this example is working in 0.1.0
116
143
 
117
144
  ## Contributing
118
145
 
@@ -123,3 +150,8 @@ Shoot me an [email](github@tklemm.eu) or [tweet](https://www.twitter.com/thomasj
123
150
  4. Commit your changes (`git commit -am 'Add some feature'`)
124
151
  5. Push to the branch (`git push origin my-new-feature`)
125
152
  6. Create new Pull Request
153
+
154
+ ## Thanks
155
+
156
+ That's it. I hope you like Butler.
157
+ Shoot me an [email](github@tklemm.eu) or [tweet](https://www.twitter.com/thomasjklemm) if you have any questions or thoughts about how to improve Butler. Enjoy your life!
@@ -2,7 +2,7 @@ require 'butler/version'
2
2
  require 'butler/static'
3
3
  require 'butler/handler'
4
4
  require 'butler/asset'
5
- require 'butler/railtie'
5
+ require 'butler/railtie' if defined? Rails
6
6
 
7
7
  module Butler
8
8
  # Butler
@@ -1,3 +1,3 @@
1
1
  module Butler
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: butler_static
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-19 00:00:00.000000000 Z
12
+ date: 2012-08-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -168,7 +168,7 @@ rubyforge_project:
168
168
  rubygems_version: 1.8.23
169
169
  signing_key:
170
170
  specification_version: 3
171
- summary: butler_static-0.0.8
171
+ summary: butler_static-0.0.9
172
172
  test_files:
173
173
  - spec/butler/asset_spec.rb
174
174
  - spec/butler/files/index.html