Commit 31a54bdac65e2cc5ed188a3ebe52cee416424256

New Piston::Repository#exists? to determine if the repository is accessible.

git-svn-id: svn+ssh://rubyforge.org/var/svn/piston/trunk@117 d6c2ea82-c31b-0410-8381-e9c44f9824c5

Commit diff

lib/piston/repository.rb

 
3434 end
3535 end
3636
37 def exist?
38 case self.info
39 when Hash
40 !!self.info["Repository UUID"]
41 else
42 false
43 end
44 end
45
46 alias_method :exists?, :exist?
47
3748 def local_path
3849 @url.to_s["file://".length .. -1]
3950 end
toggle raw diff

spec/repository_spec.rb

 
1414 it "should NOT raise an error if the URL is a URI object" do
1515 Piston::Repository.new(URI.parse("http://svn.repository.org/repos"))
1616 end
17
18 it "should report it does not exist when used on a repository which does not exist" do
19 Piston::Repository.new("file:///path/to/some/repos").should_not exist
20 end
21
22 it "should report it exists when used on a repository which was created" do
23 @repos = Piston::Repository.new("file://#{File.expand_path(File.dirname(__FILE__))}/tmp/repos")
24 @repos.create!
25 @repos.should exist
26 end
1727end
1828
1929describe Piston::Repository, "with a file:/// URL" do
toggle raw diff