Class: Integrity::Commit

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

Instance Method Summary collapse

Instance Method Details

#authorObject



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

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

#committed_at=(time_with_timezone) ⇒ Object



61
62
63
64
65
66
# File 'lib/integrity/commit.rb', line 61

def committed_at=(time_with_timezone)
  unless time_with_timezone.respond_to?(:utc)
    time_with_timezone = Time.parse(time_with_timezone)
  end
  attribute_set(:committed_at, time_with_timezone.utc)
end

#failed?Boolean

Returns:

  • (Boolean)


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

def failed?
  status == :failed
end

#human_readable_statusObject



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

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



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

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

#outputObject



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

def output
  build && build.output
end

#pending?Boolean

Returns:

  • (Boolean)


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

def pending?
  status == :pending
end

#short_identifierObject



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

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

#statusObject



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

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

#successful?Boolean

Returns:

  • (Boolean)


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

def successful?
  status == :success
end