Gem install rails failed when used inside an rvm gemset name that includes characther colon ':' - ruby-on-rails-3

I created an rvm gemset name that includes a colon, let's say project:marklar, then I do gem install rails inside that gemset. Everything goes well until it reaches json gem and throw this error:
Fetching: json-1.7.5.gem (100%)
Building native extensions. This could take a while...
/Users/username/.rvm/rubies/ruby-1.9.3p0/lib/ruby/site_ruby/1.9.1/rubygems/ext/builder.rb:48: warning: Insecure world writable dir /usr/local/mysql/bin in PATH, mode 040777
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/Users/username/.rvm/rubies/ruby-1.9.3-p0/bin/ruby extconf.rb
creating Makefile
make
Makefile:158: *** target pattern contains no `%'. Stop.
I thought it was the ruby version that causes the problem, but when I changed into 1.9.2, it still throw the same error.
I used mac osx 10.8 mountain lion, surprisingly, when I removed the colon in the gemset name, let's say we changed it to marklar, everything goes well. Anyone noticed this behavior? Is this behavior expected or is it a bug in rvm, or in the json gem, or else?

I have compared Makefile defined in 1.9.3 and in 1.9.3#some:colon - there is no difference except the paths:
127,128c127,128
< RUBYLIBDIR = /home/mpapis/.rvm/gems/ruby-1.9.3-p194/gems/json-1.7.5/lib$(target_prefix)
< RUBYARCHDIR = /home/mpapis/.rvm/gems/ruby-1.9.3-p194/gems/json-1.7.5/lib$(target_prefix)
---
> RUBYLIBDIR = /home/mpapis/.rvm/gems/ruby-1.9.3-p194#some:colon/gems/json-1.7.5/lib$(target_prefix)
> RUBYARCHDIR = /home/mpapis/.rvm/gems/ruby-1.9.3-p194#some:colon/gems/json-1.7.5/lib$(target_prefix)
after further checking I found that space and colon are not allowed in file names: Escaping colons in filenames in a Makefile => http://www.mail-archive.com/bug-make#gnu.org/msg03318.html

Related

Capistrano: cannot load such file -- rvm/capistrano (LoadError)

This is really bugging me as there is a bit (not a lot) on the internet about the following error when running cap deploy:cold
cannot load such file -- rvm/capistrano (LoadError)
The solution seems to be gem install rvm-capistrano. Everyone else says installing that gem fixed the error, but for me it does nothing.
The offending lines are:
# Add RVM's lib directory to the load path.
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
# Load RVM's capistrano plugin.
require "rvm/capistrano"
set :rvm_ruby_string, ENV['GEM_HOME'].gsub(/.*\//,"")
set :rvm_type, :user
###
You should remove the following line too.
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
That, and installing the rvm-capistrano gem solved similar issue for me.

Missing linux/types.h failing to install gem

I'm getting an error trying to install eventmachine on my ubuntu 12.04 server. Any ideas?
bundle exec gem install eventmachine
Building native extensions. This could take a while...
ERROR: Error installing eventmachine:
ERROR: Failed to build gem native extension.
/opt/ruby-enterprise-1.8.7-2012.02/bin/ruby extconf.rb
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... no
checking for inotify_init() in sys/inotify.h... yes
checking for writev() in sys/uio.h... yes
checking for rb_thread_check_ints()... no
checking for rb_time_new()... yes
checking for sys/event.h... no
checking for epoll_create() in sys/epoll.h... yes
creating Makefile
make
g++ -I. -I/opt/local/include -I. -I/opt/ruby-enterprise-1.8.7-2012.02/lib/ruby/1.8/i686-linux -I. -DWITH_SSL -DBUILD_FOR_RUBY -DHAVE_INOTIFY_INIT -DHAVE_INOTIFY -DHAVE_WRITEV -DHAVE_WRITEV -DHAVE_RB_TIME_NEW -DOS_UNIX -DHAVE_EPOLL_CREATE -DHAVE_EPOLL -D_FILE_OFFSET_BITS=64 -fPIC -g -O2 -c binder.cpp
In file included from /usr/include/i386-linux-gnu/bits/sigcontext.h:28:0,
from /usr/include/signal.h:339,
from project.h:40,
from binder.cpp:20:
/usr/include/i386-linux-gnu/asm/sigcontext.h:5:25: fatal error: linux/types.h: No such file or directory
compilation terminated.
make: *** [binder.o] Error 1
I've just run into the same problem. Either the path for types.h is different on your distribution, or it does not exist at all. Try to manually include it.
http://linux.die.net/include/sys/types.h
Your program is going to give you a file, and line number error where it is trying to "include" types.h. What I did to solve the problem, was add types.h into the same folder as the file requesting it. Then you go into the file, on the line that the include error is, and replace the path of (for example) "/linux/types.h", with "types.h" since you have it in the same directory. Now, make, make install. If you receive another include issue, you might want to consider either changing flavors, or if you feel up to it, keep adding includes. Welcome to the wonderful world of hacking. :)

Heroku paypal_adaptive gem setup

I have paypal_adaptive gem on my local development machine working. But when deployed heroku throws me error that:
ArgumentError: syntax error on line 20, col 2: ` ssl_cert_file:'
/usr/ruby1.9.2/lib/ruby/1.9.1/syck.rb:135:in `load'
/usr/ruby1.9.2/lib/ruby/1.9.1/syck.rb:135:in `load'
/app/.bundle/gems/ruby/1.9.1/bundler/gems/paypal_adaptive-a3853ca1635b/lib/paypal_adaptive/config.rb:32:in `load
I tried with and without line "ssl_cert_file:" in YML file and variables are saved to ENV variables to Heroku. I suspect that gem can't find YML file. How to force gem to find that YML file.
I sent a fix related to this that has been pulled in. http.rb can't handle non strings
See: https://github.com/tc/paypal_adaptive/commit/3e94637d56959994dc4c57186209f071fecc46bb
The gem just needs a version bump.

Capistrano can't find a JavaScript runtime

I have a problem with Capistrano deploying to a server with RVM and gemsets
executing `deploy:assets:precompile'
* executing "cd /var/app/releases/20111229233555 && rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile"
*** [err ::] rake aborted!
*** [err ::] Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes.
*** [deploy:update_code] rolling back
failed: "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell '1.9.2#mygemset' -c 'cd /var/app/releases/20111229234715 && rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile'"
This is my Capfile
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require 'rvm/capistrano'
set :rvm_bin_path, "$HOME/.rvm/bin"
set :rvm_ruby_string, '1.9.2#mygemset'
set :rvm_type, :user
load 'deploy/assets'
When I log in as the very same user which is used by Capistrano the failing command is executed without any problems.
It seems that Capistrano is using some other environment.
Here is my ~/.rvmrc file:
rvm_gemset_create_on_use_flag=1 rvm_trust_rvmrcs_flag=1
Is there a way how to check which ruby and gemset is used at the execution time?
node.js is and V8 are installed on the system, and all needed gems are in Gemfile:
here is my rvm info:
ruby:
interpreter: "ruby"
version: "1.9.2p290"
date: "2011-07-09"
platform: "x86_64-linux"
patchlevel: "2011-07-09 revision 32553"
full_version: "ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]"
homes:
gem: "/home/capistrano/.rvm/gems/ruby-1.9.2-p290#mygemset"
ruby: "/home/capistrano/.rvm/rubies/ruby-1.9.2-p290"
binaries:
ruby: "/home/capistrano/.rvm/rubies/ruby-1.9.2-p290/bin/ruby"
irb: "/home/capistrano/.rvm/rubies/ruby-1.9.2-p290/bin/irb"
gem: "/home/capistrano/.rvm/rubies/ruby-1.9.2-p290/bin/gem"
rake: "/home/capistrano/.rvm/gems/ruby-1.9.2-p290#mygemset/bin/rake"
setting up PATH in the deploy.rb solved this issue:
default_environment['PATH'] = "/usr/local/bin:/usr/bin:/bin:/opt/bin:$PATH"
it's a Gentoo distribution and the PATH var seems to be empty when using cap deploy, so I copied the content of server PATH and now it works
This issue went away for me when I installed nodejs (using apt-get) on my server. As I stated in this Stackoverflow answer, it's the most practical choice because you don't need to include any dependencies in your Gemfile.

rubber stuck compiling ruby

for some reason whenever i try to spawn a server with rubber it gets stuck after compiling ruby-1.9.2.
If I SSH into the server, I see that before it finishes compiling, almost at the very end, the rubber script disconnects the connection.
** [out :: stageone.foo.com] ruby-1.9.2-p0 - #compiling
If I try to do cap rubber:bootstrap it fails at trying to install mongrel citing that my ruby installation might not be complete.
Fetching: mongrel-1.1.5.gem (100%)39%)
** Building native extensions. This could take a while...
** ERROR: Error installing mongrel:
** ERROR: Failed to build gem native extension.
**
** /usr/local/rvm/rubies/ruby-1.9.2-p0/bin/ruby extconf.rb
I'm trying to create a staging server using the "complete_mongrel_mysql" script.
any ideas?
Explanation is on the mailing list:
https://groups.google.com/d/msg/rubber-ec2/K-ahRFZpAAk/2fTJI5EeURwJ
Workaround checked into code for next release at:
https://github.com/wr0ngway/rubber/commit/64299e2005dcae9006273a6f915bf01dd8c87192