Class: Nsync::GitVersionManager
- Inherits:
-
Object
- Object
- Nsync::GitVersionManager
- Defined in:
- lib/nsync/git_version_manager.rb
Instance Method Summary collapse
-
#initialize(repo_path = nil) ⇒ GitVersionManager
constructor
A new instance of GitVersionManager.
- #previous_version ⇒ Object
- #previous_versions ⇒ Object
- #repo ⇒ Object
- #version ⇒ Object
- #version=(val) ⇒ Object
Constructor Details
#initialize(repo_path = nil) ⇒ GitVersionManager
Returns a new instance of GitVersionManager.
3 4 5 |
# File 'lib/nsync/git_version_manager.rb', line 3 def initialize(repo_path = nil) @repo_path = repo_path end |
Instance Method Details
#previous_version ⇒ Object
20 21 22 |
# File 'lib/nsync/git_version_manager.rb', line 20 def previous_version previous_versions[0] end |
#previous_versions ⇒ Object
24 25 26 |
# File 'lib/nsync/git_version_manager.rb', line 24 def previous_versions repo.commits("master", 10, 1).map(&:id) if repo end |
#repo ⇒ Object
7 8 9 10 |
# File 'lib/nsync/git_version_manager.rb', line 7 def repo # if the repo is not ready, lets just hope it works @repo ||= Grit::Repo.new(@repo_path || Nsync.config.repo_path) rescue nil end |
#version ⇒ Object
12 13 14 |
# File 'lib/nsync/git_version_manager.rb', line 12 def version repo.head.commit.id if repo end |
#version=(val) ⇒ Object
16 17 18 |
# File 'lib/nsync/git_version_manager.rb', line 16 def version=(val) val end |