Class: Bob::Test::BuildableStub

Inherits:
Object
  • Object
show all
Includes:
Buildable
Defined in:
lib/bob/test/buildable_stub.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Buildable

#build, #start_building

Constructor Details

#initialize(scm, uri, branch, commit, build_script) ⇒ BuildableStub

Returns a new instance of BuildableStub.



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/bob/test/buildable_stub.rb', line 24

def initialize(scm, uri, branch, commit, build_script)
  @scm = scm.to_s
  @uri = uri.to_s
  @branch = branch
  @commit = commit
  @build_script = build_script

  @status = nil
  @output = ""
  @commit_info = {}
end

Instance Attribute Details

#branchObject (readonly)

Returns the value of attribute branch.



21
22
23
# File 'lib/bob/test/buildable_stub.rb', line 21

def branch
  @branch
end

#build_scriptObject (readonly)

Returns the value of attribute build_script.



21
22
23
# File 'lib/bob/test/buildable_stub.rb', line 21

def build_script
  @build_script
end

#commitObject (readonly)

Returns the value of attribute commit.



21
22
23
# File 'lib/bob/test/buildable_stub.rb', line 21

def commit
  @commit
end

#commit_infoObject (readonly)

Returns the value of attribute commit_info.



21
22
23
# File 'lib/bob/test/buildable_stub.rb', line 21

def commit_info
  @commit_info
end

#outputObject (readonly)

Returns the value of attribute output.



21
22
23
# File 'lib/bob/test/buildable_stub.rb', line 21

def output
  @output
end

#repoObject (readonly)

Returns the value of attribute repo.



21
22
23
# File 'lib/bob/test/buildable_stub.rb', line 21

def repo
  @repo
end

#scmObject (readonly)

Returns the value of attribute scm.



21
22
23
# File 'lib/bob/test/buildable_stub.rb', line 21

def scm
  @scm
end

#statusObject (readonly)

Returns the value of attribute status.



21
22
23
# File 'lib/bob/test/buildable_stub.rb', line 21

def status
  @status
end

#uriObject (readonly)

Returns the value of attribute uri.



21
22
23
# File 'lib/bob/test/buildable_stub.rb', line 21

def uri
  @uri
end

Class Method Details

.for(repo, commit) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/bob/test/buildable_stub.rb', line 6

def self.for(repo, commit)
  scm = (Bob::Test::GitRepo === repo) ? "git" : "svn"
  uri =
    if scm == "git"
      repo.path
    else
      "file://#{SvnRepo.server_root}/#{repo.name}"
    end
  # TODO: move onto repo object?
  branch = (scm == "git") ? "master" : ""
  build_script = "./test"

  new(scm, uri, branch, commit, build_script)
end

Instance Method Details

#finish_building(commit_info, status, output) ⇒ Object



36
37
38
39
40
# File 'lib/bob/test/buildable_stub.rb', line 36

def finish_building(commit_info, status, output)
  @commit_info = commit_info
  @status = status ? :successful : :failed
  @output = output
end