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/10/19 22:35:43 UTC
[whimsy] branch master updated: Simplify by using Dir base: instead
of chdir
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 1a06779 Simplify by using Dir base: instead of chdir
1a06779 is described below
commit 1a0677988dc82299e1a0c47a915d88cdbd7a6b92
Author: Sebb <se...@apache.org>
AuthorDate: Mon Oct 19 23:35:34 2020 +0100
Simplify by using Dir base: instead of chdir
---
www/board/agenda/routes.rb | 10 ++++------
www/board/agenda/views/actions/draft.json.rb | 4 +---
www/board/agenda/views/actions/publish.json.rb | 2 +-
3 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/www/board/agenda/routes.rb b/www/board/agenda/routes.rb
index 319fd32..f44297e 100755
--- a/www/board/agenda/routes.rb
+++ b/www/board/agenda/routes.rb
@@ -512,12 +512,10 @@ get '/text/draft/:file' do |file|
agenda.sub('_agenda_', '_minutes_').sub('.txt', '.yml')
_text do
- Dir.chdir(FOUNDATION_BOARD) do
- if Dir['board_agenda_*.txt'].include?(agenda)
- _ Minutes.draft(agenda, minutes)
- else
- halt 404
- end
+ if Dir['board_agenda_*.txt', base: FOUNDATION_BOARD].include?(agenda)
+ _ Minutes.draft(agenda, minutes)
+ else
+ halt 404
end
end
end
diff --git a/www/board/agenda/views/actions/draft.json.rb b/www/board/agenda/views/actions/draft.json.rb
index 7b855ba..95558dc 100644
--- a/www/board/agenda/views/actions/draft.json.rb
+++ b/www/board/agenda/views/actions/draft.json.rb
@@ -22,6 +22,4 @@ ASF::SVN.update minutes_file, @message, env, _ do |tmpdir, old_contents|
end
end
-drafts = Dir.chdir(FOUNDATION_BOARD) {Dir['board_minutes_*.txt'].sort}
-
-drafts
+Dir['board_minutes_*.txt', base: FOUNDATION_BOARD].sort
diff --git a/www/board/agenda/views/actions/publish.json.rb b/www/board/agenda/views/actions/publish.json.rb
index 3e42f42..73d8f6e 100755
--- a/www/board/agenda/views/actions/publish.json.rb
+++ b/www/board/agenda/views/actions/publish.json.rb
@@ -126,4 +126,4 @@ ASF::SVN.update BOARD_PRIVATE, @message, env, _ do |tmpdir|
end
end
-Dir.chdir(BOARD_PRIVATE) {Dir['board_minutes_*.txt'].sort}
+Dir['board_minutes_*.txt', base: BOARD_PRIVATE].sort