Class: Pkgr::Git
- Inherits:
-
Object
- Object
- Pkgr::Git
- Defined in:
- lib/pkgr/git.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path) ⇒ Git
constructor
A new instance of Git.
- #latest_tag ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(path) ⇒ Git
Returns a new instance of Git.
7 8 9 |
# File 'lib/pkgr/git.rb', line 7 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'lib/pkgr/git.rb', line 5 def path @path end |
Instance Method Details
#latest_tag ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/pkgr/git.rb', line 11 def latest_tag return nil unless valid? Dir.chdir(path) do git_describe = Mixlib::ShellOut.new("git describe --tags --abbrev=0") git_describe.logger = Pkgr.logger git_describe.run_command git_describe.stdout.chomp end end |
#valid? ⇒ Boolean
21 22 23 |
# File 'lib/pkgr/git.rb', line 21 def valid? File.file?(File.join(path, ".git", "index")) end |