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 3b5c323 Use library methods
3b5c323 is described below
commit 3b5c32337777cb5eb12b0c27cafa2187ee890f88
Author: Sebb <[email protected]>
AuthorDate: Thu Jul 2 21:02:54 2020 +0100
Use library methods
---
www/board/publish_minutes.cgi | 67 +++++++++++++++++-----------------------
www/secretary/workbench/tasks.rb | 5 +++
2 files changed, 33 insertions(+), 39 deletions(-)
diff --git a/www/board/publish_minutes.cgi b/www/board/publish_minutes.cgi
index 5a93d8b..57479de 100755
--- a/www/board/publish_minutes.cgi
+++ b/www/board/publish_minutes.cgi
@@ -95,50 +95,42 @@ _html do
_h2 'Commit the Minutes'
Dir.chdir MINUTES do
unless Dir.exist? year
- _.system "mkdir #{year}"
- _.system "svn add #{year}"
+ _.system ['mkdir', year]
+ ASF::SVN.svn_('add', year, _)
end
minutes_date = "board_minutes_#{date}.txt"
minutes_year = File.join(year, minutes_date)
if File.exist? minutes_year
_p "#{minutes_year} already exists", class: '_stderr'
else
- _.system "cp #{BOARD_PRIVATE}/#{minutes_date} #{year}"
- _.system "svn add #{minutes_year}"
+ _.system ['cp', File.join(BOARD_PRIVATE, minutes_date), year]
+ ASF::SVN.svn_('add', minutes_year, _)
_p
- _.system [
- 'svn', 'commit', '-m', message, year,
- ['--no-auth-cache', '--non-interactive'],
- (['--username', $USER, '--password', $PASSWORD] if $PASSWORD)
- ]
+ ASF::SVN.svn_('commit', year, _, {msg: message, user: $USER, password:
$PASSWORD})
File.unlink 'svn-commit.tmp' if File.exist? 'svn-commit.tmp'
- unless `svn st`.empty?
- _.system ['svn', 'status']
+ out,err = ASF::SVN.svn('status', MINUTES) # Need to use svn() here,
not svn_()
+ unless out.empty?
+ ASF::SVN.svn_('status', MINUTES, _)
raise "svn failure"
end
end
end
_h2 'Update the Calendar'
- Dir.chdir BOARD_SITE do
- if File.read(CALENDAR) == calendar
- _p "#{File.basename CALENDAR} already up to date", class: '_stderr'
- else
- File.open(CALENDAR, 'w') {|fh| fh.write calendar}
- _.system "svn diff #{File.basename CALENDAR}"
- _p
- _.system [
- 'svn', 'commit', '-m', message, File.basename(CALENDAR),
- ['--no-auth-cache', '--non-interactive'],
- (['--username', $USER, '--password', $PASSWORD] if $PASSWORD)
- ]
-
- unless `svn st`.empty?
- _.system ['svn', 'status']
- raise "svn failure"
- end
+ if File.read(CALENDAR) == calendar
+ _p "#{File.basename CALENDAR} already up to date", class: '_stderr'
+ else
+ File.open(CALENDAR, 'w') {|fh| fh.write calendar}
+ ASF::SVN.svn_('diff', CALENDAR)
+ _p
+ ASF::SVN.svn_('commit', CALENDAR, _, {msg: message, user: $USER,
password: $PASSWORD})
+
+ out, err = ASF::SVN.svn('status', BOARD_SITE) # Need to use svn() here,
not svn_()
+ unless out.empty?
+ ASF::SVN.svn_('status', BOARD_SITE, _)
+ raise "svn failure"
end
end
@@ -146,27 +138,24 @@ _html do
Dir.chdir BOARD_PRIVATE do
updated = false
- if File.exist? "#{minutes_date}"
- _.system "svn rm #{minutes_date}"
+ if File.exist? minutes_date
+ ASF::SVN.svn_('rm', minutes_date,_)
updated = true
end
agenda_date = "board_agenda_#{date}.txt"
if File.exist? agenda_date
- _.system "svn mv #{agenda_date} archived_agendas"
+ ASF::SVN.svn_('mv', [agenda_date, 'archived_agendas'], _)
updated = true
end
if updated
_p
- _.system [
- 'svn', 'commit', '-m', message,
- ['--no-auth-cache', '--non-interactive'],
- (['--username', $USER, '--password', $PASSWORD] if $PASSWORD)
- ]
-
- unless `svn st`.empty?
- _.system ['svn', 'status']
+ ASF::SVN.svn_('commit', BOARD_PRIVATE, _, {msg: message, user: $USER,
password: $PASSWORD})
+
+ out,err = ASF::SVN.svn('status', BOARD_PRIVATE) # Need to use svn()
here, not svn_()
+ unless out.empty?
+ ASF::SVN.svn_('status', BOARD_PRIVATE, _)
raise "svn failure"
end
else
diff --git a/www/secretary/workbench/tasks.rb b/www/secretary/workbench/tasks.rb
index 178c67a..ced5fb2 100644
--- a/www/secretary/workbench/tasks.rb
+++ b/www/secretary/workbench/tasks.rb
@@ -63,6 +63,11 @@ class Wunderbar::JsonBuilder
_.system! 'svn', *args
end
+ def svn!(command,path,options={})
+ options[:env] = env if env.password and %(checkout update
commit).include?(command)
+ ASF::SVN.svn_!(command,path,_,options)
+ end
+
def svnauth
[
'--non-interactive',