butler_static 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/butler/static.rb +8 -2
- data/lib/butler/version.rb +1 -1
- data/test/butler/static_test.rb +1 -1
- metadata +1 -1
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] ||
|
81
|
-
|
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
|
|
data/lib/butler/version.rb
CHANGED
data/test/butler/static_test.rb
CHANGED
@@ -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
|