Class: Meroku::CLI::Session
- Inherits:
-
Object
- Object
- Meroku::CLI::Session
- Includes:
- Meroku::CLI, Help
- Defined in:
- lib/meroku/cli/session.rb
Overview
A session is what is created when user executes the meroku command
Instance Method Summary collapse
-
#initialize(args) ⇒ Session
constructor
A new instance of Session.
- #process_admin_command(arguments) ⇒ Object
- #process_user_login_command(arguments) ⇒ Object
- #process_user_other_command(arguments) ⇒ Object
Methods included from Help
Methods included from Meroku::CLI
#add_git_remote, #apiusername, #create, #despawn, #keys_add, #login, #logout, #save_setting, #signup, #spawn
Methods included from Aws::Ec2
associate_address, #ec2_client, ec2_client, #make_instance, #tag
Constructor Details
#initialize(args) ⇒ Session
Returns a new instance of Session
8 9 10 11 12 13 14 |
# File 'lib/meroku/cli/session.rb', line 8 def initialize(args) processed = process_user_login_command(args.join(' ')) || process_user_other_command(args.join(' ')) || process_admin_command(args.join(' ')) puts "Unknown command #{args.join(' ')}\n\n#{help}" unless processed exit 1 unless processed end |
Instance Method Details
#process_admin_command(arguments) ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/meroku/cli/session.rb', line 36 def process_admin_command(arguments) case arguments when 'infrastructure spawn' spawn when 'infrastructure despawn' despawn end end |
#process_user_login_command(arguments) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/meroku/cli/session.rb', line 16 def process_user_login_command(arguments) case arguments when /\Asignup/ signup when 'logout' logout when 'login' login end end |
#process_user_other_command(arguments) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/meroku/cli/session.rb', line 27 def process_user_other_command(arguments) case arguments when 'create' create when 'keys:add' keys_add end end |