Class: Bob::Test::BuildableStub

Inherits:
Struct
  • 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

Constructor Details

#initialize(*args) ⇒ BuildableStub

Returns a new instance of BuildableStub.



22
23
24
25
26
27
# File 'lib/bob/test/buildable_stub.rb', line 22

def initialize(*args)
  super

  @builds   = {}
  @metadata = {}
end

Instance Attribute Details

#branchObject

Returns the value of attribute branch

Returns:

  • (Object)

    the current value of branch



2
3
4
# File 'lib/bob/test/buildable_stub.rb', line 2

def branch
  @branch
end

#build_scriptObject

Returns the value of attribute build_script

Returns:

  • (Object)

    the current value of build_script



2
3
4
# File 'lib/bob/test/buildable_stub.rb', line 2

def build_script
  @build_script
end

#buildsObject (readonly)

Returns the value of attribute builds.



5
6
7
# File 'lib/bob/test/buildable_stub.rb', line 5

def builds
  @builds
end

#metadataObject (readonly)

Returns the value of attribute metadata.



5
6
7
# File 'lib/bob/test/buildable_stub.rb', line 5

def 
  @metadata
end

#repoObject (readonly)

Returns the value of attribute repo.



5
6
7
# File 'lib/bob/test/buildable_stub.rb', line 5

def repo
  @repo
end

#scmObject

Returns the value of attribute scm

Returns:

  • (Object)

    the current value of scm



2
3
4
# File 'lib/bob/test/buildable_stub.rb', line 2

def scm
  @scm
end

#uriObject

Returns the value of attribute uri

Returns:

  • (Object)

    the current value of uri



2
3
4
# File 'lib/bob/test/buildable_stub.rb', line 2

def uri
  @uri
end

Class Method Details

.call(repo) ⇒ Object



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

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

  new(scm, uri, branch, build_script)
end

Instance Method Details

#finish_building(commit_id, status, output) ⇒ Object



33
34
35
# File 'lib/bob/test/buildable_stub.rb', line 33

def finish_building(commit_id, status, output)
  @builds[commit_id] = [status ? :successful : :failed, output]
end

#start_building(commit_id, commit_info) ⇒ Object



29
30
31
# File 'lib/bob/test/buildable_stub.rb', line 29

def start_building(commit_id, commit_info)
  @metadata[commit_id] = commit_info
end