Class: Rack::GitSha
- Inherits:
-
Object
- Object
- Rack::GitSha
- Defined in:
- lib/rack/git_sha.rb,
lib/rack/git_sha/version.rb
Constant Summary collapse
- VERSION =
"1.1.0"
Class Method Summary collapse
Instance Method Summary collapse
-
#call(env) ⇒ Object
Public: Rack interface, run when the application is requested.
-
#initialize(root = Dir.pwd) ⇒ GitSha
constructor
Public: Initialize a new GitSha app.
Constructor Details
Class Method Details
.call(env) ⇒ Object
7 8 9 |
# File 'lib/rack/git_sha.rb', line 7 def self.call(env) new.call(env) end |
Instance Method Details
#call(env) ⇒ Object
Public: Rack interface, run when the application is requested.
env - The Hash environment of the incoming request.
Returns an Array ‘[status, headers, [body]]` for Rack.
25 26 27 28 29 30 31 32 33 |
# File 'lib/rack/git_sha.rb', line 25 def call(env) if revision_file.exist? ok revision_file.read elsif git_repository? ok git_current_commit_sha else not_found 'Could not determine SHA' end end |