Rack::Git::Revision
Rack::GitRevision is a git revision http interface for rack applications.
Usage
# Gemfile
gem 'rack-dev-revision'
And then execute:
# config.ru
use Rack::DevRevision
$ curl localhost:3000/dev/revision
=> 7424ba3207725cd1321f06949330b5f531f9af72
Customize Url
Change Url path
use Rack::GitRevision, path: '/git_revision'
Change how to get revision
use Rack::GitRevision, { revision: lambda { File.read('./REVISION').strip } }
Options
Defaults
options = {
path: '/dev/revision',
revision: lambda { `git log -1 --pretty="format:%H"` },
body: lambda { |revision| revision },
status: lambda { |revision| revision ? 200 : 404 },
headers: lambda { |revision| { 'Content-Type' => 'text/plain' }
}
Contributing
- Fork it ( https://github.com/attracie/rack-git-revision/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request