title: ruby syntax error, unexpected ':', expecting keyword_then
body: <p>I've recently updated ruby from 1.8.7.374 to 2.1.2p95 and I have a svn post-commit script which was working fine but now it fails. </p>
  
  <pre><code>changes=`#{svnlook} diff #{repo} -r #{rev}`
  body &lt;&lt; "&lt;pre&gt;"
  changes.each do |top_line|
  top_line.split("\n").each do |line|
  color = case
    when line =~ /^Modified: / || line =~ /^=+$/ || line =~ /^@@ /: 'gray'
    when line =~ /^-/ 'red:'
    when line =~ /^\+/ 'blue:'
    else "black"
    end
    body &lt;&lt; %Q{&lt;font style="color:#{color}"&gt;#{CGI.escapeHTML(line)}&lt;/font&gt;    &lt;br/&gt;\n}
    end
    end
    body &lt;&lt; "&lt;/pre&gt;"
  </code></pre>
  
  <p>Here's the errors I get:</p>
  
  <pre><code>    [root@dev hooks]# ruby -c post-commit
  post-commit:66: syntax error, unexpected ':', expecting keyword_then or     ',' or ';' or '\n'
  ...ne =~ /^=+$/ || line =~ /^@@ /: 'gray'
  ...                               ^
  post-commit:67: syntax error, unexpected keyword_when, expecting    keyword_end
    when line =~ /^-/ 'red:'
        ^
  post-commit:67: syntax error, unexpected tSTRING_BEG, expecting     keyword_end
        when line =~ /^-/ 'red:'
                       ^
  post-commit:68: syntax error, unexpected keyword_when, expecting     keyword_end
        when line =~ /^\+/ 'blue:'
        ^
  post-commit:68: syntax error, unexpected tSTRING_BEG, expecting     keyword_end
        when line =~ /^\+/ 'blue:'
                        ^
  post-commit:69: syntax error, unexpected keyword_else, expecting     keyword_end
        else "black"
        ^
  post-commit:65: warning: assigned but unused variable - color
  post-commit:18: warning: assigned but unused variable - saddress
  post-commit:20: warning: assigned but unused variable - sendmail
  post-commit:73: syntax error, unexpected keyword_end, expecting end-of-    input
  </code></pre>
  
  <p>Any help in solving this is much appreciated.</p>