Generate svn path for arbitrary file name
diff --git a/lib/spec/lib/documents_spec.rb b/lib/spec/lib/documents_spec.rb
index 8688a10..95e4431 100644
--- a/lib/spec/lib/documents_spec.rb
+++ b/lib/spec/lib/documents_spec.rb
@@ -25,6 +25,17 @@
expect(res[0]).to end_with('/emeritus1.txt')
expect(res[1]).to eq('emeritus1.txt')
end
+ it "findpath Person.find('emeritus1') should return same path as path!(file) " do
+ res = ASF::EmeritusFiles.findpath(ASF::Person.find('emeritus1'))
+ expect(res).to be_kind_of(Array)
+ expect(res.size).to eq(2)
+ svnpath = res[0]
+ file = res[1]
+ expect(svnpath).to end_with('/emeritus1.txt')
+ expect(file).to eq('emeritus1.txt')
+ path = ASF::EmeritusFiles.svnpath!(file)
+ expect(path).to eq(svnpath)
+ end
end
describe ASF::EmeritusReinstatedFiles do
@@ -83,4 +94,15 @@
expect(res[0]).to end_with('/emeritus4.txt')
expect(res[1]).to eq('emeritus4.txt')
end
+ it "findpath Person.find('emeritus4') should return same path as path!(file) " do
+ res = ASF::EmeritusRescindedFiles.findpath(ASF::Person.find('emeritus4'))
+ expect(res).to be_kind_of(Array)
+ expect(res.size).to eq(2)
+ svnpath = res[0]
+ file = res[1]
+ expect(svnpath).to end_with('/emeritus4.txt')
+ expect(file).to eq('emeritus4.txt')
+ path = ASF::EmeritusRescindedFiles.svnpath!(file)
+ expect(path).to eq(svnpath)
+ end
end
diff --git a/lib/whimsy/asf/documents.rb b/lib/whimsy/asf/documents.rb
index 092fd1e..532bdf7 100644
--- a/lib/whimsy/asf/documents.rb
+++ b/lib/whimsy/asf/documents.rb
@@ -134,6 +134,11 @@
end
end
+ # return the svn path to an arbitrary file
+ def self.svnpath!(file)
+ ASF::SVN.svnpath!(@base, file)
+ end
+
# Find the svnpath to the file for a person
# Returns
# svnpath, filename
@@ -143,7 +148,7 @@
path = file = nil
file = self.find(person)
if file
- path = ASF::SVN.svnpath!(@base, file)
+ path = self.svnpath!(file)
end
[path, file]
end