Class: Integrity::ProjectBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/integrity/project_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(project) ⇒ ProjectBuilder

Returns a new instance of ProjectBuilder.



3
4
5
6
7
8
9
# File 'lib/integrity/project_builder.rb', line 3

def initialize(project)
  @project = project
  @uri = project.uri
  @build_script = project.command
  @branch = project.branch
  @scm = SCM.new(@uri, @branch, export_directory)
end

Instance Method Details

#build(commit) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/integrity/project_builder.rb', line 11

def build(commit)
  @commit = commit
  @build = commit.build
  @build.start!
  Integrity.log "Building #{commit.identifier} (#{@branch}) of #{@project.name} in #{export_directory} using #{@scm.name}"
  @scm.with_revision(commit.identifier) { run_build_script }
  @build
ensure
  @build.complete!
  @commit.update_attributes(@scm.info(commit.identifier))
  send_notifications
end

#delete_codeObject



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

def delete_code
  FileUtils.rm_r export_directory
rescue Errno::ENOENT
  nil
end