butler_static 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/butler/static.rb +5 -10
- data/lib/butler/version.rb +1 -1
- data/test/butler/static_test.rb +1 -1
- metadata +1 -1
data/lib/butler/static.rb
CHANGED
@@ -75,18 +75,13 @@ module Butler
|
|
75
75
|
# general global HTTP header settings
|
76
76
|
#
|
77
77
|
class Static
|
78
|
-
def initialize(app, options={})
|
78
|
+
def initialize(app, path=nil, options={})
|
79
79
|
@app = app
|
80
|
-
path = options[:path] || ''
|
81
|
-
# CLEAN THIS MESS UP
|
82
80
|
path ||= Rails.application.config.paths['public'].first if defined? Rails
|
83
|
-
|
84
|
-
if defined? Rails
|
85
|
-
|
86
|
-
|
87
|
-
end
|
88
|
-
@header_rules = @header_rules.merge(options[:header_rules]) if options[:header_rules]
|
89
|
-
@file_handler = Butler::Handler.new(path, header_rules: @header_rules)
|
81
|
+
header_rules = {}
|
82
|
+
header_rules = Rails.application.config.assets.header_rules if defined? Rails
|
83
|
+
header_rules = options[:header_rules] if options[:header_rules]
|
84
|
+
@file_handler = Butler::Handler.new(path, header_rules: header_rules)
|
90
85
|
end
|
91
86
|
|
92
87
|
def call(env)
|
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,
|
188
|
+
App = Butler::Static.new(DummyApp, "#{FIXTURE_LOAD_PATH}/public", header_rules: header_rules)
|
189
189
|
|
190
190
|
def setup
|
191
191
|
@app = App
|