diff --git a/lib/transrate/cmdline.rb b/lib/transrate/cmdline.rb index 9460463..2f1d48b 100644 --- a/lib/transrate/cmdline.rb +++ b/lib/transrate/cmdline.rb @@ -79,7 +79,8 @@ def argument_parser "Log level. One of [error, info, warn, debug]", :default => 'info' opt :install_deps, - "Install any missing dependencies. One of [all, read, ref]", + "Install any missing dependencies. One of " + + "[#{cmdline.allowed_deps.join(', ')}]", :type => String, :default => nil opt :examples, "Show some example commands with explanations" end @@ -258,10 +259,19 @@ def check_dependencies end # check_dependencies + def allowed_deps + binkey = 'TRANSRATE_PACKAGED_BINARY' + if ENV.has_key?(binkey) && ENV[binkey] == 'true' + return ['read'] + else + return ['read', 'ref', 'all'] + end + end + def check_install_command - unless %w[all read ref].include? @opts.install_deps + unless allowed_deps.include? @opts.install_deps msg = "install-deps #{@opts.install_deps} is not valid. " + - "You must specify one of: all, read, ref." + "You must specify one of: #{allowed_deps.join(', ')}." raise TransrateError.new(msg) end end diff --git a/packaging/transrate b/packaging/transrate index 51e2661..89825b8 100755 --- a/packaging/transrate +++ b/packaging/transrate @@ -13,5 +13,8 @@ export DYLD_FALLBACK_LIBRARY_PATH=$SELFDIR/lib:$DYLD_FALLBACK_LIBRARY_PATH export BUNDLE_GEMFILE="$SELFDIR/lib/app/Gemfile" unset BUNDLE_IGNORE_CONFIG +# Tell transrate this is the packaged version +export TRANSRATE_PACKAGED_BINARY=true + # Run the actual app using the bundled Ruby interpreter, with Bundler activated. exec "$SELFDIR/lib/app/ruby/bin/ruby" -rbundler/setup "$SELFDIR/lib/app/bin/transrate" $@