Class: Integrity::Commit

Inherits:
Object show all
Includes:
DataMapper::Resource
Defined in:
lib/integrity/commit.rb

Instance Method Summary collapse

Instance Method Details

#authorObject



23
24
25
26
# File 'lib/integrity/commit.rb', line 23

def author
  attribute_get(:author) ||
    Author.load('<Commit author not loaded> <<Commit author not loaded>>', :author)
end

#failed?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/integrity/commit.rb', line 40

def failed?
  status == :failed
end

#human_readable_statusObject



48
49
50
51
52
53
54
# File 'lib/integrity/commit.rb', line 48

def human_readable_status
  case status
  when :success; "Built #{short_identifier} successfully"
  when :failed;  "Built #{short_identifier} and failed"
  when :pending; "#{short_identifier} hasn't been built yet"
  end
end

#messageObject



19
20
21
# File 'lib/integrity/commit.rb', line 19

def message
  attribute_get(:message) || "<Commit message not loaded>"
end

#outputObject



56
57
58
# File 'lib/integrity/commit.rb', line 56

def output
  build && build.output
end

#pending?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/integrity/commit.rb', line 44

def pending?
  status == :pending
end

#short_identifierObject



28
29
30
# File 'lib/integrity/commit.rb', line 28

def short_identifier
  identifier.to_s[0..6]
end

#statusObject



32
33
34
# File 'lib/integrity/commit.rb', line 32

def status
  build.nil? ? :pending : build.status
end

#successful?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/integrity/commit.rb', line 36

def successful?
  status == :success
end