Class: Bob::Test::SvnRepo
Instance Method Summary
collapse
#add_commit, #add_failing_commit, #add_successful_commit, #command, #head, #script, #short_head
Constructor Details
#initialize(name = "test_repo") ⇒ SvnRepo
Returns a new instance of SvnRepo.
108
109
110
111
112
113
114
|
# File 'lib/bob/test/repo.rb', line 108
def initialize(name = "test_repo")
super
server = @path.join("..", "svn-server")
server.mkdir
@remote = server.join(@path.basename)
end
|
Instance Method Details
#add(file) ⇒ Object
133
134
135
|
# File 'lib/bob/test/repo.rb', line 133
def add(file)
`svn add #{file}`
end
|
#branch ⇒ Object
120
121
122
|
# File 'lib/bob/test/repo.rb', line 120
def branch
""
end
|
#commit(msg) ⇒ Object
128
129
130
131
|
# File 'lib/bob/test/repo.rb', line 128
def commit(msg)
`svn commit -m "#{msg}"`
`svn up`
end
|
#commits ⇒ Object
TODO get rid of the Hpricot dependency
152
153
154
155
156
157
158
159
160
161
|
# File 'lib/bob/test/repo.rb', line 152
def commits
Dir.chdir(@path) do
doc = Hpricot::XML(`svn log --xml`)
(doc/:log/:logentry).inject([]) { |acc, c|
acc << { "id" => c["revision"],
"message" => c.at("msg").inner_html,
"timestamp" => Time.parse(c.at("date").inner_html) }
}.reverse
end
end
|
#create ⇒ Object
137
138
139
140
141
142
143
144
145
146
147
148
149
|
# File 'lib/bob/test/repo.rb', line 137
def create
`svnadmin create #{@remote}`
@remote.join("conf", "svnserve.conf").open("w") { |f|
f.puts "[general]"
f.puts "anon-access = write"
f.puts "auth-access = write"
}
`svn checkout file://#{@remote} #{@path}`
super
end
|
#scm ⇒ Object
124
125
126
|
# File 'lib/bob/test/repo.rb', line 124
def scm
"svn"
end
|
#uri ⇒ Object
116
117
118
|
# File 'lib/bob/test/repo.rb', line 116
def uri
"file://#{@remote}"
end
|