Class: Rack::GitVersion
- Inherits:
-
Object
- Object
- Rack::GitVersion
- Defined in:
- lib/rack-git-version.rb,
lib/rack-git-version/version.rb
Constant Summary collapse
- VERSION =
"0.0.3"
Instance Method Summary collapse
- #call(env) ⇒ Object
- #git_version ⇒ Object
-
#initialize(app) ⇒ GitVersion
constructor
A new instance of GitVersion.
Constructor Details
#initialize(app) ⇒ GitVersion
Returns a new instance of GitVersion.
5 6 7 |
# File 'lib/rack-git-version.rb', line 5 def initialize app @app = app end |
Instance Method Details
#call(env) ⇒ Object
13 14 15 16 17 |
# File 'lib/rack-git-version.rb', line 13 def call env status, headers, body = @app.call env headers["X-Git-Version"] ||= git_version [status, headers, body] end |
#git_version ⇒ Object
9 10 11 |
# File 'lib/rack-git-version.rb', line 9 def git_version @@git_version ||= `git describe --always`.strip end |