Class: Nsync::GitVersionManager

Inherits:
Object
  • Object
show all
Defined in:
lib/nsync/git_version_manager.rb

Instance Method Summary collapse

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_versionObject



20
21
22
# File 'lib/nsync/git_version_manager.rb', line 20

def previous_version
  previous_versions[0]
end

#previous_versionsObject



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

#repoObject



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

#versionObject



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