Class: Bob::Test::SvnRepo
Instance Attribute Summary collapse
#name, #path
Class Method Summary
collapse
Instance Method Summary
collapse
#add_commit, #add_failing_commit, #add_successful_commit, #head
Constructor Details
#initialize(name, base_dir = Bob.directory) ⇒ SvnRepo
Returns a new instance of SvnRepo.
12
13
14
15
16
17
|
# File 'lib/bob/test/scm/svn.rb', line 12
def initialize(name, base_dir=Bob.directory)
super
@path = File.join(base_dir, "svn-#{name}")
@remote = File.join(SvnRepo.server_root, name.to_s)
end
|
Instance Attribute Details
#remote ⇒ Object
Returns the value of attribute remote.
10
11
12
|
# File 'lib/bob/test/scm/svn.rb', line 10
def remote
@remote
end
|
Class Method Details
.server_root ⇒ Object
6
7
8
|
# File 'lib/bob/test/scm/svn.rb', line 6
def self.server_root
@root ||= File.join(Bob.directory, "svn")
end
|
Instance Method Details
#commits ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/bob/test/scm/svn.rb', line 35
def commits
Dir.chdir(path) do
doc = Hpricot::XML(`svn log --xml`)
(doc/:log/:logentry).inject([]) { |commits, commit|
commits << { :identifier => commit["revision"],
:message => commit.at("msg").inner_html,
:committed_at => Time.parse(commit.at("date").inner_html) }
}.reverse
end
end
|
#create ⇒ Object
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/bob/test/scm/svn.rb', line 19
def create
create_remote
run "svn checkout file://#{remote} #{path}"
add_commit("First commit") do
run "echo 'just a test repo' >> README"
add "README"
end
end
|
#destroy ⇒ Object
30
31
32
33
|
# File 'lib/bob/test/scm/svn.rb', line 30
def destroy
FileUtils.rm_r(remote) if File.directory?(remote)
super
end
|