Class: Milestoner::Git::Kit
- Inherits:
-
Object
- Object
- Milestoner::Git::Kit
- Defined in:
- lib/milestoner/git/kit.rb
Overview
A lightweight Git wrapper.
Instance Method Summary collapse
- #commits? ⇒ Boolean
-
#initialize ⇒ Kit
constructor
A new instance of Kit.
- #push_tags ⇒ Object
- #remote? ⇒ Boolean
- #supported? ⇒ Boolean
- #tag_local?(tag) ⇒ Boolean
- #tag_remote?(tag) ⇒ Boolean
- #tagged? ⇒ Boolean
Constructor Details
#initialize ⇒ Kit
7 8 9 |
# File 'lib/milestoner/git/kit.rb', line 7 def initialize @git_dir = File.join Dir.pwd, ".git" end |
Instance Method Details
#commits? ⇒ Boolean
15 16 17 |
# File 'lib/milestoner/git/kit.rb', line 15 def commits? !shell("git log").empty? end |
#push_tags ⇒ Object
19 20 21 |
# File 'lib/milestoner/git/kit.rb', line 19 def shell "git push --tags" end |
#remote? ⇒ Boolean
35 36 37 |
# File 'lib/milestoner/git/kit.rb', line 35 def remote? !shell("git config remote.origin.url").empty? end |
#supported? ⇒ Boolean
11 12 13 |
# File 'lib/milestoner/git/kit.rb', line 11 def supported? File.exist? git_dir end |
#tag_local?(tag) ⇒ Boolean
27 28 29 |
# File 'lib/milestoner/git/kit.rb', line 27 def tag_local? tag shell("git tag --list #{tag}").match?(/\A#{tag}\Z/) end |
#tag_remote?(tag) ⇒ Boolean
31 32 33 |
# File 'lib/milestoner/git/kit.rb', line 31 def tag_remote? tag shell("git ls-remote --tags origin #{tag}").match?(%r(.+tags\/#{tag}\Z)) end |
#tagged? ⇒ Boolean
23 24 25 |
# File 'lib/milestoner/git/kit.rb', line 23 def tagged? !shell("git tag").empty? end |