Skip to content

Commit

Permalink
Get rid of svnserve
Browse files Browse the repository at this point in the history
  • Loading branch information
sr committed Apr 17, 2009
1 parent 15edd92 commit 7db3d4c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 27 deletions.
7 changes: 0 additions & 7 deletions test/bob_svn_test.rb
Expand Up @@ -6,19 +6,12 @@ class BobSvnTest < Test::Unit::TestCase
def setup
super

SvnRepo.start_server

@repo = SvnRepo.new(:test_repo)
@repo.create

@buildable = SvnBuildableStub.new(@repo)
end

def teardown
sleep 0.5
SvnRepo.stop_server
end

test "with a successful build" do
@repo.add_successful_commit

Expand Down
2 changes: 1 addition & 1 deletion test/helper/buildable_stub.rb
Expand Up @@ -45,7 +45,7 @@ def kind
end

def uri
"svn://0.0.0.0:1234/#{repo.name}"
"file://#{SvnRepo.server_root}/#{repo.name}"
end

def branch
Expand Down
24 changes: 5 additions & 19 deletions test/helper/svn_helper.rb
Expand Up @@ -2,39 +2,23 @@

module TestHelper
class SvnRepo < AbstractSCMRepo
def self.pid_file
"/tmp/bob-svnserve.pid"
end

def self.server_root
@root ||= File.join(Bob.directory, "svnserver")
end

def self.start_server
FileUtils.mkdir_p(server_root) unless File.directory?(server_root)

`svnserve -d --pid-file #{pid_file} \
--listen-host=0.0.0.0 --listen-port=1234 -r#{server_root} &>/dev/null`
end

def self.stop_server
Process.kill("KILL", File.read(pid_file).chomp.to_i)
File.delete(pid_file)
@root ||= File.join(Bob.directory, "svn")
end

attr_reader :remote

def initialize(name, base_dir=Bob.directory)
super

@path = File.join(base_dir, "svn-#{@name}")
@path = File.join(base_dir, "svn-#{name}")
@remote = File.join(SvnRepo.server_root, name.to_s)
end

def create
create_remote

system "svn checkout svn://0.0.0.0:1234/#{name} #{path} &>/dev/null"
system "svn checkout file://#{remote} #{path} &>/dev/null"

add_commit("First commit") do
system "echo 'just a test repo' >> README"
Expand Down Expand Up @@ -70,6 +54,8 @@ def commit(message)

private
def create_remote
FileUtils.mkdir_p(SvnRepo.server_root)

system "svnadmin create #{remote} &>/dev/null"

File.open(File.join(remote, "conf", "svnserve.conf"), "w") { |f|
Expand Down

0 comments on commit 7db3d4c

Please sign in to comment.