bin/ciinabox-ecs.rb in ciinabox-ecs-0.2.2 vs bin/ciinabox-ecs.rb in ciinabox-ecs-0.2.4
- old
+ new
@@ -16,12 +16,14 @@
app.init
app.load_rakefile
actions = app.tasks.map { |t| t.name.gsub('ciinabox:', '') }
+ required_args_size = ENV.key?('CIINABOX') ? 1 : 2
+
if (args.size() ==0) or
- (args.size() < 2 and (not %w(init full_install).include? args[0])) or
+ (args.size() < required_args_size and (not %w(init full_install).include? args[0])) or
(args[0] == 'help') or
(not actions.include? args[0])
STDERR.puts("Usage: ciinabox-ecs action1 action2 action3 ciinabox_name")
STDERR.puts("Valid actions:")
STDERR.printf("%-20s |%-20s\n\n", 'name', 'description')
@@ -31,12 +33,14 @@
exit 0 if args[0] == 'help'
exit -1
end
methods = args[0..args.size()-2]
- ciinabox_name = args[args.size()-1]
- ENV['CIINABOX'] = ciinabox_name
+ unless ENV.key? 'CIINABOX'
+ ciinabox_name = args[args.size()-1]
+ ENV['CIINABOX'] = ciinabox_name
+ end
if ENV.key? 'CIINABOXES_DIR'
ENV['CIINABOXES_DIR'] = File.expand_path(ENV['CIINABOXES_DIR'])
else
ENV['CIINABOXES_DIR'] = old_pwd