Skip to content

Remove erb trim instruction on busy.erb page#1735

Merged
mperham merged 1 commit intosidekiq:masterfrom
tdantas:web-busy-erb-trim
May 26, 2014
Merged

Remove erb trim instruction on busy.erb page#1735
mperham merged 1 commit intosidekiq:masterfrom
tdantas:web-busy-erb-trim

Conversation

@tdantas
Copy link
Contributor

@tdantas tdantas commented May 26, 2014

Hey, I updated my sidekiq from 3.0.2 to 3.1.0 and the web ( busy.erb ) component raise a syntax error.

[ 2014-05-26 11:16:52.7334 35963/0x10c9e5000 Pool2/SmartSpawner.h:301 ]: Preloader for /Users/tdantas/Code/sidekiq-monitor started on PID 35980, listening on 
App 35980 stderr: SyntaxError - /Users/tdantas/.rvm/gems/ruby-1.9.3-p327@sidekiq-monitor/gems/sidekiq-3.1.0/web/views/busy.erb:61: syntax error, unexpected ';'                     
App 35980 stderr: ...kiq::Job.new(msg['payload']) -; @_out_buf.concat "\n"

To reproduce the error I created a simple example and verify that to ERB trim empty lines, we must pass an argument to trim mode.

require 'erb'
TEMPLATE = <<-EOF
  <%= name -%>
EOF
name = 'sidekiq'

puts '------- Without trim mode -------'
begin
  puts ERB.new(TEMPLATE).result(binding)
rescue Exception => e
  puts "Failed #{e.message}"
end

puts '------- With trim mode -------'
begin
  puts ERB.new(TEMPLATE, nil, '-').result(binding)
rescue
  puts 'Failed'
end

Output:

------- Without trim mode -------
Failed (erb):1: syntax error, unexpected ')'
... "  "; _erbout.concat(( name -).to_s); _erbout.concat "\n"
...                                 ^

------- With trim mode -------
 sidekiq

Thanks

mperham added a commit that referenced this pull request May 26, 2014
Remove erb trim instruction on busy.erb page
@mperham mperham merged commit 63eafb1 into sidekiq:master May 26, 2014
@tdantas
Copy link
Contributor Author

tdantas commented May 26, 2014

thanks @mperham. plan to upload to rubygems ?

@mperham
Copy link
Collaborator

mperham commented May 26, 2014

Yes later today.

On May 26, 2014, at 6:50, Thiago Dantas notifications@github.com wrote:

thanks @mperham. plan to upload to rubygems ?


Reply to this email directly or view it on GitHub.

@mperham
Copy link
Collaborator

mperham commented May 26, 2014

This is very bizarre because it is working for me in Ruby 2.1. You are using Ruby 1.9.3 (which is unsupported) so I suspect this is old behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants