Class: Integrity::Build

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.pendingObject



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

def self.pending
  all(:started_at => nil)
end

.queue(commit) ⇒ Object



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

def self.queue(commit)
  commit.update_attributes(:build => new)

  # Build on foreground (this will move away, I promise)
  ProjectBuilder.build(commit)
end

Instance Method Details

#commit_authorObject



64
65
66
67
# File 'lib/integrity/build.rb', line 64

def commit_author
  warn "Build#commit_author is deprecated, use Commit#author (#{caller[0]})"
  commit.author
end

#commit_identifierObject



59
60
61
62
# File 'lib/integrity/build.rb', line 59

def commit_identifier
  warn "Build#commit_identifier is deprecated, use Commit#identifier (#{caller[0]})"
  commit.identifier
end

#commit_messageObject



69
70
71
72
# File 'lib/integrity/build.rb', line 69

def commit_message
  warn "Build#commit_message is deprecated, use Commit#message (#{caller[0]})"
  commit.message
end

#commit_metadataObject



84
85
86
87
88
89
# File 'lib/integrity/build.rb', line 84

def 
  warn "Build#commit_metadata is deprecated, use the different methods in Commit instead (#{caller[0]})"
  { :message => commit.message,
    :author  => commit.author,
    :date    => commit.committed_at }
end

#commited_atObject



74
75
76
77
# File 'lib/integrity/build.rb', line 74

def commited_at
  warn "Build#commited_at is deprecated, use Commit#committed_at (#{caller[0]})"
  commit.committed_at
end

#complete!(time = Time.now) ⇒ Object



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

def complete!(time=Time.now)
  self.completed_at = time
end

#failed?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/integrity/build.rb', line 31

def failed?
  !successful?
end

#pending?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/integrity/build.rb', line 27

def pending?
  started_at.nil?
end

#project_idObject



79
80
81
82
# File 'lib/integrity/build.rb', line 79

def project_id
  warn "Build#project_id is deprecated, use Commit#project_id (#{caller[0]})"
  commit.project_id
end

#short_commit_identifierObject

Deprecated methods



54
55
56
57
# File 'lib/integrity/build.rb', line 54

def short_commit_identifier
  warn "Build#short_commit_identifier is deprecated, use Commit#short_identifier (#{caller[0]})"
  commit.short_identifier
end

#start!(time = Time.now) ⇒ Object



43
44
45
# File 'lib/integrity/build.rb', line 43

def start!(time=Time.now)
  self.started_at = time
end

#statusObject



35
36
37
38
39
40
41
# File 'lib/integrity/build.rb', line 35

def status
  case
  when pending?    then :pending
  when successful? then :success
  when failed?     then :failed
  end
end