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:
Do the right thing:  Piston::Svn::WorkingCopy remembers using YAML files.
francois (author)
Sun Mar 16 19:38:57 -0700 2008
commit  f6b01d6b0ecccb76bdc97a7cbfc88304de652b0d
tree    66146ab45d4db183de5f060b8d02741281b2f41b
parent  e6735081897e3e2a0033508ad0eb74bf44c9293b
...
46
47
48
49
50
 
 
51
52
53
...
46
47
48
 
 
49
50
51
52
53
0
@@ -46,8 +46,8 @@
0
       end
0
 
0
       def remember(values)
0
- values.each_pair do |k, v|
0
- svn(:propset, k, v, path)
0
+ File.open(path + ".piston.yml", "wb") do |f|
0
+ f.write({"format" => 1, "handler" => values}.to_yaml)
0
         end
0
       end
0
 
...
3
4
5
 
6
7
8
9
...
12
13
14
15
16
17
18
19
 
 
 
20
21
22
23
24
25
26
27
 
 
 
 
 
28
29
...
3
4
5
6
7
8
9
10
...
13
14
15
 
 
 
 
 
16
17
18
19
20
 
 
 
 
 
 
21
22
23
24
25
26
27
0
@@ -3,6 +3,7 @@
0
 class TestSvnWorkingCopyRememberance < Test::Unit::TestCase
0
   def setup
0
     @wcdir = Pathname.new("tmp/wc")
0
+ @wcdir.mkpath
0
     @wc = Piston::Svn::WorkingCopy.new(@wcdir)
0
     @wc.stubs(:svn)
0
     @wc.stubs(:svn).with(:info, anything).returns("a:b")
0
0
@@ -12,19 +13,16 @@
0
     @wcdir.rmtree rescue nil
0
   end
0
 
0
- def test_remembers_hash_pairs_as_svn_propvalues
0
- values = {"piston:a" => "a", "piston:b" => "b"}
0
- @wc.expects(:svn).with(:propset, "piston:a", "a", @wcdir)
0
- @wc.expects(:svn).with(:propset, "piston:b", "b", @wcdir)
0
- @wc.remember(values)
0
+ def test_creates_dot_piston_dot_yml_file
0
+ @wc.remember("a" => "b")
0
+ assert((@wcdir + ".piston.yml").exist?)
0
   end
0
 
0
- def test_recalls_keys_as_svn_propvalues
0
- keys = %w(piston:a piston:b)
0
- @wc.expects(:svn).with(:propget, "piston:a", @wcdir).returns("a")
0
- @wc.expects(:svn).with(:propget, "piston:b", @wcdir).returns("b")
0
- values = {"piston:a" => "a", "piston:b" => "b"}
0
- assert_equal values, @wc.recall(keys)
0
+ def test_writes_values_as_yaml_under_handler_key
0
+ expected = {"a" => "b"}
0
+ @wc.remember(expected)
0
+ actual = YAML.load((@wcdir + ".piston.yml").read)
0
+ assert_equal expected, actual["handler"]
0
   end
0
 end

Comments

    No one has commented yet.