Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/narkoz/git-revision
Ruby gem to get information about git source code
https://github.com/narkoz/git-revision
deployment git git-revision ruby-gem
Last synced: 10 days ago
JSON representation
Ruby gem to get information about git source code
- Host: GitHub
- URL: https://github.com/narkoz/git-revision
- Owner: NARKOZ
- License: bsd-2-clause
- Created: 2012-12-14T11:49:13.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2022-06-12T08:27:01.000Z (over 2 years ago)
- Last Synced: 2024-10-13T18:08:37.055Z (25 days ago)
- Topics: deployment, git, git-revision, ruby-gem
- Language: Ruby
- Homepage: https://rubygems.org/gems/git-revision
- Size: 11.7 KB
- Stars: 12
- Watchers: 3
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Git Revision
Git Revision is a simple (45 SLoC) Ruby gem that provides basic information about git source code.
You can use it in your apps, [for example](http://stackoverflow.com/q/8500644/159721), to show deployed version.## Installation
Add to Gemfile:
```ruby
gem 'git-revision'
```and run:
```sh
bundle install
```## Usage
`Git::Revision.info` will return the following hash:
```ruby
{
:author => "John Smith",
:branch => "master",
:commit_hash => "60619c10baca6f9b4d03253697d43b7cf5d08edf",
:commit_hash_short => "60619c1",
:commit_subject => "release beta version",
:authored_date => "Fri Jun 8 17:55:01 2012 +0500",
:authored_timestamp => "1339160101",
:commit_tag => "4.2.0.beta",
:repo_last_tag => "4.2.0.beta"
}
```Additionally you can access these methods directly:
```ruby
Git::Revision.author # returns last commit author
Git::Revision.branch # returns current branch
Git::Revision.commit # returns last commit hash
Git::Revision.commit_short # returns abbreviated last commit hash (7 characters)
Git::Revision.message # returns last commit message subject
Git::Revision.date # returns authored date of last commit
Git::Revision.timestamp # returns authored date of last commit in Unix time
Git::Revision.tag # returns last commit tag if exists
Git::Revision.last_tag # returns last tag in repository if exists
```## License
Released under the BSD 2-clause license. See LICENSE.txt for details.