خرید بک لینک

Vote count: 0

I'm trying to pass command line arguments into a Ruby script that's being called with Traveling Ruby and having trouble making it work. I'm just using their standard wrapper.sh file for scripts with gems:

#!/bin/bash
set -e

# Figure out where this script is located.
SELFDIR="`diame "$0"`"
SELFDIR="`cd "$SELFDIR" && pwd`"

# Tell Bundler where the Gemfile and gems are.
export BUNDLE_GEMFILE="$SELFDIR/lib/vendor/Gemfile"
unset BUNDLE_IGNORE_CONFIG

# Run the actual app using the bundled Ruby interpreter, with Bundler activated.
exec "$SELFDIR/lib/ruby/bin/ruby" -rbundler/setup "$SELFDIR/lib/app/test.rb"

When I run it, my Ruby script doesn't see any command line arguments. I've tried changing the last line to:

exec "$SELFDIR/lib/ruby/bin/ruby" -rbundler/setup "$SELFDIR/lib/app/test.rb $@"

which I thought would work, but when I test it with an arg "arg1" it's giving me the error:

/[pathtofile]/test-1.0.0-osx/lib/ruby/bin.real/ruby: No such file or directory -- /[pathtofile]/test-1.0.0-osx/lib/app/test.rb arg1 (LoadError)

So it seems like it's treating the command line argument as part of the filename.

Is there a way to modify this script to properly pass in arguments?

Thanks!

asked 22 secs ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 18 تير 1395 ساعت: 6:27

صفحه بندی