S3Sync.net

General Category => Feature Requests => Topic started by: cm_gui on February 17, 2007, 05:28:36 PM



Title: s3sync.rb to run without current directory defined to where s3try.rb, S3.rb are.
Post by: cm_gui on February 17, 2007, 05:28:36 PM
Hi Greg

Thank you for the excellent s3sync.rb script.
It is working great for us.   

But we are running s3sync.rb from a bash script, and it would be nice if s3sync.rb is able to run without having to define the working directory to where s3try.rb, S3.rb, etc. are.     

This was actually discussed before -
http://developer.amazonwebservices.com/connect/message.jspa?messageID=46318#46318
http://developer.amazonwebservices.com/connect/message.jspa?messageID=46312#46312

If the working directory is not defined to where the s3sync scripts are, these error messages will appear -
<< /usr/local/etc/s3sync/s3sync.rb:18:in `require': no such file to load -- thread_generator (LoadError)  from /usr/local/etc/s3sync/s3sync.rb:18uuid /usr/local/etc/s3sync/s3cmd.rb:12:in `require': no such file to load -- s3try (LoadError) from /usr/local/etc/s3sync/s3cmd.rb:12 >>

I tried changing the scripts.   For example, changingline 18 in s3sync.rb from "require 'thread_generator'"  to "require '/usr/local/etc/s3sync/thread_generator'", etc.   But this introduced other errors.

If you can modify the scripts so that they can be run from anywhere, that would be great.
Thank you.



Title: Re: s3sync.rb to run without current directory defined to where s3try.rb, S3.rb
Post by: ferrix on February 17, 2007, 10:06:57 PM
Does anyone know whether the "gem" distribution (see home page) solves this issue?  I've never tried it.

If so, then I guess it might be time for me to look into what's needed to distribute the main package as a gem.


Title: Re: s3sync.rb to run without current directory defined to where s3try.rb, S3.rb
Post by: lowflyinghawk on February 18, 2007, 07:31:04 AM
why not set RUBYLIB to point to the library directory?  it is a colon-separated string on linux and semicolon separated on windows (but on windows you can set it permanently via somewhere in My Computer I think).  for example, in bash:

export RUBYLIB=/usr/local/whatever/lib:/home/me/lib


Title: Re: s3sync.rb to run without current directory defined to where s3try.rb, S3.rb
Post by: ferrix on February 19, 2007, 08:15:10 AM
OK the official stance is now to use the RUBYLIB.  I'm still open to the idea of gem-ing, but I don't know anything about it at the moment.


Title: Re: s3sync.rb to run without current directory defined to where s3try.rb, S3.rb
Post by: ryantate on February 22, 2007, 01:16:03 PM
Another possibility is to use the -I option when calling ruby from your shell script, which allows you to specify a ruby lib dir without using an envionment var. My shell script has lines that look like:

ruby -I s3syncDir s3syncDir/s3sync.rb -r --ssl --delete  /home/foo/bin bucketName:home/foo

... and the working dir of my shell script is NOT s3syncDir.

Sorry if this was mentioned previously, but I didn't see it in the AWS thread (just re-skimmed briefly).