Skip to content

Commit

Permalink
Workaround svn.update() limitation where it won't create a new blank …
Browse files Browse the repository at this point in the history
…file
  • Loading branch information
ShaneCurcuru committed Feb 1, 2025
1 parent 6ef800c commit fb2feb0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
19 changes: 1 addition & 18 deletions lib/whimsy/asf/member-files.rb
Original file line number Diff line number Diff line change
Expand Up @@ -219,29 +219,12 @@ def self.update_member_nominees(env, wunderbar, entries=nil, msg=nil, opt={})

# create a single director ballot statement (if not present)
# @param availid of director nominee
# @return string for transcript (blank if success; svn_ does it's own output)
def self.add_board_ballot(env, wunderbar, availid, msg=nil, opt={})
bdir = File.join(latest_meeting(), BOARD_BALLOT)
bfile = File.join(bdir, "#{availid}#{BOARD_BALLOT_EXT}")
ASF::SVN.update(bfile, msg || "Adding board_ballot template for #{$availid}", env, wunderbar, opt) do |_tmpdir, contents|
contents # Don't change existing contents
"#{contents} " # Merely add space to contents because blank files not suppored by svn.update()
end
# Dir.mktmpdir do |tmpdir|
# credentials = {user: $USER, password: $PASSWORD}.merge(opt)
# # TODO: investigate if we should to --depth empty and attempt to get only that mentor's file
# ASF::SVN.svn_('checkout', [File.join(latest_meeting(), BOARD_BALLOT), tmpdir], wunderbar, credentials)
# Dir.chdir tmpdir do
# if File.exist? fn
# # All we need to do is create a file if it doesn't already exist, so just skip
# return "Note: board_ballot/#{fn}, already exists, nothing to do!"
# else
# File.write('') # We create an empty file, if candidate accepts, they edit
# ASF::SVN.svn_('add', fn, wunderbar)
# ASF::SVN.svn_('commit', fn, wunderbar, {msg: "Adding board_ballot template for #{$availid}"}.merge(credentials))
# return
# end
# end
# end
end

# update the board nominees
Expand Down
5 changes: 1 addition & 4 deletions www/members/nominate_board.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,7 @@ def process_form(formdata: {}, wunderbar: {})
})

environ = Struct.new(:user, :password).new($USER, $PASSWORD)
_div.transcript do
tmp = ASF::MemberFiles.add_board_ballot(environ, wunderbar, "#{formdata['availid']}", "board_ballot/ += #{formdata['availid']}")
_ tmp unless tmp.empty?
end
ASF::MemberFiles.add_board_ballot(environ, wunderbar, "#{formdata['availid']}", "board_ballot/ += #{formdata['availid']}")
ASF::MemberFiles.update_board_nominees(environ, wunderbar, [entry], "+= #{formdata['availid']}")
return true
end
Expand Down

0 comments on commit fb2feb0

Please sign in to comment.