Class: Blacksmith::Git
- Inherits:
-
Object
- Object
- Blacksmith::Git
- Defined in:
- lib/puppet_blacksmith/git.rb
Instance Attribute Summary collapse
-
#commit_message_pattern ⇒ Object
Pattern to use for tags, %s is replaced with the actual version.
-
#path ⇒ Object
Returns the value of attribute path.
-
#tag_message_pattern ⇒ Object
Returns the value of attribute tag_message_pattern.
-
#tag_pattern ⇒ Object
Returns the value of attribute tag_pattern.
-
#tag_sign ⇒ Object
Returns the value of attribute tag_sign.
Instance Method Summary collapse
- #commit_modulefile!(version) ⇒ Object
- #has_tag?(tag) ⇒ Boolean
- #has_version_tag?(version) ⇒ Boolean
-
#initialize(path = ".") ⇒ Git
constructor
A new instance of Git.
- #push! ⇒ Object
- #tag!(version) ⇒ Object
Constructor Details
#initialize(path = ".") ⇒ Git
Returns a new instance of Git.
26 27 28 |
# File 'lib/puppet_blacksmith/git.rb', line 26 def initialize(path = ".") @path = File.(path) end |
Instance Attribute Details
#commit_message_pattern ⇒ Object
Pattern to use for tags, %s is replaced with the actual version
10 11 12 |
# File 'lib/puppet_blacksmith/git.rb', line 10 def end |
#path ⇒ Object
Returns the value of attribute path.
6 7 8 |
# File 'lib/puppet_blacksmith/git.rb', line 6 def path @path end |
#tag_message_pattern ⇒ Object
Returns the value of attribute tag_message_pattern.
6 7 8 |
# File 'lib/puppet_blacksmith/git.rb', line 6 def end |
#tag_pattern ⇒ Object
Returns the value of attribute tag_pattern.
6 7 8 |
# File 'lib/puppet_blacksmith/git.rb', line 6 def tag_pattern @tag_pattern end |
#tag_sign ⇒ Object
Returns the value of attribute tag_sign.
6 7 8 |
# File 'lib/puppet_blacksmith/git.rb', line 6 def tag_sign @tag_sign end |
Instance Method Details
#commit_modulefile!(version) ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/puppet_blacksmith/git.rb', line 53 def commit_modulefile!(version) files = Blacksmith::Modulefile::FILES.select {|f| File.exists?(File.join(@path,f))} = % version s = exec_git ["add"] + files s += exec_git ["commit", "-m", ] s end |
#has_tag?(tag) ⇒ Boolean
30 31 32 |
# File 'lib/puppet_blacksmith/git.rb', line 30 def has_tag?(tag) exec_git(['tag', '--list', tag]).strip == tag end |
#has_version_tag?(version) ⇒ Boolean
34 35 36 37 |
# File 'lib/puppet_blacksmith/git.rb', line 34 def has_version_tag?(version) tag = tag_pattern % version has_tag? tag end |
#push! ⇒ Object
61 62 63 64 65 |
# File 'lib/puppet_blacksmith/git.rb', line 61 def push! s = exec_git ["push"] s += exec_git ["push", "--tags"] s end |
#tag!(version) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/puppet_blacksmith/git.rb', line 39 def tag!(version) tag = tag_pattern % version command = ["tag", tag] if = % version command += ["-m", ] end if tag_sign raise Blacksmith::Error, 'Signed tags require messages - set tag_message_pattern' unless command += ["-s"] end exec_git command end |