class Bones::App::Plugins

Public Instance Methods

all?() click to toggle source
# File lib/bones/app/plugins.rb, line 43
def all?
  config[:all]
end
run() click to toggle source
# File lib/bones/app/plugins.rb, line 20
def run
  stdout.write 'Looking up avaialble Mr Bones plugins ... '
  stdout.flush
  plugins = find_bones_plugins
  stdout.puts 'done!'
  stdout.puts

  if all?
    plugins.each { |name, version| show_plugin(name, version) }
  else
    gemspecs = find_gemspecs
    plugins.each { |name, version|
      gemspecs.each { |gem_name, gem_version|
        next unless name.downcase == gem_name.downcase
        next if version && version != gem_version
        show_plugin(name, version)
      }
    }
  end

  stdout.puts
end
show_plugin( name, version ) click to toggle source
# File lib/bones/app/plugins.rb, line 47
def show_plugin( name, version )
  name = "bones-#{name}"
  name << "-#{version}" if version

  stdout.puts("  [%s]  %s" % [installed?(name) ? colorize('installed', :green) : colorize('available', :cyan), name])
end

Public Class Methods

initialize_plugins() click to toggle source
# File lib/bones/app/plugins.rb, line 5
  def self.initialize_plugins
    synopsis 'bones plugins [options]'

    summary 'list available Mr Bones plugins'

    description <<-__
Parse the installed gems and then search for Mr Bones plugins related to
those gems. Passing in the 'all' flag will show plugins even if the related
gems are not installed.
    __

    option('-a', '--all', 'Show all plugins.', lambda { |_| config[:all] = true })
    option(standard_options[:colorize])
  end