Class: GameMachine::Console::Deploy

Inherits:
Object
  • Object
show all
Defined in:
server/lib/game_machine/console/deploy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service, argv) ⇒ Deploy

Returns a new instance of Deploy


6
7
8
9
# File 'server/lib/game_machine/console/deploy.rb', line 6

def initialize(service,argv)
  @options = parse_arguments(argv)
  @service = service
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options


5
6
7
# File 'server/lib/game_machine/console/deploy.rb', line 5

def options
  @options
end

#serviceObject (readonly)

Returns the value of attribute service


5
6
7
# File 'server/lib/game_machine/console/deploy.rb', line 5

def service
  @service
end

Instance Method Details

#parse_arguments(arguments) ⇒ Object


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'server/lib/game_machine/console/deploy.rb', line 11

def parse_arguments(arguments)
  options = {}

  OptionParser.new do |opt|
    opt.banner = "Usage: game_machine deploy [options]"
    opt.on('-n', '--name=name', String, 'Give a name to the bundle') { |v| options[:server] = v.strip }
    
    opt.parse!(arguments)
  end
  
  unless options.has_key?(:name)
    options[:name] = 'default'
  end

  options
end