Class: Bones::App::Info
Constant Summary
Constants inherited from Command
Constants included from Colors
Instance Attribute Summary
Attributes inherited from Command
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Command
#in_directory, inherited, #initialize, #mrbones_dir, #name, #output_dir, #parse, #repository, #skeleton_dir, #standard_options, standard_options, #verbose?
Methods included from Colors
Constructor Details
This class inherits a constructor from Bones::App::Command
Class Method Details
.initialize_info ⇒ Object
5 6 7 8 9 |
# File 'lib/bones/app/info.rb', line 5 def self.initialize_info synopsis 'bones info' summary 'show information about available skeletons' description 'Shows information about available skeletons.' end |
Instance Method Details
#run ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/bones/app/info.rb', line 11 def run skeleton_dir = File.join(mrbones_dir, DEFAULT_SKELETON) skeleton_dir = ::Bones.path(DEFAULT_SKELETON) unless test(?d, skeleton_dir) msg = "\n" msg << "The default project skeleton will be copied from:\n" msg << " " << colorize(skeleton_dir, :cyan) << "\n\n" fmt = " #{colorize('%-12s', :green)} #{colorize('=>', :yellow)} #{colorize('%s', :cyan)}\n" msg << "Available projects skeletons are:\n" Dir.glob(File.join(mrbones_dir, '*')).sort.each do |fn| next if fn =~ %r/\.archive$/ next if File.basename(fn) == DEFAULT_SKELETON if test(?f, fn) msg << fmt % [File.basename(fn), File.read(fn).strip] else msg << " " << colorize(File.basename(fn), :green) << "\n" end end stdout.puts msg stdout.puts end |