Class: MSPRelease::Git::Commit

Inherits:
Object
  • Object
show all
Includes:
Exec::Helpers
Defined in:
lib/msp_release/git.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Exec::Helpers

#exec

Constructor Details

#initialize(project, attributes) ⇒ Commit

Returns a new instance of Commit.



50
51
52
53
54
55
# File 'lib/msp_release/git.rb', line 50

def initialize(project, attributes)
  @project = project
  attributes.each do |k, v|
    instance_variable_set(:"@#{k}", v)
  end
end

Instance Attribute Details

#authorObject (readonly)

Returns the value of attribute author.



47
48
49
# File 'lib/msp_release/git.rb', line 47

def author
  @author
end

#hashObject (readonly)

Returns the value of attribute hash.



48
49
50
# File 'lib/msp_release/git.rb', line 48

def hash
  @hash
end

#messageObject (readonly)

Returns the value of attribute message.



46
47
48
# File 'lib/msp_release/git.rb', line 46

def message
  @message
end

Instance Method Details

#release_commit?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/msp_release/git.rb', line 57

def release_commit?
  !! (release_name || tag)
end

#release_nameObject



66
67
68
# File 'lib/msp_release/git.rb', line 66

def release_name
  @project.release_name_from_message(message) || tag
end

#tagObject



61
62
63
64
# File 'lib/msp_release/git.rb', line 61

def tag
  tag = exec "git tag --contains #{hash}"
  (m = /^release-([0-9.]*)$/.match(tag)) && m[1]
end