Class: Testcloud::Generator::Commands::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/testcloud/generator/commands/base.rb

Direct Known Subclasses

Gem

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}, thor) ⇒ Base

Returns a new instance of Base.



9
10
11
12
13
# File 'lib/testcloud/generator/commands/base.rb', line 9

def initialize(options = {}, thor)
  @options = options
  @thor = thor
  @template_options = {}
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



8
9
10
# File 'lib/testcloud/generator/commands/base.rb', line 8

def options
  @options
end

#parsed_optionsObject (readonly)

Returns the value of attribute parsed_options.



7
8
9
# File 'lib/testcloud/generator/commands/base.rb', line 7

def parsed_options
  @parsed_options
end

#template_optionsObject (readonly)

Returns the value of attribute template_options.



7
8
9
# File 'lib/testcloud/generator/commands/base.rb', line 7

def template_options
  @template_options
end

#thorObject (readonly)

Returns the value of attribute thor.



7
8
9
# File 'lib/testcloud/generator/commands/base.rb', line 7

def thor
  @thor
end

Instance Method Details

#abort_command(msg = nil) ⇒ Object



31
32
33
34
# File 'lib/testcloud/generator/commands/base.rb', line 31

def abort_command(msg = nil)
  $stdout.printf "aborting %s ...\n" % msg.to_s
  exit(1)
end

#confirmation_promptObject



15
16
# File 'lib/testcloud/generator/commands/base.rb', line 15

def confirmation_prompt
end

#execute_commandObject



23
24
25
# File 'lib/testcloud/generator/commands/base.rb', line 23

def execute_command
  raise 'Implement'
end

#readlineObject



27
28
29
# File 'lib/testcloud/generator/commands/base.rb', line 27

def readline
  $stdin.gets.chomp!
end

#runObject



18
19
20
21
# File 'lib/testcloud/generator/commands/base.rb', line 18

def run
  confirmation_prompt
  execute_command
end