You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2020/07/16 14:09:51 UTC
[whimsy] branch master updated: Generate svn path for arbitrary
file name
This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new 39268a0 Generate svn path for arbitrary file name
39268a0 is described below
commit 39268a08b5790b6b7e3a2ebb0efafbb407cb208f
Author: Sebb <se...@apache.org>
AuthorDate: Thu Jul 16 15:09:41 2020 +0100
Generate svn path for arbitrary file name
---
lib/spec/lib/documents_spec.rb | 22 ++++++++++++++++++++++
lib/whimsy/asf/documents.rb | 7 ++++++-
2 files changed, 28 insertions(+), 1 deletion(-)
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 @@ describe ASF::EmeritusFiles do
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 @@ describe ASF::EmeritusRescindedFiles do
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 @@ module ASF
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 @@ module ASF
path = file = nil
file = self.find(person)
if file
- path = ASF::SVN.svnpath!(@base, file)
+ path = self.svnpath!(file)
end
[path, file]
end