Alan Fleming
2009-Oct-23 13:57 UTC
Deployment syntax error: fine in dev - what''s happening?
I''m deploying an app (using Capistrano) to a staging server prior to final deployment. The app runs fine in dev, but in staging it throws a syntax error. How can that be? The error is: /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'': /Library/WebServer/staging.givetothem.co.uk/releases/20091023133654/app/controllers/bulkimport_controller.rb:32: syntax error, unexpected kRESCUE, expecting kEND (SyntaxError) rescue Exception ^ The code generating the error is: begin @parsed_file=CSV::Reader.parse(params[:dump][:file]) n=0 @parsed_file.each do |row| unless row[0].nil? c=@recipients.new c.address=row[0] if c.save n=n+1 GC.start if n%50==0 end end rescue Exception flash.now[:error]="Import failed! Please check the file and try again." else flash.now[:notice]="Import successful, #{n} new addresses added to your list." end Another couple errors are then thrown: two lines further complaining about the else, then at EOF still expecting kEND. I can''t see it, and textmate suggests I''ve all my starts and ends lined up. What am I doing wrong? And more importantly, does anyone have any idea why is is showing in staging only and not in my dev environment? Rails is 2.3.4 on both, Ruby is 1.8.7pl72, gems are frozen in, OSes is OSX Snow Leopard & Snow Leopard server. Thanks in advance for any help - I''m a relative newb at this. Alan. -- Posted via http://www.ruby-forum.com/.
Frederick Cheung
2009-Oct-23 14:39 UTC
Re: Deployment syntax error: fine in dev - what''s happening?
On Oct 23, 2:57 pm, Alan Fleming <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I''m deploying an app (using Capistrano) to a staging server prior to > final deployment. The app runs fine in dev, but in staging it throws a > syntax error. How can that be? >Well the code looks wrong to me - inside the begin you have each unless and if, but only 2 ends before the rescue (you don''t seem to have indented the each). A big difference between development and production is that in development files are loaded when needed, so if there is a syntax error you hear about it when that file is used, whereas in production rails loads all your classes up front so you get the error upon startup. Fred> The error is: > > /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in > `gem_original_require'': > /Library/WebServer/staging.givetothem.co.uk/releases/20091023133654/app/con trollers/bulkimport_controller.rb:32: > syntax error, unexpected kRESCUE, expecting kEND (SyntaxError) > rescue Exception > ^ > > The code generating the error is: > > begin > @parsed_file=CSV::Reader.parse(params[:dump][:file]) > n=0 > @parsed_file.each do |row| > unless row[0].nil? > c...-zSUWd5d9zz3GOnXt/fX6UA@public.gmane.org > c.address=row[0] > if c.save > n=n+1 > GC.start if n%50==0 > end > end > rescue Exception > flash.now[:error]="Import failed! Please check the file and try > again." > else > flash.now[:notice]="Import successful, #{n} new addresses added > to your list." > end > > Another couple errors are then thrown: two lines further complaining > about the else, then at EOF still expecting kEND. > > I can''t see it, and textmate suggests I''ve all my starts and ends lined > up. What am I doing wrong? And more importantly, does anyone have any > idea why is is showing in staging only and not in my dev environment? > > Rails is 2.3.4 on both, Ruby is 1.8.7pl72, gems are frozen in, OSes is > OSX Snow Leopard & Snow Leopard server. > > Thanks in advance for any help - I''m a relative newb at this. > > Alan. > -- > Posted viahttp://www.ruby-forum.com/.
Alan Fleming
2009-Oct-24 11:46 UTC
Re: Deployment syntax error: fine in dev - what''s happening?
Frederick Cheung wrote:> > Well the code looks wrong to meIndeed it is. I''m clearly blind. Thanks also for the info on the environmental differences. Makes perfect sense now. -- Posted via http://www.ruby-forum.com/.