[whimsy] branch master updated: Error message sometimes scrolls off top of screen

2018-07-06 Thread sebb
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 100a664  Error message sometimes scrolls off top of screen
100a664 is described below

commit 100a664cc45d1a8a970b332ee6716938d64c0232
Author: Sebb 
AuthorDate: Fri Jul 6 23:25:53 2018 +0100

Error message sometimes scrolls off top of screen
---
 www/project/icla/views/pages/form.js.rb | 25 +
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/www/project/icla/views/pages/form.js.rb 
b/www/project/icla/views/pages/form.js.rb
index 4298039..cf1d7ba 100644
--- a/www/project/icla/views/pages/form.js.rb
+++ b/www/project/icla/views/pages/form.js.rb
@@ -12,18 +12,11 @@ class Form < Vue
   end
 
   def render
-# error messages / welcome
-if @alert
-  _div.alert.alert_danger do
-_b 'Error: '
-_span @alert
-  end
-else
-  _p %{
-Thanks!  Now please take a moment to answer a few questions about
-yourself.
-  }
-end
+
+_p %{
+  Thanks!  Now please take a moment to answer a few questions about
+  yourself.
+}
 
 #
 # Form fields
@@ -66,6 +59,14 @@ class Form < Vue
   end
 end
 
+# needs to be near the button or it can scroll off the visible screen
+if @alert
+  _div.alert.alert_danger do
+_b 'Error: '
+_span @alert
+  end
+end
+
 #
 # Submit button
 #



[whimsy] branch master updated: Easier testing

2018-07-06 Thread sebb
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 2159746  Easier testing
2159746 is described below

commit 21597465ba7ef6ce0774970c6c5b91319ae7b1f7
Author: Sebb 
AuthorDate: Fri Jul 6 23:19:36 2018 +0100

Easier testing
---
 www/project/icla/views/app.js.rb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/www/project/icla/views/app.js.rb b/www/project/icla/views/app.js.rb
index ebccb65..7b73fd4 100644
--- a/www/project/icla/views/app.js.rb
+++ b/www/project/icla/views/app.js.rb
@@ -10,7 +10,8 @@ Server = {}
 FormData = {
   fullname: 'Joe Test',
   email: 'joet...@example.com',
-  pmc: 'incubator'
+  pmc: 'incubator',
+  votelink: 'dummy'
 }
 
 # "AJAX" style post request to the server, with a callback



[whimsy] branch master updated: Allow for multiple ids

2018-07-06 Thread sebb
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 4634b3f  Allow for multiple ids
4634b3f is described below

commit 4634b3f3391061fd0aa6149c95b4ca61b1a78111
Author: Sebb 
AuthorDate: Fri Jul 6 23:19:13 2018 +0100

Allow for multiple ids
---
 www/project/icla/views/actions/draft-icla.json.rb | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/www/project/icla/views/actions/draft-icla.json.rb 
b/www/project/icla/views/actions/draft-icla.json.rb
index 7cfe2cf..ab62d7f 100644
--- a/www/project/icla/views/actions/draft-icla.json.rb
+++ b/www/project/icla/views/actions/draft-icla.json.rb
@@ -19,10 +19,13 @@
 # ipadddr
 # draft
 
-if not @apacheid.empty? and ASF::Person.find(@apacheid).icla?
-  _error "Apache ID #{@apacheid} already in use"
-  _focus :apacheId
+if not @apacheid.empty?
+  inuse = @apacheid.split(/ +/).select{|id| ASF::Person.find(id).icla?}.join(' 
')
+  if inuse != ''
+_error "Apache ID(s) '#{inuse}' already in use"
+_focus :apacheId
   return
+  end
 end
 
 # capture (possibly forwarded) remote IP address



[whimsy] branch master updated: Allow for multiple ids

2018-07-06 Thread sebb
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 7ad65fa  Allow for multiple ids
7ad65fa is described below

commit 7ad65fa9841e10c530007d11d9b6bd0098a21695
Author: Sebb 
AuthorDate: Fri Jul 6 22:22:35 2018 +0100

Allow for multiple ids
---
 www/project/icla/views/pages/form.js.rb | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/www/project/icla/views/pages/form.js.rb 
b/www/project/icla/views/pages/form.js.rb
index 89a451c..4298039 100644
--- a/www/project/icla/views/pages/form.js.rb
+++ b/www/project/icla/views/pages/form.js.rb
@@ -32,6 +32,7 @@ class Form < Vue
 _div.form_group do
   _p 'Full Name:'
   _input.form_control.fullname! value: @fullName, required: true,
+placeholder: 'GivenName FamilyName',
 onChange: self.setFullName
 end
 
@@ -57,9 +58,11 @@ class Form < Vue
 
 if FormData.votelink
   _div.form_group do
-_p 'Preferred Apache Id (format: ^[a-z][-a-z0-9]{2,}$):'
+_p 'Preferred Apache Id:'
 _input.form_control.apacheId! value: @apacheId, 
-  pattern: "^[a-z][-a-z0-9]{2,}$"
+  placeholder: 'At least 3 lower-case alphanumeric, starting with 
alpha. Separate multiple choices with spaces.',
+  pattern: "^[a-z][a-z0-9]{2,}{1,}\s*(\s+[a-z][a-z0-9]{2,}{1,})*$"
+  # Single name, optional spaces after, followed by zero or more names 
with leading spaces
   end
 end
 



[whimsy] branch master updated: Hints

2018-07-06 Thread sebb
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 27047e9  Hints
27047e9 is described below

commit 27047e9f487a07a6fbdbee93290988f0e500516f
Author: Sebb 
AuthorDate: Fri Jul 6 22:10:04 2018 +0100

Hints
---
 www/project/icla/views/pages/interview.js.rb | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/www/project/icla/views/pages/interview.js.rb 
b/www/project/icla/views/pages/interview.js.rb
index 0e7d863..8d7bc8c 100644
--- a/www/project/icla/views/pages/interview.js.rb
+++ b/www/project/icla/views/pages/interview.js.rb
@@ -36,12 +36,14 @@ class Interview < Vue
 _div.form_group do
   _p 'Full Name:'
   _input.form_control.fullname! value: @fullName, required: true,
+placeholder: 'Enter the name you used previously',
 onChange: self.setFullName, disabled: @disablePersonalDetails
 end
 
 _div.form_group do
   _p 'Email Address:'
   _input.form_control.emailAddress! value: @emailAddress, required: true,
+placeholder: 'Enter the address you used previously',
 onChange: self.setEmailAddress, disabled: @disablePersonalDetails
 end
 



[whimsy] branch master updated: Use the PMC display name

2018-07-06 Thread sebb
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 ab7bfae  Use the PMC display name
ab7bfae is described below

commit ab7bfae19a59b24dd2b0e0b870c95df2ea114fc7
Author: Sebb 
AuthorDate: Fri Jul 6 22:07:24 2018 +0100

Use the PMC display name
---
 www/project/icla/views/actions/draft-icla.json.rb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/www/project/icla/views/actions/draft-icla.json.rb 
b/www/project/icla/views/actions/draft-icla.json.rb
index 274d536..7cfe2cf 100644
--- a/www/project/icla/views/actions/draft-icla.json.rb
+++ b/www/project/icla/views/actions/draft-icla.json.rb
@@ -38,6 +38,8 @@ while address.length < 2
   address.push ''
 end
 
+pmc = ASF::Committee.find(@pmc)
+
 # produce draft
 _draft <<-EOF
 The Apache Software Foundation
@@ -75,7 +77,7 @@ signing and keep a copy for your records.
 
   (optional) preferred Apache id(s): #{@apacheid.ljust(30, '_')}
 
-  (optional) notify project: #{@pmc.ljust(38, '_')}
+  (optional) notify project: #{pmc.display_name.ljust(38, '_')}
 
 You accept and agree to the following terms and conditions for Your
 present and future Contributions submitted to the Foundation. In



[whimsy] branch master updated: Catch mail errors

2018-07-06 Thread sebb
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 bcdb0f5  Catch mail errors
bcdb0f5 is described below

commit bcdb0f5b51b04b9652c5683d2d680b5f625e7931
Author: Sebb 
AuthorDate: Fri Jul 6 22:07:02 2018 +0100

Catch mail errors
---
 www/project/icla/views/actions/discuss.json.rb | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/www/project/icla/views/actions/discuss.json.rb 
b/www/project/icla/views/actions/discuss.json.rb
index ad72b0d..5537ae9 100644
--- a/www/project/icla/views/actions/discuss.json.rb
+++ b/www/project/icla/views/actions/discuss.json.rb
@@ -110,7 +110,11 @@ mail = Mail.new do
 body body_text
   end
 end
-mail.deliver
+begin
+  mail.deliver
+rescue => e
+  _error "Failed to send the mail: #{e}"
+end
 
 # add token and invitation to the response
 _token token



[whimsy] branch master updated: Avoid selecting divider

2018-07-06 Thread sebb
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 d297d74  Avoid selecting divider
d297d74 is described below

commit d297d74a83054aea72fec0270f4932d93c41546e
Author: Sebb 
AuthorDate: Fri Jul 6 21:37:41 2018 +0100

Avoid selecting divider
---
 www/project/icla/views/pages/invite.js.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/www/project/icla/views/pages/invite.js.rb 
b/www/project/icla/views/pages/invite.js.rb
index 1c76c51..f17c6b1 100644
--- a/www/project/icla/views/pages/invite.js.rb
+++ b/www/project/icla/views/pages/invite.js.rb
@@ -94,7 +94,7 @@ class Invite < Vue
 Server.data.allData.each_key do |pmc|
   _option pmc if Server.data.allData[pmc]['pmc']
 end
-_option '---'
+_option '---', disabled: true # No point letting it be chosen
 Server.data.allData.each_key do |ppmc|
   _option ppmc unless Server.data.allData[ppmc]['pmc']
 end



[whimsy] branch master updated: Not used here

2018-07-06 Thread sebb
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 b08f0b0  Not used here
b08f0b0 is described below

commit b08f0b0f80f98dff598d842772456fcfb2ec5563
Author: Sebb 
AuthorDate: Fri Jul 6 18:55:09 2018 +0100

Not used here
---
 www/project/icla/main.rb | 1 -
 1 file changed, 1 deletion(-)

diff --git a/www/project/icla/main.rb b/www/project/icla/main.rb
index 268111d..a147908 100755
--- a/www/project/icla/main.rb
+++ b/www/project/icla/main.rb
@@ -59,7 +59,6 @@ helpers do
 end
   end
   def getMember(userId)
-user = ASF::Person.find(userId)
 mockId = params['mock']
 if ASF::Person[mockId] != nil
   # if mock is set, set member to mock value



[whimsy] branch master updated: Better error handling for missing token or data file

2018-07-06 Thread sebb
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 2d7927e  Better error handling for missing token or data file
2d7927e is described below

commit 2d7927e48ee5ccc7674c9d56c406cab946c6185b
Author: Sebb 
AuthorDate: Fri Jul 6 18:35:43 2018 +0100

Better error handling for missing token or data file
---
 www/project/icla/views/pages/discuss.js.rb | 34 ++
 www/project/icla/views/pages/vote.js.rb| 18 +++-
 2 files changed, 34 insertions(+), 18 deletions(-)

diff --git a/www/project/icla/views/pages/discuss.js.rb 
b/www/project/icla/views/pages/discuss.js.rb
index 9ed81fb..b7c60a8 100644
--- a/www/project/icla/views/pages/discuss.js.rb
+++ b/www/project/icla/views/pages/discuss.js.rb
@@ -6,28 +6,36 @@ class Discuss < Vue
 
 # initialize form fields
 @member = Server.data.member
+@token = Server.data.token
+@debug = Server.data.debug
 console.log('discuss')
-console.log('token: ' + Server.data.token)
+console.log('token: ' + @token)
 console.log('member: ' + @member)
 @progress = Server.data.progress
 console.log('progress: ' + @progress.inspect)
-@phase = @progress[:phase]
+if @progress
+  @phase = @progress[:phase]
+else
+  @phase = 'unknown' # flag
+end
 console.log('phase: ' + @phase)
-if @phase == 'error'
+if not @token
+  @alert = "Token is required for this page"
+elsif @phase == 'unknown'
+  @alert = "Cannot determine phase: could not read token file"
+elsif @phase == 'error'
   @alert = @progress[:errorMessage]
 elsif @phase != 'discuss'
   @alert = "Wrong phase: " + @phase + "; should be discuss"
 else
-@pmc = @progress[:project]
-@proposer = @progress[:proposer]
-@contributor = @progress[:contributor]
-@iclaname = @contributor[:name]
-@iclaemail = @contributor[:email]
-@token = Server.data.token
-@comments = @progress[:comments]
-@discussBody = ''
-@subject = @progress[:subject]
-@debug = Server.data.debug
+  @pmc = @progress[:project]
+  @proposer = @progress[:proposer]
+  @contributor = @progress[:contributor]
+  @iclaname = @contributor[:name]
+  @iclaemail = @contributor[:email]
+  @comments = @progress[:comments]
+  @discussBody = ''
+  @subject = @progress[:subject]
 end
 
   end
diff --git a/www/project/icla/views/pages/vote.js.rb 
b/www/project/icla/views/pages/vote.js.rb
index c9b643e..50c86cf 100644
--- a/www/project/icla/views/pages/vote.js.rb
+++ b/www/project/icla/views/pages/vote.js.rb
@@ -4,15 +4,25 @@ class Vote < Vue
 @alert = nil
 
 # initialize form fields
+@token = Server.data.token
 @member = Server.data.member
+@debug = Server.data.debug
 console.log('vote')
-console.log('token: ' + Server.data.token)
+console.log('token: ' + @token)
 console.log('member: ' + @member)
 @progress = Server.data.progress
 console.log('progress: ' + @progress.inspect)
-@phase = @progress[:phase]
+if @progress
+  @phase = @progress[:phase]
+else
+  @phase = 'unknown' # flag
+end
 console.log('phase: ' + @phase)
-if @phase == 'error'
+if not @token
+  @alert = "Token is required for this page"
+elsif @phase == 'unknown'
+  @alert = "Cannot determine phase: could not read token file"
+elsif @phase == 'error'
   @alert = @progress[:errorMessage]
 elsif @phase != 'vote'
   @alert = "Wrong phase: " + @phase + "; should be vote"
@@ -23,7 +33,6 @@ class Vote < Vue
   @contributor = @progress[:contributor]
   @iclaname = @contributor[:name]
   @iclaemail = @contributor[:email]
-  @token = Server.data.token
   @comments = @progress[:comments]
   @votes = @progress[:votes]
   @vote = ''
@@ -31,7 +40,6 @@ class Vote < Vue
   @commentBody = ''
   @subject = @progress[:subject]
   @showComment = false;
-  @debug = Server.data.debug
 end
   end
 



[whimsy] branch master updated: Docco

2018-07-06 Thread sebb
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 cceafd2  Docco
cceafd2 is described below

commit cceafd2c26f5ca06f340763c0ec2eeed3d7f1a05
Author: Sebb 
AuthorDate: Fri Jul 6 17:27:52 2018 +0100

Docco
---
 www/project/icla/views/actions/validate.json.rb | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/www/project/icla/views/actions/validate.json.rb 
b/www/project/icla/views/actions/validate.json.rb
index a58add8..55e7a9b 100644
--- a/www/project/icla/views/actions/validate.json.rb
+++ b/www/project/icla/views/actions/validate.json.rb
@@ -16,6 +16,8 @@ require 'pathname'
 #  error
 #  focus
 #  token
+#  pmcEmail
+#  userEmail
 #  invitation
 
 # find pmc and user information



[whimsy] branch master updated: Add Personal details questions

2018-07-06 Thread sebb
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 77f50bd  Add Personal details questions
77f50bd is described below

commit 77f50bdab69ce65bd84ffe5506346ca25d0bc63f
Author: Sebb 
AuthorDate: Fri Jul 6 13:39:41 2018 +0100

Add Personal details questions

TODO: validate against proper data
---
 www/project/icla/views/pages/interview.js.rb | 50 +---
 1 file changed, 46 insertions(+), 4 deletions(-)

diff --git a/www/project/icla/views/pages/interview.js.rb 
b/www/project/icla/views/pages/interview.js.rb
index e3c6775..0e7d863 100644
--- a/www/project/icla/views/pages/interview.js.rb
+++ b/www/project/icla/views/pages/interview.js.rb
@@ -1,12 +1,15 @@
 class Interview < Vue
   def initialize
-@showQuestion1 = true
+@showQuestion1 = false
 @showQuestion2 = false
 @showQuestion3 = false
 
 @disableButton1 = false
 @disableButton2 = false
 @disableButton3 = false
+
+@disablePersonalDetails = false
+@alert = nil
   end
 
   def render
@@ -30,9 +33,25 @@ class Interview < Vue
   to review and submit the completed form.
 }
 
-_p %{
-  TODO: verify email address and Public Name
-}
+_div.form_group do
+  _p 'Full Name:'
+  _input.form_control.fullname! value: @fullName, required: true,
+onChange: self.setFullName, disabled: @disablePersonalDetails
+end
+
+_div.form_group do
+  _p 'Email Address:'
+  _input.form_control.emailAddress! value: @emailAddress, required: true,
+onChange: self.setEmailAddress, disabled: @disablePersonalDetails
+end
+
+# error messages
+if @alert
+  _div.alert.alert_danger do
+_b 'Error: '
+_span @alert
+  end
+end
 
 #
 # Question 1
@@ -119,6 +138,29 @@ class Interview < Vue
 end
   end
 
+  def validatePerson
+if @fullName and @fullName != '' and @emailAddress and @emailAddress != ''
+  if @fullName == FormData.fullname and @emailAddress == FormData.email # 
TODO proper validation
+@showQuestion1 = true
+@disablePersonalDetails = true # no further changes allowed
+@alert = nil
+  else
+@alert = 'Cannot validate details'
+  end
+end
+  end
+
+  def setFullName(event)
+@fullName = event.target.value
+validatePerson
+  end
+
+  # enable submit button when name is present
+  def setEmailAddress(event)
+@emailAddress = event.target.value
+validatePerson
+  end
+
   def clickButton1()
 @disableButton1 = true 
 @showQuestion2 = true



[whimsy] branch master updated: Note restriction

2018-07-06 Thread sebb
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 4dc9c52  Note restriction
4dc9c52 is described below

commit 4dc9c52405ed199c396ef5be573622fc5a420a53
Author: Sebb 
AuthorDate: Fri Jul 6 11:59:42 2018 +0100

Note restriction
---
 www/project/icla/views/pages/invite.js.rb | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/www/project/icla/views/pages/invite.js.rb 
b/www/project/icla/views/pages/invite.js.rb
index 19252c1..1c76c51 100644
--- a/www/project/icla/views/pages/invite.js.rb
+++ b/www/project/icla/views/pages/invite.js.rb
@@ -46,6 +46,9 @@ class Invite < Vue
   vote on contributors to become a committer or a PMC/PPMC member; or
   simply invite them to submit an ICLA.
 }
+_p do
+  _b '** NOTE: only new contributors are currently supported, i.e. 
existing ASF committers are excluded. **'
+end
 _p %{
   If you would like to discuss the candidate, go to the Discuss tab
   after filling the contributor and PMC/PPMC fields.



[whimsy] branch master updated: Simplify by using instance variables

2018-07-06 Thread sebb
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 abf8406  Simplify by using instance variables
abf8406 is described below

commit abf840629a995caf0e02d9e15dacd783bfe672ad
Author: Sebb 
AuthorDate: Fri Jul 6 11:35:25 2018 +0100

Simplify by using instance variables

Also now agrees with other action modules
---
 www/project/icla/views/actions/update.json.rb | 107 --
 1 file changed, 48 insertions(+), 59 deletions(-)

diff --git a/www/project/icla/views/actions/update.json.rb 
b/www/project/icla/views/actions/update.json.rb
index 50c6d32..ff71da8 100644
--- a/www/project/icla/views/actions/update.json.rb
+++ b/www/project/icla/views/actions/update.json.rb
@@ -35,9 +35,8 @@ VALID_PHASES=%w{discuss vote cancelled tallied invite}
 VALID_VOTES=%w{+1 +0 -0 -1}
 
 # Tally the votes and send them
-def sendTally(data, contents)
-  member = data['member'] # currently logged in
-  user_email = "#{member}@apache.org"
+def sendTally(contents)
+  user_email = "#{@member}@apache.org"
   pmc = ASF::Committee.find(contents['project'])
   pmc_email = "#{pmc.mail_list}@apache.org"
   subject = "[RESULT]" + contents['subject']
@@ -77,79 +76,72 @@ def sendTally(data, contents)
   mail.deliver
 end
 
-def update(data)
+def update()
   # setup and validation
-  token = data['token']
-  raise ArgumentError.new('token must not be nil') unless token
-  action = data['action']
-  raise ArgumentError.new("Invalid action: '#{action}'") unless 
VALID_ACTIONS.include? action
-  member = data['member']
-  comment = data['comment'] # may be nil
-  expectedPhase = data['expectedPhase']
-  raise ArgumentError.new('expectedPhase must not be nil') unless expectedPhase
-  newPhase = data['newPhase'] # nil for no change
-  if newPhase and not VALID_PHASES.include? newPhase
-raise ArgumentError.new("Invalid newPhase: '#{newPhase}'")
+  raise ArgumentError.new('token must not be nil') unless @token
+  raise ArgumentError.new("Invalid action: '#{@action}'") unless 
VALID_ACTIONS.include? @action
+  raise ArgumentError.new('expectedPhase must not be nil') unless 
@expectedPhase
+  if @newPhase and not VALID_PHASES.include? @newPhase
+raise ArgumentError.new("Invalid @newPhase: '#{@newPhase}'")
   end
 
   timestamp = Time.now.utc.to_s
   addComment = nil
   voteinfo = nil
-  if action == 'submitVote'
-vote = data['vote']
-raise ArgumentError.new("Invalid vote: '#{vote}'") unless 
VALID_VOTES.include? vote
-raise ArgumentError.new('member must not be nil') unless member
-if vote == '-1'
-  raise ArgumentError.new('-1 vote must have comment') unless comment
+  if @action == 'submitVote'
+raise ArgumentError.new("Invalid vote: '#{@vote}'") unless 
VALID_VOTES.include? @vote
+raise ArgumentError.new('member must not be nil') unless @member
+if @vote == '-1'
+  raise ArgumentError.new('-1 vote must have comment') unless @comment
 end
-if comment # allow comment for other votes
+if @comment # allow comment for other votes
   voteinfo = {
-'vote' => vote,
-'comment' => comment,
-'member' => member,
+'vote' => @vote,
+'comment' => @comment,
+'member' => @member,
 'timestamp' => timestamp,
   }
 else
   voteinfo = {
-'vote' => vote,
-'member' => member,
+'vote' => @vote,
+'member' => @member,
 'timestamp' => timestamp,
   }
 end
-  elsif HAS_COMMENT.include? action
-if comment
+  elsif HAS_COMMENT.include? @action
+if @comment
   addComment = 
   {
-'comment' => comment,
-'member' => member,
+'comment' => @comment,
+'member' => @member,
 'timestamp' => timestamp,
   } 
 else
-  raise ArgumentError.new("comment must not be nil for '#{action}'")
+  raise ArgumentError.new("comment must not be nil for '#{@action}'")
 end
   end
 
-  file = "/srv/icla/#{token}.json"
+  file = "/srv/icla/#{@token}.json"
 
   # now read/update the file if necessary
   contents = {} # define the var outside the block
   rewrite = false # should the file be updated?
-  phases = *expectedPhase # convert string to array
+  phases = *@expectedPhase # convert string to array
 
   LockFile.lockfile(file, 'r+', File::LOCK_EX) do |f|
 contents = JSON::parse(f.read)
 phase = contents['phase']
-raise ArgumentError.new("Phase '#{phase}': expected '#{expectedPhase}'") 
unless expectedPhase == '*' or phases.include? phase 
-if newPhase && newPhase != phase
-  contents['phase'] = newPhase
+raise ArgumentError.new("Phase '#{phase}': expected '#{@expectedPhase}'") 
unless @expectedPhase == '*' or phases.include? phase 
+if @newPhase && @newPhase != phase
+  contents['phase'] = @newPhase

[whimsy] branch master updated: No need to use global variable here

2018-07-06 Thread sebb
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 8f602e9  No need to use global variable here
8f602e9 is described below

commit 8f602e9e70ed135914d431795116959017ad9bd9
Author: Sebb 
AuthorDate: Fri Jul 6 10:45:30 2018 +0100

No need to use global variable here
---
 www/project/icla/views/actions/update.json.rb | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/www/project/icla/views/actions/update.json.rb 
b/www/project/icla/views/actions/update.json.rb
index 8345859..50c6d32 100644
--- a/www/project/icla/views/actions/update.json.rb
+++ b/www/project/icla/views/actions/update.json.rb
@@ -201,11 +201,11 @@ end
 if __FILE__ == $0 # Allow independent testing
   require 'whimsy/asf'
   require 'mail'
-  $ret = {}
+  ret = {}
   # method_missing caused some errors to be overlooked
   %w{backtrace body_text error contents rewrite}.each do |n|
 define_method("_#{n}") do |a|
-  $ret[n] = a
+  ret[n] = a
 end
   end
   data = Hash[*ARGV] # cannot combine this with next line as hash doesn't yet 
exist
@@ -214,10 +214,10 @@ if __FILE__ == $0 # Allow independent testing
   if data['action'] == 'sendTally' # special for testing stand-alone
 contents = JSON.parse(File.read("/srv/icla/#{data['token']}.json"))
 sendTally(data, contents)
-puts $ret['body_text']
+puts ret['body_text']
   else
 main(data)
-puts JSON.pretty_generate($ret) # output the return data
+puts JSON.pretty_generate(ret) # output the return data
   end
 else
   embed # Sinatra sets params



[whimsy] branch master updated: Eclipse plugin does not like heredoc squiggl

2018-07-06 Thread sebb
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 03cf2b9  Eclipse plugin does not like heredoc squiggl
03cf2b9 is described below

commit 03cf2b91be0275b66e032e5cce671d06dc56b2ba
Author: Sebb 
AuthorDate: Fri Jul 6 10:31:33 2018 +0100

Eclipse plugin does not like heredoc squiggl
---
 www/project/icla/views/actions/update.json.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/www/project/icla/views/actions/update.json.rb 
b/www/project/icla/views/actions/update.json.rb
index 9e040e3..8345859 100644
--- a/www/project/icla/views/actions/update.json.rb
+++ b/www/project/icla/views/actions/update.json.rb
@@ -52,7 +52,7 @@ def sendTally(data, contents)
   }
   started = Time.parse votes[0]['timestamp']
   elapsed=(Time.now - started) / (60*60)
-  body_text = <<~EOD
+  body_text = <<-EOD.gsub(/^/,'') # Eclipse plugin does not like heredoc 
squiggle
 Here is the tally of the latest votes from each voter:
 
 #{last_votes.map{ |k,v| "Member: #{k.ljust(20)} Vote: #{v[0]} Date: 
#{v[1]}"}.join("\n")}
@@ -211,7 +211,7 @@ if __FILE__ == $0 # Allow independent testing
   data = Hash[*ARGV] # cannot combine this with next line as hash doesn't yet 
exist
   data.each{|k,v| data[k] = v.split(',') if v =~ /,/} # fix up lists
   puts data.inspect
-  if data['action'] == 'sendTally'
+  if data['action'] == 'sendTally' # special for testing stand-alone
 contents = JSON.parse(File.read("/srv/icla/#{data['token']}.json"))
 sendTally(data, contents)
 puts $ret['body_text']