Class: TemplateBuilder::App::Show

Inherits:
Command
  • Object
show all
Defined in:
lib/template_builder/app/show.rb

Instance Attribute Summary

Attributes inherited from Command

#config, #stderr, #stdout

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

#ask_for, #force, inherited, #initialize, #name, #priority, #run_framework, #special_case_data_mapper, standard_options, #standard_options, #standard_parameters, standard_parameters, #verbose?

Constructor Details

This class inherits a constructor from TemplateBuilder::App::Command

Class Method Details

.initialize_showObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/template_builder/app/show.rb', line 3

def self.initialize_show
  synopsis 'template_builder show [framework] [plugin]'

  summary 'Show all kind of awesome framework available .'

  description <<-__
Show all kind of awesome framework available you can use with template builder
and for each type, can show you a description of all plugin available
  __
   
  FileAnalyzer.all_parameters.each {|item| 
    parameter(item.to_s)
  }
   option(standard_options[:verbose])
end

Instance Method Details

#annouce(array) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/template_builder/app/show.rb', line 41

def annouce(array)
  msg = "All frameworks available are : \n"
  array.each { |item|  msg += "\t#{item}\n"}
  msg += "\n"
  msg += "You can show detail of one plugin by running :\n template_builder show framework plugin"
  puts msg
end

#parse(args) ⇒ Object



31
32
33
34
35
36
37
38
39
# File 'lib/template_builder/app/show.rb', line 31

def parse( args )
  opts = super args
  config[:name] = args.empty? ? nil : args.join('_')
  if name.nil?
    stdout.puts opts
    exit 1
  end
  @param = opts.parse! args
end

#runObject



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/template_builder/app/show.rb', line 19

def run
 type = @param.shift
 array =  FileAnalyzer.all_frameworks_for(type)
 if @param.length == 0
   annouce array
 else
   plugin = @param.shift
   framework = FileAnalyzer.load_framework :type=>type, :name=>plugin
   puts framework.to_s
 end
end