lib/rack/manifest.rb in rack-manifest-0.1.1 vs lib/rack/manifest.rb in rack-manifest-0.1.2
- old
+ new
@@ -1,26 +1,26 @@
-require 'rack/manifest/version'
require 'yaml'
require 'json'
+require 'rack/manifest/version'
+require 'rack/manifest/rails' if defined?(Rails::Railtie)
module Rack
class Manifest
def initialize(app)
@app = app
end
def call(env)
- status, headers, body = @app.call(env)
if env[PATH_INFO] == '/manifest.json'
manifest = YAML.load_file('./config/manifest.yml')
json = JSON.generate(manifest)
[
- 200,
+ 200,
{'Content-Type' => 'application/json'},
[json]
]
else
- [status, headers, body]
+ @app.call(env)
end
end
end
end