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/06/12 23:20:34 UTC

[whimsy] branch master updated: Eliminate unnecessary chdirs

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 e6bf679  Eliminate unnecessary chdirs
e6bf679 is described below

commit e6bf67984c2c465386149760e3e154f9484b101c
Author: Sebb <se...@apache.org>
AuthorDate: Sat Jun 13 00:20:26 2020 +0100

    Eliminate unnecessary chdirs
---
 www/board/agenda/routes.rb                                     | 10 ++++------
 www/board/agenda/views/actions/publish.json.rb                 |  5 +++--
 .../workbench/views/actions/rotate-attachment.json.rb          |  4 +---
 3 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/www/board/agenda/routes.rb b/www/board/agenda/routes.rb
index c209e40..98bf5c0 100755
--- a/www/board/agenda/routes.rb
+++ b/www/board/agenda/routes.rb
@@ -499,12 +499,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/publish.json.rb b/www/board/agenda/views/actions/publish.json.rb
index 2b31e8b..841766d 100755
--- a/www/board/agenda/views/actions/publish.json.rb
+++ b/www/board/agenda/views/actions/publish.json.rb
@@ -12,7 +12,8 @@ CALENDAR = File.join(BOARD_SITE, 'calendar.mdtext')
 
 # update from svn
 [MINUTES, BOARD_SITE, BOARD_PRIVATE].each do |dir| 
-  Dir.chdir(dir) {`svn cleanup`; `svn up`}
+  ASF::SVN.svn('cleanup', dir)
+  ASF::SVN.svn('update', dir) # TODO does this need auth?
 end
 
 calendar = File.read(CALENDAR)
@@ -85,4 +86,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
diff --git a/www/secretary/workbench/views/actions/rotate-attachment.json.rb b/www/secretary/workbench/views/actions/rotate-attachment.json.rb
index d1189b1..48f04bc 100644
--- a/www/secretary/workbench/views/actions/rotate-attachment.json.rb
+++ b/www/secretary/workbench/views/actions/rotate-attachment.json.rb
@@ -13,9 +13,7 @@ begin
 
   raise "Invalid direction #{@direction}" unless tool
 
-  Dir.chdir File.dirname(selected.path) do
-    Kernel.system tool, '--quiet', '--suffix', 'rotated', selected.path
-  end
+  Kernel.system tool, '--quiet', '--suffix', 'rotated', selected.path, chdir: File.dirname(selected.path)
 
   output = selected.path.sub(/\.pdf$/, '-rotated.pdf')