Error when run server rails 2.3.5 with memcached - ruby-on-rails

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.

Related

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.)

Syntax error in Rails server with wash_out

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.

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'

How to fix error in Linguistics library in Rails 3.1 and Ruby 1.9.2

My application has had the following lines without any trouble in recent versions of rails:
gem 'linguistics' # in Gemfile
Linguistics::use(:en, :installProxy => :en) # In environment.rb
Recently I upgraded from Ruby 1.8.7 to Ruby 1.9.2 and am using the edge version of Rails. When I start the server I now see the following:
=> Booting WEBrick
=> Rails 3.1.0.beta1 application starting in development on
http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server Exiting /Users/alextan/.rvm/gems/ruby-1.9.2-p180/gems/linguistics-1.0.8/lib/linguistics.rb:177:in
`en': can't modify frozen object
(RuntimeError) from (eval):6:in
`method_missing' from
/Users/alextan/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.beta1/lib/rails/commands/server.rb:78:in
`middleware' from
/Users/alextan/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.3.0.beta/lib/rack/server.rb:291:in
`build_app' from
/Users/alextan/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.3.0.beta/lib/rack/server.rb:301:in
`wrapped_app' from
/Users/alextan/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.3.0.beta/lib/rack/server.rb:252:in
`start' from
/Users/alextan/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.beta1/lib/rails/commands/server.rb:69:in
`start' from
/Users/alextan/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.beta1/lib/rails/commands.rb:53:in
`block in <top (required)>' from
/Users/alextan/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.beta1/lib/rails/commands.rb:48:in
`tap' from
/Users/alextan/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.beta1/lib/rails/commands.rb:48:in
`<top (required)>' from
script/rails:6:in `require' from
script/rails:6:in `<main>'
Any idea on how I can fix this? Is this an incompatibility between Linguistics and Ruby 1.9.2?
I think its mainly a rails compatibility problem, because in the commits 1.9.2 compat is mentioned, try on after another, not both together, to ensure, 1.9.2 and rails 3 works, after that switch to edge rails.
You may want to try, if there is a actual version out there, try (include this version then in your gemfile):
gem update linguistics --pre
OR be sure to have it updated in your gemfile
gem 'linguistics', :git => 'https://github.com/ged/linguistics.git'

can't start script/console with Ruby 1.9 and Rails 2.3.4

I'm trying to start the console (irb) in Ruby 1.9 with Rails 2.3.4. I have two versions installed of Ruby (1.9 & 1.8.6) and I run the Ruby 1.9 by calling: rake19, ruby19, gem19...etc
And they work fine in all situations except this! it seems that its trying to load Ruby 1.8 instead! Do you know how I can change that?
Macintosh-10:favquote tammam56$ ruby19 script/console
Loading development environment (Rails 2.3.4)
/Users/tammam56/rubydev/favquote/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:1:in `require': no such file to load -- rubygems (LoadError)
from /Users/tammam56/rubydev/favquote/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:1
from /Users/tammam56/rubydev/favquote/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:1:in `require'
from /Users/tammam56/rubydev/favquote/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:1
from /Users/tammam56/rubydev/favquote/config/../vendor/rails/railties/lib/initializer.rb:10:in `require'
from /Users/tammam56/rubydev/favquote/config/../vendor/rails/railties/lib/initializer.rb:10
from /Users/tammam56/rubydev/favquote/config/boot.rb:45:in `require'
from /Users/tammam56/rubydev/favquote/config/boot.rb:45:in `load_initializer'
from /Users/tammam56/rubydev/favquote/config/boot.rb:38:in `run'
from /Users/tammam56/rubydev/favquote/config/boot.rb:11:in `boot!'
from /Users/tammam56/rubydev/favquote/config/boot.rb:110
from /Users/tammam56/rubydev/favquote/config/environment.rb:8:in `require'
from /Users/tammam56/rubydev/favquote/config/environment.rb:8
from /opt/local/lib/ruby/1.8/irb/init.rb:252:in `require'
from /opt/local/lib/ruby/1.8/irb/init.rb:252:in `load_modules'
from /opt/local/lib/ruby/1.8/irb/init.rb:250:in `each'
from /opt/local/lib/ruby/1.8/irb/init.rb:250:in `load_modules'
from /opt/local/lib/ruby/1.8/irb/init.rb:21:in `setup'
from /opt/local/lib/ruby/1.8/irb.rb:54:in `start'
from /opt/local/bin/irb:13
Thanks,
Tam
This is happening because script/console is calling irb (1.8). Assuming you have irb19 for ruby 1.9 you could do:
script/console --irb='irb19'
However there may still be problems with rails gems. If so, I'd recommend using rvm to manage your different rubys. When using rvm you will need to install gems separately for ruby 1.9 and 1.8.

Resources