public
Fork of francois/piston
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/tapajos/piston.git
Replaced usages of YAML#load(File#read) with YAML#load_file
francois (author)
Mon Aug 25 06:42:07 -0700 2008
commit  e7c5fc6897c532a1e4b7a41d204938667183054b
tree    e62be4ec67b98fbcfe6b10ea44664a37e28979ba
parent  f477cccabaecb051ba13121d03ac9ce13132d059
...
15
16
17
18
 
19
20
21
...
15
16
17
 
18
19
20
21
0
@@ -15,7 +15,7 @@ RUBYFORGE_USERNAME = "unknown"
0
 def rubyforge_username
0
   unless @config
0
     begin
0
- @config = YAML.load(File.read(File.expand_path(@config_file)))
0
+ @config = YAML.load_file(File.expand_path(@config_file))
0
     rescue
0
       puts <<-EOS
0
 ERROR: No rubyforge config file found: #{@config_file}
...
107
108
109
110
 
111
112
113
...
107
108
109
 
110
111
112
113
0
@@ -107,7 +107,7 @@ module Piston
0
 
0
     # Recalls a Hash of values from the working copy.
0
     def recall
0
- YAML.load(File.read(yaml_path))
0
+ YAML.load_file(yaml_path)
0
     end
0
 
0
     def finalize
...
38
39
40
41
 
42
43
44
...
38
39
40
 
41
42
43
44
0
@@ -38,7 +38,7 @@ class TestGitGit < PistonTestCase
0
       assert_equal IMPORT_STATUS.split("\n").sort, git(:status).split("\n").sort
0
     end
0
 
0
- info = YAML.load(File.read(wc_path + "vendor/parent/.piston.yml"))
0
+ info = YAML.load_file(wc_path + "vendor/parent/.piston.yml")
0
     assert_equal 1, info["format"]
0
     assert_equal parent_path.to_s, info["repository_url"]
0
     assert_equal "Piston::Git::Repository", info["repository_class"]
...
34
35
36
37
 
38
39
40
...
34
35
36
 
37
38
39
40
0
@@ -34,7 +34,7 @@ class TestGitSvn < PistonTestCase
0
 
0
     assert_equal ADD_STATUS.split("\n").sort, svn(:status, wc_path + "trunk/vendor").gsub((wc_path + "trunk/").to_s, "").split("\n").sort
0
 
0
- info = YAML.load(File.read(wc_path + "trunk/vendor/parent/.piston.yml"))
0
+ info = YAML.load_file(wc_path + "trunk/vendor/parent/.piston.yml")
0
     assert_equal 1, info["format"]
0
     assert_equal parent_path.to_s, info["repository_url"]
0
     assert_equal "Piston::Git::Repository", info["repository_class"]
...
36
37
38
39
 
40
41
42
...
36
37
38
 
39
40
41
42
0
@@ -36,7 +36,7 @@ class TestImportSvnGit < PistonTestCase
0
 ).split("\n").sort, git(:status).split("\n").sort
0
     end
0
 
0
- info = YAML.load(File.read(wc_path + "vendor/ssl_requirement/.piston.yml"))
0
+ info = YAML.load_file(wc_path + "vendor/ssl_requirement/.piston.yml")
0
     assert_equal 1, info["format"]
0
     assert_equal "http://dev.rubyonrails.org/svn/rails/plugins/ssl_requirement/", info["repository_url"]
0
     assert_equal "Piston::Svn::Repository", info["repository_class"]
...
27
28
29
30
 
31
32
33
...
27
28
29
 
30
31
32
33
0
@@ -27,7 +27,7 @@ A vendor/ssl_requirement/.piston.yml
0
 A vendor/ssl_requirement/README
0
 ".split("\n").sort, svn(:status, wc_path + "trunk/vendor/").gsub((wc_path + "trunk/").to_s, "").split("\n").sort
0
 
0
- info = YAML.load(File.read(wc_path + "trunk/vendor/ssl_requirement/.piston.yml"))
0
+ info = YAML.load_file(wc_path + "trunk/vendor/ssl_requirement/.piston.yml")
0
     assert_equal 1, info["format"]
0
     assert_equal "http://dev.rubyonrails.org/svn/rails/plugins/ssl_requirement/", info["repository_url"]
0
     assert_equal "Piston::Svn::Repository", info["repository_class"]
...
15
16
17
18
 
19
20
21
...
30
31
32
33
 
34
35
36
37
38
39
40
 
41
42
43
...
15
16
17
 
18
19
20
21
...
30
31
32
 
33
34
35
36
37
38
 
 
39
40
41
42
0
@@ -15,7 +15,7 @@ class TestWorkingCopyRememberance < PistonTestCase
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
+ actual = YAML.load_file(@wcdir + ".piston.yml")
0
     assert_equal expected, actual["handler"]
0
   end
0
 
0
@@ -30,14 +30,13 @@ class TestWorkingCopyRememberance < PistonTestCase
0
 
0
     @wc.remember(values, handler_values)
0
 
0
- actual = YAML.load((@wcdir + ".piston.yml").read)
0
+ actual = YAML.load_file(@wcdir + ".piston.yml")
0
     assert_equal values.merge("format" => 1, "handler" => handler_values), actual
0
   end
0
 
0
   def test_recall_returns_hash_of_values
0
     values = {"a" => "b", "handler" => {"b" => "c"}}
0
- File.expects(:read).with(@wcdir + ".piston.yml").returns(:data)
0
- YAML.expects(:load).with(:data).returns(values)
0
+ YAML.expects(:load_file).with(@wcdir + ".piston.yml").returns(values)
0
     assert_equal values, @wc.recall
0
   end
0
 end

Comments

    No one has commented yet.