Class: Sbuilder::Cli
- Inherits:
-
Thor
- Object
- Thor
- Sbuilder::Cli
- Includes:
- Utils::MyLogger
- Defined in:
- lib/cli/cli.rb
Constant Summary collapse
- PROGNAME =
logger progname
"main"- VERSION_BANNER =
<<-EOS.unindent #{File.basename $0} - #{Sbuilder::version} EOS
Constants included from Utils::MyLogger
Class Method Summary collapse
Instance Method Summary collapse
- #document(what = nil) ⇒ Object
- #extend ⇒ Object
- #generate(setupDirectory = nil) ⇒ Object
- #init ⇒ Object
-
#initialize(*args) ⇒ Cli
constructor
—————————————————————— constructore.
- #list(what) ⇒ Object
- #version ⇒ Object
Methods included from Utils::MyLogger
Constructor Details
Class Method Details
.add_shared_option(name, options = {}) ⇒ Object
22 23 24 25 |
# File 'lib/cli/cli.rb', line 22 def add_shared_option(name, = {}) @shared_options = {} if @shared_options.nil? @shared_options[name] = end |
.shared_options(*option_names) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/cli/cli.rb', line 27 def (*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? yield option_name, opt if block_given? option option_name, opt end end |
Instance Method Details
#document(what = nil) ⇒ Object
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/cli/cli.rb', line 197 def document( what=nil ) controller = getCtrl controller.load validateWhats( what, getSetupNames(controller) ) if what invariants = controller.templateData('invariants')['invariants'] puts "INVARIANTS:" invariants.each do |invariant| puts <<-EOS.unindent - #{invariant[:name]}: #{invariant[:desc]} EOS end puts "SETUPS:" controller.processSetups( what ) do |setupName, setupConf, possibilities| assumptions = controller.getSetupAssumptionList( setupConf ) puts <<-EOS.unindent - #{setupName}: #{setupConf['desc']} - possibilities: #{(setupConf['possibilities'] || [] ).join( ' ' )} - assumptions: #{assumptions.join( ' ' )} - interfaces: #{controller.templateData('steps' )['steps'].map {|step| step[:interface_operation] }.uniq.join( ' ' )} EOS end end |
#extend ⇒ Object
121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/cli/cli.rb', line 121 def extend() Dir.glob( File.join File.dirname( __FILE__), "../../src-extend/extend/extend_*.*" ).each do |extendTemplate| extend_files( "#{[:src_dir]}/extend", extendTemplate, [:benchmark] ) end Dir.glob( File.join File.dirname( __FILE__), "../../src-extend/extend_app/*" ).each do |extendTemplate| extend_files( "#{[:src_dir]}", extendTemplate ) end end |
#generate(setupDirectory = nil) ⇒ Object
175 176 177 178 |
# File 'lib/cli/cli.rb', line 175 def generate( setupDirectory=nil) ctrl = getController( ) ctrl.setup( setupDirectory ) end |
#init ⇒ Object
150 151 152 153 154 155 156 |
# File 'lib/cli/cli.rb', line 150 def init() init_dirs( ) init_files( ) end |
#list(what) ⇒ Object
186 187 188 189 190 191 |
# File 'lib/cli/cli.rb', line 186 def list( what ) validateWhats( what ) ctrl = getCtrl # puts "#{ctrl.getSetups().map { |setup| setup['setupDirectory']}.join(' ')}" puts "#{getSetupNames(ctrl).join(' ')}" end |
#version ⇒ Object
137 138 139 |
# File 'lib/cli/cli.rb', line 137 def version() puts VERSION_BANNER end |