Module: FlazmRubyHelpers::Project::Git

Defined in:
lib/flazm_ruby_helpers/project.rb

Overview

Helper module to publish git projects

Class Method Summary collapse

Class Method Details

.publish(version, remote, branch) ⇒ Object

git show origin/master:VERSION



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/flazm_ruby_helpers/project.rb', line 14

def self.publish(version, remote, branch)
  g = ::Git.init
  g.fetch

  validate(g, version)
  
  g.add_tag(version)
  puts "Added git tag '#{version}'"
  _output, push_success = FlazmRubyHelpers::Os.exec("git push #{remote} #{version}:master")
  raise "ERROR: Failed to push to #{remote} for branch #{branch}" unless push_success
  _output, tag_success = FlazmRubyHelpers::Os.exec("git push --tags #{remote}")
  raise "ERROR: Failed to push to #{remote} for branch #{branch}" unless tag_success
end