Install/Update RubyGems on Mac 10.5.8 - ruby

I'm trying to update my Rubygems on a mac OSX 10.5.8. Currently running 1.0.1. I've downloaded v.8.24 from https://rubygems.org/pages/download .
As they say CD'd to the unzipped folder and than this came out:
macbook-10:~ sergehonderdos$ cd ~/Desktop/rubygems-1.8.24
macbook-10:rubygems-1.8.24 sergehonderdos$ sudo ruby setup.rb
Password:
./lib/rubygems.rb:335: warning: parenthesize argument(s) for future version
./lib/rubygems.rb:517: warning: parenthesize argument(s) for future version
./lib/rubygems.rb:32:in `require': ./lib/rubygems/deprecate.rb:54: syntax error, unexpected ',', expecting '|' (SyntaxError)
... define_method name do |*args, &block| # TODO: really works ...
^
./lib/rubygems/deprecate.rb:55: syntax error, unexpected tCONSTANT, expecting '}'
./lib/rubygems/deprecate.rb:64: syntax error, unexpected kEND, expecting '}'
./lib/rubygems/deprecate.rb:69: syntax error, unexpected kEND, expecting '}'
from ./lib/rubygems.rb:32
from setup.rb:27:in `require'
from setup.rb:27
macbook-10:rubygems-1.8.24 sergehonderdos$ gem -v
1.0.1
The reason I try to update is to install compass.
I have no idea what went wrong, any solutions?

I was able to reproduce this behavior by installing ruby 1.8.6 on my machine installed with rvm. Confirms that rubygems 1.8.24 version is not compatible with ruby 1.8.6 version.
There might be some way to install a previous version of rubygems which is compatible with 1.8.6., but I expect that to be a complicated task. Most ruby components would have moved ahead to be compatible with newer versions of ruby (either 1.8.7 or 1.9.3)
Best way to deal with this would be to upgrade the ruby version.

Related

ruby missing psych/versions

I upgrade fedora from 25 to 26, and then ruby(2.4.1) have an error with psych.
usr/share/ruby/yaml.rb:5:in `<main>': It seems your ruby installation
is missing psych (for YAML output). To eliminate this warning, please
install libyaml and reinstall your ruby. rake aborted! LoadError:
cannot load such file -- psych/versions
But I can import psych/versions in irb.
irb(main):002:0> require 'psych/versions'
=> true
irb(main):003:0>
I have tried to reinstall ruby but the problem is as well.
I run the same code in yaml.rb near line 5 with irb. Nothing is wrong.
The question is on gitlab after I update my system. So I suppose the code is right and the reason is in myself.

Ruby returns syntax errors when referencing Net::SSH

I've the following installed:
Ruby version 1.8.7
Net::SSH 2.10.0
I get the following error when I run my script:
/usr/lib/ruby/site_ruby/1.8/net/ssh/authentication/session.rb:4:in `require': /usr/lib/ruby/site_ruby/1.8/net/ssh/authentication/key_manager.rb:199: syntax error, unexpected ':', expecting ')' (SyntaxError)
identity.merge(privkey_file: file)
^
/usr/lib/ruby/site_ruby/1.8/net/ssh/authentication/key_manager.rb:266: syntax error, unexpected $end, expecting kEND
from /usr/lib/ruby/site_ruby/1.8/net/ssh/authentication/session.rb:4
from /usr/lib/ruby/site_ruby/1.8/net/ssh.rb:11:in `require'
from /usr/lib/ruby/site_ruby/1.8/net/ssh.rb:11
from test.rb:1:in `require'
from test.rb:1
Do you know why this error has been thrown?
The net-ssh gem doesn't support 1.8.7 anymore. The posted line uses hash syntax that was added in 1.9 (it's equivalent to :privkey_file => file). According to its README the last version with 1.8 support is 2.5.1. You can install this old version with gem install net-ssh -v 2.5.1 but make sure to remove the newer version you've installed.

sinatra app on localhost via unicorn: syntax error

I have a Sinatra app that I continually upgrade (local only, at the moment). Problem being that I know nothing at all about Ruby — my friend made me the app and it's worked beautifully for over almost a year.
To see the site on localhost, I do this:
bundle exec unicorn -l 9000
I don't understand this, haven't needed to. I know I'm using the unicorn gem to run the app directed at port 9000 (due to an old printer conflict).
Today, I get this error:
in `evaluate': compile error (SyntaxError)
syntax error, unexpected ':', expecting $end
which refers to line 16 of my gem file, the sinatra-contrib gem:
gem "sinatra-contrib", require: "sinatra/reloader"
I've never had this error before. Haven't ever touched the gem file, and it's been working for a year. The only thing I can think I've done recently that may have affected my environment is installing a gemset called Wordless:
rvm use 1.8.7#wordless --create --default && gem install therubyracer sprockets compass coffee-script thor yui-compressor && rvm wrapper 1.8.7#wordless wordless compass ruby
I'd appreciate insights, and hopefully I can start to learn a thing or two about managing ruby gems. Thanks.
You were using Ruby 1.9 before. The line you referenced is in 1.9 format, which Ruby 1.8 does not understand.
When you installed Wordless you said:
rvm use 1.8.7#wordless --create --default
This made Ruby 1.8.7 your default interpreter. To switch back to whatever you used before do:
rvm list rubies
And then:
rvm use [the 1.9.x you found in the list above] --default

Invalid argument error installing 'ruby-box' gem

Any ideas why I get this error when trying to install the ruby-box gem?
C:\>gem install ruby-box
ERROR: While executing gem ... (Errno::EINVAL)
Invalid argument - C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/ruby-box-1.2.0/spec/fixtures/i☺ e?↨f§↓.jpg
It seems to be complaining about the ruby-box-master\spec\fixtures\遠志教授.jpg file, which is not written in English.
You should probably move to the newer ruby SDK: https://github.com/attachmentsme/ruby-box
It is all built on the V2 API. V1 API will be shut down at the end of 2013.
Update ruby-box to 1.2.1 (still need to test it)

alternative to ruby aws-s3

Is there alternative to ruby aws-s3.
I've installed aws-s3 (gem install aws-s3) but got error when i run my script
ruby s3Metadata.rb
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
'gem_original_require': /usr/lib/ruby/gems/1.8/gems/builder-3.1.4/lib/builder/xmlbase.rb:183:
syntax error, unexpected ',', expecting '|' (SyntaxError)
define_method(sym) do |*args, &block|
^
/usr/lib/ruby/gems/1.8/gems/builder-3.1.4/lib/builder/xmlbase.rb:192: syntax error, unexpected kEND, expecting $end from /usr/local/lib/site_ruby/1.8/rubygems /custom_require.rb:31:in 'require'
from /usr/lib/ruby/gems/1.8/gems/builder-3.1.4/lib/builder/xmlmarkup.rb:14
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in 'gem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in 'require'
from /usr/lib/ruby/gems/1.8/gems/builder-3.1.4/lib/builder.rb:12
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in 'gem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in 'require'
from /usr/lib/ruby/gems/1.8/gems/aws-s3-0.6.3/lib/aws/s3/extensions.rb:159:in 'require_library_or_gem'
from /usr/lib/ruby/gems/1.8/gems/aws-s3-0.6.3/lib/aws/s3.rb:12
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in 'gem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in 'require'
from s3Metadata.rb:4`
s3Metadata.rb:4 = `require 'aws/s3'
Googled it but no solution....
I need to run script to update/add some metadata in amazon S3.
aws-s3 (0.6.3)
have old version of ruby ruby 1.8.6 (2007-09-24 patchlevel 111) [x86_64-linux]
I can't upgrade it will mess up a lot of stuff. Is there a solution or alternative to ruby aws-s3?
The Rightscale AWS gem also has s3 support.
Amazon provides their own gem called aws-sdk. I can't promise it works in 1.8.6, with such an ancient version of Ruby I think your best bet is installing a very early version of any gem, since many will have moved to 1.9 in more recent versions.

Resources