class Shack::ShackRails

Public Class Methods

new(app) click to toggle source
# File lib/shack/railtie.rb, line 9
def initialize(app)
  @app = app
end

Public Instance Methods

fetch_sha_from_file?() click to toggle source
# File lib/shack/railtie.rb, line 29
def fetch_sha_from_file?
  Shack.sha.blank? && File.exist?(revision_file)
end
inject!() click to toggle source
# 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() click to toggle source
# File lib/shack/railtie.rb, line 33
def revision_file
  File.join(Rails.root, "REVISION")
end