Class: App

Inherits:
Thor
  • Object
show all
Includes:
Utils::MyLogger
Defined in:
lib/cli/aws-must-cli.rb

Constant Summary collapse

PROGNAME =

logger progname

"main"
DEAFAULT_TEMPLATE =

default values

"root"
DEFAUL_FOLD_ON =

default output for +++fold-on+++ tag

"<div class='fold'>Check to show template: <input type='checkbox' class='toggle'/><div>"
DEFAUL_FOLD_OFF =

default output for +++fold-off+++ tag

"</div></div>"

Constants included from Utils::MyLogger

Utils::MyLogger::LOGFILE

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utils::MyLogger

#getLogger

Constructor Details

#initialize(*args) ⇒ App

Returns a new instance of App.



41
42
43
44
# File 'lib/cli/aws-must-cli.rb', line 41

def initialize(*args)
  super
  @logger = getLogger( PROGNAME, options )
end

Class Method Details

.add_shared_option(name, options = {}) ⇒ Object



27
28
29
30
# File 'lib/cli/aws-must-cli.rb', line 27

def add_shared_option(name, options = {})
  @shared_options = {} if @shared_options.nil?
  @shared_options[name] =  options
end

.shared_options(*option_names) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/cli/aws-must-cli.rb', line 32

def shared_options(*option_names)
  option_names.each do |option_name|
    opt =  @shared_options[option_name]
    raise "Tried to access shared option '#{option_name}' but it was not previously defined" if opt.nil?
    option option_name, opt
  end
end

Instance Method Details

#ddoc(pattern) ⇒ Object



139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/cli/aws-must-cli.rb', line 139

def ddoc( pattern )

  @logger.info( "#{__method__} starting, options '#{options}'" )


  files = Dir.glob( pattern ).sort
  files.each do |file|
    @logger.debug( "#{__method__}, file '#{file}'" )
    fileProvider = AwsMust::FileProvider.new( options )
    docu = AwsMust::Docu.new( fileProvider, options )
    docu.document( file )
  end
  
end

#doc(template_name = DEAFAULT_TEMPLATE) ⇒ Object



118
119
120
121
122
123
124
125
126
127
128
# File 'lib/cli/aws-must-cli.rb', line 118

def doc( template_name=DEAFAULT_TEMPLATE )

  @logger.info( "#{__method__} starting" )

  
  my_options = option_adjust_common( options )

  app = ::AwsMust::AwsMust.new( my_options )
  app.doc( template_name )

end

#gen(yaml_file, template_name = DEAFAULT_TEMPLATE) ⇒ Object



224
225
226
227
228
229
230
231
# File 'lib/cli/aws-must-cli.rb', line 224

def gen( yaml_file, template_name=DEAFAULT_TEMPLATE )

  my_options = option_adjust_common( options )

  app = ::AwsMust::AwsMust.new( my_options )
  app.generate( template_name, yaml_file, my_options )

end

#json(yaml_file, with_adjust = "true") ⇒ Object



197
198
199
200
201
202
# File 'lib/cli/aws-must-cli.rb', line 197

def json( yaml_file, with_adjust="true" )

  app = ::AwsMust::AwsMust.new( options )
  app.json( yaml_file, with_adjust =~ /^true$/ || with_adjust =~ /^yes$/  ? true : false  )

end