Class: Instapusher2::TagTheRelease

Inherits:
Object
  • Object
show all
Defined in:
lib/instapusher2/tag_the_release.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(branch_name, debug) ⇒ TagTheRelease

Returns a new instance of TagTheRelease.



6
7
8
9
# File 'lib/instapusher2/tag_the_release.rb', line 6

def initialize branch_name, debug
  @branch_name = branch_name
  @debug = debug
end

Instance Attribute Details

#branch_nameObject (readonly)

Returns the value of attribute branch_name.



4
5
6
# File 'lib/instapusher2/tag_the_release.rb', line 4

def branch_name
  @branch_name
end

#debugObject (readonly)

Returns the value of attribute debug.



4
5
6
# File 'lib/instapusher2/tag_the_release.rb', line 4

def debug
  @debug
end

Instance Method Details

#tagitObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/instapusher2/tag_the_release.rb', line 11

def tagit
  version_number = Time.current.to_s.parameterize
  tag_name = "#{branch_name}-#{version_number}"

  cmd = "git tag -a -m \"Version #{tag_name}\" #{tag_name}"
  puts cmd if debug
  system cmd

  cmd =  "git push --tags"
  puts cmd if debug
  system cmd
end