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 2021/02/13 16:55:24 UTC
[whimsy] branch master updated: Use File.join for pathname
construction
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 b23146e Use File.join for pathname construction
b23146e is described below
commit b23146e6bbac23123423a7b6c3f7641cd7661713
Author: Sebb <se...@apache.org>
AuthorDate: Sat Feb 13 16:55:16 2021 +0000
Use File.join for pathname construction
---
Rakefile | 14 ++++++++------
lib/spec/spec_helper.rb | 2 +-
lib/whimsy/asf/bundler.rb | 2 +-
lib/whimsy/asf/ldap.rb | 2 +-
tools/collate_minutes.rb | 2 +-
www/secretary/workbench/models/mailbox.rb | 8 ++++----
www/secretary/workbench/tasks.rb | 2 +-
www/secretary/workbench/views/index.json.rb | 4 ++--
8 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/Rakefile b/Rakefile
index 4cfc4f2..ac25e01 100644
--- a/Rakefile
+++ b/Rakefile
@@ -400,16 +400,18 @@ namespace :docker do
home = ENV['HOST_HOME']
if home and File.exist? home
%w(.gitconfig .ssh .subversion).each do |mount|
- if File.exist? "/root/#{mount}"
- if File.symlink? "/root/#{mount}"
- next if File.realpath("/root/#{mount}") == "#{home}/#{mount}"
- rm_f "/root/#{mount}"
+ root_mount = File.join("/root", mount)
+ home_mount = File.join(home, mount)
+ if File.exist? root_mount
+ if File.symlink? root_mount
+ next if File.realpath(root_mount) == home_mount
+ rm_f root_mount
else
- rm_rf "/root/#{mount}"
+ rm_rf root_mount
end
end
- symlink "#{home}/#{mount}", "/root/#{mount}"
+ symlink home_mount, root_mount
end
end
diff --git a/lib/spec/spec_helper.rb b/lib/spec/spec_helper.rb
index 689d4d1..4d89234 100644
--- a/lib/spec/spec_helper.rb
+++ b/lib/spec/spec_helper.rb
@@ -35,7 +35,7 @@ def set_cache(restore=nil) # ensure can access test version of iclas.txt
end
def set_svn(name)
- ASF::SVN[name] = File.expand_path("../test/svn/#{name}", __dir__)
+ ASF::SVN[name] = File.expand_path(File.join("..", "test", "svn", name), __dir__)
end
if TEST_DATA
diff --git a/lib/whimsy/asf/bundler.rb b/lib/whimsy/asf/bundler.rb
index d677015..b867608 100644
--- a/lib/whimsy/asf/bundler.rb
+++ b/lib/whimsy/asf/bundler.rb
@@ -14,7 +14,7 @@ module Bundler
path = nil
libs.each do |lib|
- if File.exist?("#{lib}/#{pname}")
+ if File.exist?(File.join(lib, pname))
path = lib
end
end
diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
index 512890b..240545c 100644
--- a/lib/whimsy/asf/ldap.rb
+++ b/lib/whimsy/asf/ldap.rb
@@ -927,7 +927,7 @@ module ASF
# defaults
attrs['loginShell'] ||= '/usr/local/bin/bash'
- attrs['homeDirectory'] ||= "/home/#{availid}"
+ attrs['homeDirectory'] ||= File.join("/home", availid)
attrs['host'] ||= "home.apache.org"
attrs['asf-sascore'] ||= "10"
diff --git a/tools/collate_minutes.rb b/tools/collate_minutes.rb
index 075e9a3..2240f3d 100755
--- a/tools/collate_minutes.rb
+++ b/tools/collate_minutes.rb
@@ -51,7 +51,7 @@ YYYYMMDD = ARGV.shift || '20*' # Allow override of minutes to process
TIME_DIFF = (ARGV.shift || '300').to_i # Allow override of seconds of time diff (WHIMSY-204) for testing
MINUTES_NAME = "board_minutes_#{YYYYMMDD}.txt"
-MINUTES_PATH = "#{SVN_SITE_RECORDS_MINUTES}/*/#{MINUTES_NAME}"
+MINUTES_PATH = File.join(SVN_SITE_RECORDS_MINUTES, "*", MINUTES_NAME)
Wunderbar.info "Processing minutes matching #{MINUTES_NAME}"
diff --git a/www/secretary/workbench/models/mailbox.rb b/www/secretary/workbench/models/mailbox.rb
index 8171bfc..40b3a8d 100644
--- a/www/secretary/workbench/models/mailbox.rb
+++ b/www/secretary/workbench/models/mailbox.rb
@@ -41,10 +41,10 @@ class Mailbox
if name =~ /^\d+$/
@name = name
- @mbox = Dir["#{ARCHIVE}/#{@name}", "#{ARCHIVE}/#{@name}.gz"].first
+ @mbox = Dir[File.join(ARCHIVE, @name), File.join(ARCHIVE, "#{@name}.gz")].first
else
@name = name.split('.').first
- @mbox = "#{ARCHIVE}/#{name}"
+ @mbox = File.join ARCHIVE, name
end
end
@@ -142,14 +142,14 @@ class Mailbox
# name of associated yaml file
#
def yaml_file
- "#{ARCHIVE}/#{@name}.yml"
+ File.join ARCHIVE," #{@name}.yml"
end
#
# name of associated directory
#
def dir
- "#{ARCHIVE}/#{@name}.mail"
+ File.join ARCHIVE," #{@name}.mail"
end
#
diff --git a/www/secretary/workbench/tasks.rb b/www/secretary/workbench/tasks.rb
index 13ad57a..3b3e18e 100644
--- a/www/secretary/workbench/tasks.rb
+++ b/www/secretary/workbench/tasks.rb
@@ -146,7 +146,7 @@ class Wunderbar::JsonBuilder
end
def template(name)
- path = File.expand_path("../templates/#{name}", __FILE__)
+ path = File.expand_path(File.join("..", "templates", name), __FILE__)
ERB.new(File.read(path)).result(binding)
end
end
diff --git a/www/secretary/workbench/views/index.json.rb b/www/secretary/workbench/views/index.json.rb
index 42ed3c9..4902e9b 100644
--- a/www/secretary/workbench/views/index.json.rb
+++ b/www/secretary/workbench/views/index.json.rb
@@ -1,7 +1,7 @@
# find indicated mailbox in the list of available mailboxes
# This code is invoked by workbench/server.rb
-available = Dir["#{ARCHIVE}/*.yml"].sort
-index = available.find_index "#{ARCHIVE}/#{@mbox}.yml"
+available = Dir[File.join(ARCHIVE, "*.yml")].sort
+index = available.find_index File.join(ARCHIVE, "#{@mbox}.yml")
# if found, process it
if index