Class: Shack::ShackRails
- Inherits:
-
Object
- Object
- Shack::ShackRails
- Defined in:
- lib/shack/railtie.rb
Instance Method Summary collapse
- #fetch_sha_from_file? ⇒ Boolean
-
#initialize(app) ⇒ ShackRails
constructor
A new instance of ShackRails.
- #inject! ⇒ Object
- #revision_file ⇒ Object
Constructor Details
#initialize(app) ⇒ ShackRails
Returns a new instance of ShackRails.
9 10 11 |
# File 'lib/shack/railtie.rb', line 9 def initialize(app) @app = app end |
Instance Method Details
#fetch_sha_from_file? ⇒ Boolean
29 30 31 |
# File 'lib/shack/railtie.rb', line 29 def fetch_sha_from_file? Shack::Middleware.sha.blank? && File.exist?(revision_file) end |
#inject! ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/shack/railtie.rb', line 13 def inject! if Rails.env.production? # Don't show the stamp in production, but do add it to the headers Shack::Middleware.configure do |shack| shack.hide_stamp = true end end if fetch_sha_from_file? Shack::Middleware.configure do |shack| shack.sha = File.open(revision_file).read.strip end end @app.middleware.use(Shack::Middleware) end |
#revision_file ⇒ Object
33 34 35 |
# File 'lib/shack/railtie.rb', line 33 def revision_file File.join(Rails.root, "REVISION") end |