Class: AppVersion
- Inherits:
-
Object
- Object
- AppVersion
- Defined in:
- lib/app-version-git.rb
Instance Method Summary collapse
- #changelog ⇒ Object
-
#initialize(path) ⇒ AppVersion
constructor
A new instance of AppVersion.
- #version ⇒ Object
Constructor Details
#initialize(path) ⇒ AppVersion
Returns a new instance of AppVersion.
7 8 9 10 |
# File 'lib/app-version-git.rb', line 7 def initialize path path = File.(File.dirname(path)) @git = Git.open(path) end |
Instance Method Details
#changelog ⇒ Object
20 21 22 23 24 |
# File 'lib/app-version-git.rb', line 20 def changelog @git.log.collect{|l| { :date => l.date, :author => l.committer.name, :message => l. } } end |
#version ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/app-version-git.rb', line 12 def version log_count = @git.log.size patch = log_count % 10 minor = log_count/10 % 10 major = log_count/100 % 10 "#{major}.#{minor}.#{patch}" end |