[go: up one dir, main page]

Skip to content

lain0/git-revision

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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, to show deployed version.

Installation

Add to Gemfile:

gem 'git-revision'

and run:

bundle install

Usage

Git::Revision.info will return the following hash:

{
  :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:

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.

About

Ruby gem to get information about git source code

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%