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 d141f0f Use File.join for pathname construction
d141f0f is described below
commit d141f0f9965232bb00dc1cd76cc7ae12fbcb645d
Author: Sebb <[email protected]>
AuthorDate: Sat Feb 13 23:22:39 2021 +0000
Use File.join for pathname construction
---
tools/collate_minutes.rb | 6 +++---
www/board/posted-reports.cgi | 4 +++-
www/fundraising/invoice.cgi | 4 ++--
www/incubator/graduated.cgi | 4 ++--
4 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/tools/collate_minutes.rb b/tools/collate_minutes.rb
index 2240f3d..151e040 100755
--- a/tools/collate_minutes.rb
+++ b/tools/collate_minutes.rb
@@ -30,7 +30,7 @@ Wunderbar.info "Starting #{__FILE__}"
# destination directory
SITE_MINUTES = ASF::Config.get(:board_minutes) ||
- File.expand_path('../../www/board/minutes', __FILE__)
+ File.expand_path(File.join('..', '..', 'www', 'board', 'minutes'), __FILE__)
# list of SVN resources needed
SVN_SITE_RECORDS_MINUTES = ASF::SVN['minutes']
@@ -256,7 +256,7 @@ end
agenda = {}
posted = Dir[MINUTES_PATH].sort
-unapproved = Dir["#{BOARD}/#{MINUTES_NAME}"].sort
+unapproved = Dir[File.join(BOARD, MINUTES_NAME)].sort
FileUtils.mkdir_p SITE_MINUTES
@@ -868,7 +868,7 @@ agenda.sort.each do |title, reports|
end
end
- dest = "#{SITE_MINUTES}/#{link[title]}"
+ dest = File.join(SITE_MINUTES, link[title])
unless File.exist?(dest) and remove_date(File.read(dest)) ==
remove_date(page)
Wunderbar.info "Writing #{link[title]}"
open(dest, 'w') {|file| file.write page}
diff --git a/www/board/posted-reports.cgi b/www/board/posted-reports.cgi
index dc908be..669e248 100755
--- a/www/board/posted-reports.cgi
+++ b/www/board/posted-reports.cgi
@@ -14,6 +14,8 @@ require 'mail'
# link to board private-arch
THREAD = 'https://lists.apache.org/thread.html/'
REPORT = '[REPORT]'
+MAIL_ROOT = '/srv/mail' # TODO: => Config item
+MAIL_BOARD = File.join(MAIL_ROOT, 'board')
# Get a list of emails on board@ that appear to be [REPORT]*
# only look at this month's and last month's mailboxes, and within those
@@ -24,7 +26,7 @@ def get_report_mails
cuttoff = Date.parse(previous + Date.today.strftime('%d')).to_time
# get a list of current board messages
- archive = Dir["/srv/mail/board/#{previous}/*",
"/srv/mail/board/#{current}/*"]
+ archive = Dir[File.join(MAIL_BOARD, previous, '*'), File.join(MAIL_BOARD,
current, '*')]
# select messages that have a subject line starting with [REPORT]
reports = []
diff --git a/www/fundraising/invoice.cgi b/www/fundraising/invoice.cgi
index 54c67f7..a3c27d5 100755
--- a/www/fundraising/invoice.cgi
+++ b/www/fundraising/invoice.cgi
@@ -102,7 +102,7 @@ _html do
_tbody do
Dir.chdir(HISTORY) do
Dir['*'].sort.reverse.each do |invoice|
- form = YAML.load_file("#{HISTORY}/#{invoice}")
+ form = YAML.load_file(File.join(HISTORY, invoice))
if form
_tr_ do
_td {_a invoice, href: invoice}
@@ -473,7 +473,7 @@ _html do
end
if @invoice_number =~ /\A\d+\z/
- File.open("#{HISTORY}/#{@invoice_number}", 'w') do |file|
+ File.open(File.join(HISTORY, @invoice_number), 'w') do |file|
file.write params.to_yaml
end
else
diff --git a/www/incubator/graduated.cgi b/www/incubator/graduated.cgi
index dc6657f..85b40c0 100755
--- a/www/incubator/graduated.cgi
+++ b/www/incubator/graduated.cgi
@@ -18,7 +18,7 @@ parents = {
}
source = '/srv/whimsy/www/board/minutes'
-index = File.read("#{source}/index.html")
+index = File.read(File.join(source, "index.html"))
csection = index[/<h2 id="committee">.*?<h2/m]
creports = csection.scan(/<a .*?<\/a>/)
@@ -87,7 +87,7 @@ _html do
name = committee[/>(.*?)</, 1]
href = committee[/href="(.*?)"/, 1]
href = 'Polygene.html' if href == 'Zest.html'
- page = File.read("#{source}/#{href}").
+ page = File.read(File.join(source, href)).
sub(/<footer.*<\/footer>/m, '')
next if name == 'Zest' # renamed to Polygene