Syntax error in Rails server with wash_out - ruby-on-rails

I'm trying to build a SOAP service with Ruby on Rails 3. After a lot of research I found Wash_out.
Now, when I add the gem to my gemfile, like this:
gem 'wash_out'
My rails application no longer starts, I mean, when I type 'rails s' it gives me an error with wash_out.
/usr/lib/ruby/gems/1.8/gems/wash_out-0.6.1/lib/wash_out.rb:3:in `require': /usr/lib/ruby/gems/1.8/gems/wash_out-0.6.1/lib/wash_out/dispatcher.rb:19: syntax error, unexpected '\n' (SyntaxError)
from /usr/lib/ruby/gems/1.8/gems/wash_out-0.6.1/lib/wash_out.rb:3
from /usr/lib/ruby/gems/1.8/gems/bundler-1.3.4/lib/bundler/runtime.rb:72:in `require'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.3.4/lib/bundler/runtime.rb:72:in `require'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.3.4/lib/bundler/runtime.rb:70:in `each'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.3.4/lib/bundler/runtime.rb:70:in `require'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.3.4/lib/bundler/runtime.rb:59:in `each'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.3.4/lib/bundler/runtime.rb:59:in `require'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.3.4/lib/bundler.rb:132:in `require'
from /home/TheBcd/Escritorio/ws/config/application.rb:7
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.13/lib/rails/commands.rb:53:in `require'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.13/lib/rails/commands.rb:53
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.13/lib/rails/commands.rb:50
from script/rails:6:in `require'
from script/rails:6
I'd appreciate any help, thank you very much.

From your trace log I'm assuming you're using ruby 1.8 and a short reading of the gem's github shows this:
Rails >3.0 only. MRI 1.9, 2.0, JRuby (--1.9).
Ruby 1.8 is not officially supported since 0.5.3. We will accept
further compatibilty pull-requests but no upcoming versions will be
tested against it.
So, if you want to use the gem with 1.8 support it'd be wise to lock the version to anything under 0.5.3. Try setting your gem version in your Gemfile to something under that version and it will probably work but like they say, it's not guaranteed.

wash_out requires Ruby 1.9. Your backtrace shows Ruby 1.8.

Related

How to repair ruby on rails on mac

I have ruby on rails installed and something kinda went fubar on it. When I try to generate a controller, I get the following:
➜ librius rails generate controller Teachers
Running via Spring preloader in process 27015
/Users/erick/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in `load': no implicit conversion of nil into String (TypeError)
from /Users/erick/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in `block in load'
from /Users/erick/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:259:in `load_dependency'
from /Users/erick/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in `load'
from /Users/erick/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/erick/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
➜ librius
I've tried to uninstall/reinstall using gem and RVM but nothing seems to work.
Thanks.
The comments helped point in the right direction.
I did a gem upgrade (which I had to download because it kept telling me I had the latest). Then I did gem pristine --all, then spring stop. (Still wasn't working.) Then lastly, bundle install and voila! Such a hassle! Thanks!

Error when run server rails 2.3.5 with memcached

I use ruby version 1.8.7, gem version 1.3.5, rails version 2.3.5 and memcache. I get this error when I run server
phuongnm-lap:~/trunk/hurricane$ ruby script/server
=> Booting Mongrel
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
/home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `require': /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/get_process_mem-0.2.0/lib/get_process_mem.rb:60: undefined (?...) sequence: /(?<value>(\d*\.{0,1}\d+))\s+(?<unit>\w\w)/ (SyntaxError)
from /home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `require'
from /home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
from /home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `require'
from /home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
from /home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
from /home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
from ./script/../config/boot.rb:41:in `load_gems'
from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:164:in `process'
from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send'
from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
from /home/asiantech/trunk/hurricane/config/environment.rb:34
from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/rails-2.3.5/lib/commands/server.rb:84
from script/server:3:in `require'
from script/server:3
please help me!
Your ruby version is too old for the get_process_mem gem to run. The gem uses a complex regular expression to parse information from /proc files on your linux server. However, ruby 1.8.7 does not support such complex regexp yet.
You can see for yourself in irb. In ruby 1.8.7 the match fails:
"aaa" =~ /(?<value>(\d*\.{0,1}\d+))\s+(?<unit>\w\w)/
# => SyntaxError: compile error
# => (irb):1: undefined (?...) sequence: /(?<value>(\d*\.{0,1}\d+))\s+(?<unit>\w\w)/
whereas under ruby 2.2 it works ok (does not return anything in this test case, but more importantly, does not fail with error):
"aaa" =~ /(?<value>(\d*\.{0,1}\d+))\s+(?<unit>\w\w)/
# => nil
You have a few options now:
Upgrade to a newer ruby (and rails) if you can, you won't have to solve these elderly code-related problems and won't be using an unsupported ruby/rails version any more, but nevertheless this is rather a cumbersome process.
Get rid of the get_process_mem gem. You can see the same info, i.e. the memory consumed by the process, using command line utilities, without needing to install any gem. Try the top or htop commands for example.

Running vim-ruby-debugger on MacVim in OS X 10.10

Spent all day trying to make it works.
Installed like described in readme.
This shell call:
rdebug-vim --file /Users/aleksandrkunin/.vim/tmp/ruby_debugger --output /Users/aleksandrkunin/.vim/tmp/ruby_debugger_output --socket /var/folders/p9/dq06c2dn72nbbk45qdc5yx1h0000gp/T/vLSSici/17 --logger_file /Users/aleksandrkunin/.vim/tmp/ruby_debugger_log --debug_mode 0 --vim_executable mvim --vim_servername VIM --separator ++vim-ruby-debugger-separator++ -- '/Users/aleksandrkunin/Documents/rails_projects/tracks_dev/script/rails' server
Cause this error:
Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/debugger-xml-0.4.1/lib/byebug/commands/frame.rb:12:in `alias_method': undefined method `get_pr_arguments' for module `Byebug::FrameFunctions' (NameError)
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/debugger-xml-0.4.1/lib/byebug/commands/frame.rb:12:in `<module:FrameFunctions>'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/debugger-xml-0.4.1/lib/byebug/commands/frame.rb:2:in `<module:Byebug>'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/debugger-xml-0.4.1/lib/byebug/commands/frame.rb:1:in `<top (required)>'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/debugger-xml-0.4.1/lib/debugger_xml.rb:5:in `block in <top (required)>'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/debugger-xml-0.4.1/lib/debugger_xml.rb:5:in `each'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/debugger-xml-0.4.1/lib/debugger_xml.rb:5:in `<top (required)>'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/debugger-xml-0.4.1/bin/rdebug-vim:15:in `<top (required)>'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/bin/rdebug-vim:23:in `load'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/bin/rdebug-vim:23:in `<main>'
Is it possible to run? Is there another way for visual debugging in VIM?
I think the problem is that you're trying to use a gem that says it's for Ruby >= 1.9 with Ruby 2+.
rdebug does not work with Ruby 2.0+, only with Ruby in the 1.9 range. The documentation is confusing but that's how it is.
... This is a new version of the plugin, which uses debugger-xml gem, and works only with Ruby >= 1.9....
Look at the revision history of rdebug and you can see it hasn't been updated in a while.
With 2.1.1 you're using byebug, which doesn't implement the necessary call to work with Vim, hence the message:
undefined method `get_pr_arguments' for module `Byebug::FrameFunctions' (NameError)
Your choices are:
Revert to Ruby 1.9.3-p551, which is the latest of that series and install rdebug.
Stop trying to use vim-rdebug and learn to use byebug in its standalone mode, which is a more traditional debugger and works nicely. (Alternately you could use Pry and pry-debug.)

uninitialized constant I18n::JS Ruby on Rails

I am still having trouble with Ruby on Rails. I run rails s (this is for my openproject app) and I get this (before it was working). I also wanted to make a note I am now using Ruby 2.0 and I still get the same error.
require 'rails/all'... 0.850s
Bundler.require... 7.700s
/home/bistro/openproject/config/application.rb:89:in `<class:Application>': uninitialized constant I18n::JS (NameError)
from /home/bistro/openproject/config/application.rb:61:in `<module:OpenProject>'
from /home/bistro/openproject/config/application.rb:60:in `<top (required)>'
from /home/bistro/.rvm/gems/ruby-1.9.3-p484/gems/railties-3.2.16/lib/rails/commands.rb:53:in `require'
from /home/bistro/.rvm/gems/ruby-1.9.3-p484/gems/railties-3.2.16/lib/rails/commands.rb:53:in `block in <top (required)>'
from /home/bistro/.rvm/gems/ruby-1.9.3-p484/gems/railties-3.2.16/lib/rails/commands.rb:50:in `tap'
from /home/bistro/.rvm/gems/ruby-1.9.3-p484/gems/railties-3.2.16/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I'm working on a Rails Ember app and I had exactly the same problem, trying to internationalize the client-side using the i18n-js gem (https://github.com/fnando/i18n-js). To give more context, I am following the instructions in this article: http://eviltrout.com/2013/11/24/i18n-in-ember.html
In my case, Rails did not find I18n::JS because it is now called SimplesIdeias::I18n (you can see it by running rake middleware from the command line). Adding the line
config.middleware.use SimplesIdeias::I18n::Middleware
in the application.rb file solved the problem for me, hope it helps.
If you happen upon this now adays. your gemfile should say something like gem 'i18n-js', ">= 3.0.0.rc11". Otherwise you will end up using version 2.0

Unable to start the rails server after installing gem for twitter bootstrap

A VERY HAPPY AND PROSPEROUS NEW YEAR TO ALL.
I have started learning ROR and trying to create my first application with it. I am trying to use Twitter bootstrap gem. After bundle install, when i am trying to run the rails server command i am getting this error:
/var/lib/gems/1.8/gems/twitter-bootstrap-rails-2.1.9/lib/twitter/bootstrap/rails/engine.rb:3:in `require': /var/lib/gems/1.8/gems/twitter-bootstrap-rails-2.1.9/lib/twitter/bootstrap/rails/twitter-bootstrap-breadcrumbs.rb:33: syntax error, unexpected ':', expecting kEND (SyntaxError)
Can somebody please guide me what i am missing here ?
here is the stack trace of the same:
/var/lib/gems/1.8/gems/twitter-bootstrap-rails-2.1.9/lib/twitter/bootstrap/rails/engine.rb:3:in `require': /var/lib/gems/1.8/gems/twitter-bootstrap-rails-2.1.9/lib/twitter/bootstrap/rails/twitter-bootstrap-breadcrumbs.rb:33: syntax error, unexpected ':', expecting kEND (SyntaxError)
I18n.t name, scope: scope
^
from /var/lib/gems/1.8/gems/twitter-bootstrap-rails-2.1.9/lib/twitter/bootstrap/rails/engine.rb:3
from /var/lib/gems/1.8/gems/twitter-bootstrap-rails-2.1.9/lib/twitter-bootstrap-rails.rb:4:in `require'
from /var/lib/gems/1.8/gems/twitter-bootstrap-rails-2.1.9/lib/twitter-bootstrap-rails.rb:4
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in `require'
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in `require'
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in `each'
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in `require'
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `each'
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `require'
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler.rb:128:in `require'
from /var/www/ahex_connect/config/application.rb:7
from /var/lib/gems/1.8/gems/railties-3.2.9/lib/rails/commands.rb:53:in `require'
from /var/lib/gems/1.8/gems/railties-3.2.9/lib/rails/commands.rb:53
from /var/lib/gems/1.8/gems/railties-3.2.9/lib/rails/commands.rb:50:in `tap'
from /var/lib/gems/1.8/gems/railties-3.2.9/lib/rails/commands.rb:50
from script/rails:6:in `require'
from script/rails:6
The problem is that you are using Ruby 1.8 while the syntax on line #33 (inside the twitter-bootstrap-rails gem) is from Ruby 1.9. They already fixed this to make it compatible on master. So possible solutions:
Upgrade your Ruby version to 1.9.
Use git version of the gem. Put this to Gemfile (modify the existing line) and run bundle install
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'

Resources