class Bones::App::Info

Public Class Methods

initialize_info() click to toggle source
# 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

Public Instance Methods

run() click to toggle source
# 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 =~ /\.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