Class: Integrity::Build

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

Instance Method Summary collapse

Instance Method Details

#commit_authorObject



33
34
35
36
37
38
# File 'lib/integrity/build.rb', line 33

def commit_author
  @author ||= begin
    [:author] =~ /^(.*) <(.*)>$/
    OpenStruct.new(:name => $1.strip, :email => $2.strip, :full => [:author])
  end
end

#commit_messageObject



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

def commit_message
  [:message]
end

#commited_atObject



44
45
46
47
48
49
# File 'lib/integrity/build.rb', line 44

def commited_at
  case [:date]
    when String then Time.parse([:date])
    else [:date]
  end
end

#failed?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/integrity/build.rb', line 17

def failed?
  !successful?
end

#human_readable_statusObject



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

def human_readable_status
  successful? ? 'Build Successful' : 'Build Failed'
end

#short_commit_identifierObject



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

def short_commit_identifier
  sha1?(commit_identifier) ? commit_identifier[0..6] : commit_identifier
end

#statusObject



21
22
23
# File 'lib/integrity/build.rb', line 21

def status
  successful? ? :success : :failed
end