butler_static 0.0.4 → 0.0.5

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/lib/butler/static.rb CHANGED
@@ -77,8 +77,14 @@ module Butler
77
77
  class Static
78
78
  def initialize(app, options={})
79
79
  @app = app
80
- path = options[:path] || Rails.application.config.paths['public'].first
81
- @header_rules = options[:header_rules] || {}
80
+ path = options[:path] || ''
81
+ path ||= Rails.application.config.paths['public'].first if defined? Rails
82
+ @header_rules = {}
83
+ if defined? Rails
84
+ header_rules = Rails.application.confg.assets.header_rules
85
+ @header_rules.merge(header_rules) if header_rules
86
+ end
87
+ @header_rules = @header_rules.merge(options[:header_rules]) if options[:header_rules]
82
88
  @file_handler = Butler::Handler.new(path, header_rules: @header_rules)
83
89
  end
84
90
 
@@ -1,3 +1,3 @@
1
1
  module Butler
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -185,7 +185,7 @@ class StaticTest < MiniTest::Unit::TestCase
185
185
  /\.(css|erb)\z/ => {'Cache-Control' => 'public, max-age=600'},
186
186
  }
187
187
 
188
- App = Butler::Static.new(DummyApp, "#{FIXTURE_LOAD_PATH}/public", header_rules: header_rules)
188
+ App = Butler::Static.new(DummyApp, path: "#{FIXTURE_LOAD_PATH}/public", header_rules: header_rules)
189
189
 
190
190
  def setup
191
191
  @app = App
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.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: