public
Description: Piston is a utility that eases vendor branch management. This repository is a complete reimplementation of Piston to provide different backends, depending on the repositories and working copies you pistonize from.
Homepage: http://piston.rubyforge.org/
Clone URL: git://github.com/francois/piston.git
Search Repo:
Adding repository tests.
tapajos (author)
Thu May 08 16:58:19 -0700 2008
francois (committer)
Fri May 09 08:25:33 -0700 2008
commit  b19eef6e2bc92fd0af1c3470d6af92a57b98be43
tree    090639b11ddbf5ce7d03584697e66324a28af4a1
parent  5860292c1222e43e7291f0aa233d7b17e42d6808
...
11
12
13
14
 
15
16
17
...
49
50
51
 
 
 
 
52
53
54
...
11
12
13
 
14
15
16
17
...
49
50
51
52
53
54
55
56
57
58
0
@@ -11,7 +11,7 @@
0
 
0
       def guess(url)
0
         logger.info {"Guessing the repository type of #{url.inspect}"}
0
-
0
+
0
         handler = handlers.detect do |handler|
0
           logger.debug {"Asking #{handler}"}
0
           handler.understands_url?(url)
0
@@ -49,6 +49,10 @@
0
 
0
     def to_s
0
       "Piston::Repository(#{@url})"
0
+ end
0
+
0
+ def ==(other)
0
+ url == other.url
0
     end
0
   end
0
 end
...
13
14
15
 
 
 
 
16
17
18
...
13
14
15
16
17
18
19
20
21
22
0
@@ -13,6 +13,10 @@
0
     def initialize(repository, revision)
0
       @repository, @revision = repository, revision
0
     end
0
+
0
+ def ==(other)
0
+ revision == other.revision && repository == other.repository
0
+ end
0
 
0
     def name
0
       @revision
...
48
49
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
0
@@ -48,4 +48,23 @@
0
 Log4r::Logger["main"].add "log"
0
 Log4r::Logger["handler"].add "log"
0
 Log4r::Logger["test"].add "log"
0
+
0
+def turn_methods_public(classe, method_name = nil)
0
+ if method_name
0
+ classe.class_eval do
0
+ public method_name
0
+ end
0
+ else
0
+ turn_all_methods_public classe
0
+ end
0
+end
0
+
0
+def turn_all_methods_public(classe)
0
+ classe.class_eval do
0
+ private_instance_methods.each { |instance_method| public instance_method }
0
+ private_methods.each { |method| public_class_method method }
0
+ protected_instance_methods.each { |instance_method| public instance_method }
0
+ protected_methods.each { |method| public_class_method method }
0
+ end
0
+end
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
0
@@ -1 +1,51 @@
0
+require File.dirname(__FILE__) + "/../test_helper"
0
+
0
+class TestRepository < Test::Unit::TestCase
0
+
0
+ def setup
0
+ turn_all_methods_public(Piston::Repository)
0
+ Piston::Repository.class_variable_set(:@@handlers, [Piston::Git::Repository, Piston::Svn::Repository])
0
+ @repository = Piston::Repository.new("url")
0
+ end
0
+
0
+ def test_if_guess_return_GIT_repository_when_url_is_git_repository
0
+ assert_equal Piston::Git::Repository.new("git://github.com/francois/piston.git"), Piston::Repository.guess("git://github.com/francois/piston.git")
0
+ end
0
+
0
+ def test_if_guess_return_SVN_repository_when_url_is_svn_repository
0
+ assert_equal Piston::Svn::Repository.new("svn://svn.com/francois/piston.git"), Piston::Repository.guess("svn://svn.com/francois/piston.git")
0
+ end
0
+
0
+ def test_guess_when_unhandled_url
0
+ assert_raise(Piston::Repository::UnhandledUrl) { Piston::Repository.guess("invalid") }
0
+ end
0
+
0
+ def test_handlers
0
+ assert_equal [Piston::Git::Repository, Piston::Svn::Repository], Piston::Repository.handlers
0
+ end
0
+
0
+ def test_add_handler
0
+ before_add = Piston::Repository.class_variable_get(:@@handlers)
0
+ after_add = before_add << Piston::Git::Repository
0
+ Piston::Repository.add_handler(Piston::Git::Repository)
0
+ assert_equal after_add, Piston::Repository.class_variable_get(:@@handlers)
0
+ end
0
+
0
+ def test_initialize
0
+ assert_equal "url", @repository.instance_variable_get(:@url)
0
+ end
0
+
0
+ def test_url
0
+ assert_equal "url", @repository.url
0
+ end
0
+
0
+ def test_at
0
+ assert_equal Piston::Revision.new(@repository, "2"), @repository.at("2")
0
+ end
0
+
0
+ def test_to_s
0
+ assert_equal "Piston::Repository(url)", @repository.to_s
0
+ end
0
+
0
+end

Comments

    No one has commented yet.