alternative to ruby aws-s3 - ruby

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.

Related

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.

Bourbon Bitters error after installation

I would give a try to bourbon sass framework, so I start installing it.
As I want to use it along with yeoman/angular-generator I had to downgrade Bourbon to v3.2.1 and Neat to v1.5 to avoid compiling error.
After downgrading no problem, they are working fine.
Now I would like to add Bitters, so, following the docs I run:
$ sudo gem install bitters
as output I got as expected
Successfully installed bitters-0.10.0
1 gem installed
Installing ri documentation for bitters-0.10.0...
Installing RDoc documentation for bitters-0.10.0...
then I moved to sass folder and when I try to run:
$ bitters install
I get this error output:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': /Library/Ruby/Gems/1.8/gems/bitters-0.10.0/lib/bitters/generator.rb:13: syntax error, unexpected ':', expecting kEND (SyntaxError)
method_options path: :string
^
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /Library/Ruby/Gems/1.8/gems/bitters-0.10.0/bin/../lib/bitters.rb:2
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /Library/Ruby/Gems/1.8/gems/bitters-0.10.0/bin/bitters:3
from /usr/bin/bitters:19:in `load'
from /usr/bin/bitters:19
I get the same running bitters -v
Any Idea on how to solve this?
Thanks
Looks like you use old Ruby version 1.8 but gem bitters need version after 1.9 this indicate path: :string new hash syntax instead old rocket hash :path => :string. Update Ruby to >= 1.9.
And look in bitters gem requirements:
Ruby 1.9.3+

Problems with ruby 'unroller' gem

I'm having a problem using unroller. I have installed the gem and wrote this simple program to help focus on the problem i'm having:
#!/usr/bin/ruby
require 'rubygems'
require 'unroller'
Unroller::trace
def foo(p1, p2)
puts p1
puts p2
end
foo("param1", "param2")
Running the program yields:
/Library/Ruby/Gems/1.8/gems/facets-2.9.3/lib/core/facets/filetest/separator_pattern.rb:5: warning: already initialized constant SEPARATOR_PATTERN
/Library/Ruby/Gems/1.8/gems/facets-2.9.3/lib/core/facets/string/bracket.rb:3: warning: already initialized constant BRA2KET
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `gem_original_require': no such file to load -- facets/methodspace (LoadError)
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require'
from /Library/Ruby/Gems/1.8/gems/unroller-1.0.0/lib/unroller.rb:4
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:60:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:60:in `require'
from ./ut:4
My ruby version is ruby 1.8.7 (2011-12-28 patchlevel 357). I also installed ruby on my Windows development box and get the same error and that ruby version is 1.9.3 so it does not appear to be related to the version of Ruby I'm on.
Anyone have any ideas?
Thanks very much in advance!
jon
This is a bug of unroller gem, described here: https://github.com/TylerRick/unroller/issues/1. unroller automatically requires the latest version of facets gem and the version 2.9 breaks it. (BTW gems should never use '>=' when loading dependencies, that's why '~>' is for.)
It's not that difficult to hotfix locally by using bundler and hardcoding facets gem to specific version before requiring unroller (so the specific facets version gets loaded instead of latest 2.9).
create Gemfile:
source 'http://rubygems.org'
gem 'facets', '2.8.4'
gem 'termios' # you're gonna need this gem too, for some reason
gem 'unroller'
run bundle install and then either run the script by bundle exec ruby test.rb or require bundler/setup in it:
require 'rubygems'
require 'bundler/setup'
require 'unroller'
...
UPDATE: or if you don't wanna deal with bundler, try this first, it could work too:
require 'rubygems'
gem 'facets', '2.8.4'
require 'unroller'
...

couch_potato : no such file to load -- json/add/rails

When I 'require' the couch_potato gem, I get the following error:
LoadError: no such file to load -- json/add/rails
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:59:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:59:in `require'
from /Library/Ruby/Gems/1.8/gems/couch_potato-0.5.7/lib/couch_potato.rb:4
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:59:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:59:in `require'
from (irb):1
I'm not particularly experienced with Ruby yet so took a shotgun type approach and uninstalled all my gems, then reinstalled starting with couch_potato. The json gem is a requirement so the latest version was installed automatically. But this issue has persisted.
I thought maybe this part of rails (because 'rails' is in the error ... it seems like a long shot but as mentioned I'm very new to Ruby and not completely sure how gems work yet :)) but the install ended abruptly after the following few lines (these are the last few lines after a very long list):
Installing RDoc documentation for rack-ssl-1.3.2...
Installing RDoc documentation for rdoc-3.9.4...
Installing RDoc documentation for railties-3.1.0...
Installing RDoc documentation for bundler-1.0.18...
Installing RDoc documentation for rails-3.1.0...
file 'lib' not found
But anyway I went looking for the missing file. In the gem folder (/Library/Ruby/Gems/1.8/gems/json-1.1.9) there is 'lib' then 'json/add' which is a minor victory, but there is no 'rails' file in there.
At this point I checked my laptop ... there is an older version of 'json', but the file 'json/add/rails' does exist in that older gem.
What is my best option at this point? Is there a different version of couch_potato I should be using? Can I make couch_potato use the older json gem version?
You need to install the JSON gem.
$ gem install json
Actually, the json/add/rails file is deprecated by the JSON library
# This file used to implementations of rails custom objects for
# serialisation/deserialisation and is obsoleted now.
unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
require 'json'
end
$DEBUG and warn "required json/add/rails which is obsolete now!"
but it seems couch_potato has not been updated and the require is still in place.

gem-install of mongoid throws an uninitialized constant in Ruby, works in irb

I am writing a script with Ruby/MongoDB that stores Tweets. After I gem-installed mongoid, this first-steps code throws an error:
require 'rubygems'
require 'mongo'
require 'mongoid'
Mongoid.database = Mongo::Connection.new('localhost').db('db')
# snippet from http://rujmah.posterous.com/using-mongoid-without-rails
NB. This is no Rails app, but a Terminal script.
The error I get is:
./mongoid.rb:10: uninitialized constant Mongoid (NameError)
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require'
from mongoid.rb:3
It works in irb and I'm running ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0].
What am I doing wrong?
Edit August 2012
Somehow I got it to work. Alas, nearly a year on, I really can’t remember how. I will try to do better next time.
I hit the same issue while trying to get Bullet gem to work. The solution for me was to simply move gem 'mongoid', github: 'mongoid/mongoid' as the first line of the Gemfile. I find it really odd but that was how I got rid of that error.
I am using Ruby 2.1.0 and Rails 4.0.0

Resources