lib/meroku/cli.rb in meroku-2.0.23 vs lib/meroku/cli.rb in meroku-2.0.24
- old
+ new
@@ -12,25 +12,35 @@
@options = {}
end
def run(args = ARGV)
@options = Options.new.parse(args)
+ act_on_user_options
act_on_options
- rescue Meroku::Error => e
- puts "Error: #{e.message}"
+ rescue Meroku::Success
+ return 0
+ rescue StandardError => e
+ print 'Error:'
+ print " #{e.message}" if e.message
+ print " <#{e.class}>\n"
return 2
end
private
def act_on_options
if @options[:meroku_secret]
Meroku::Shared.secrets.meroku_secret = @options[:meroku_secret]
end
Node.new if @options[:spawn]
- User.login(@options[:email], @options[:password]) if @options[:login]
- User.logout if @options[:logout]
Meroku::Aws.terminate_all(tag: 'node') if @options[:despawn]
true
+ end
+
+ def act_on_user_options
+ User.login(@options[:email], @options[:password]) if @options[:login]
+ User.logout if @options[:logout]
+ User.signup(@options[:email], @options[:password]) if @options[:signup]
+ User.unregister(@options) if @options[:unregister]
end
end
end