class BaseChip::ListMenu

Public Instance Methods

actions(pattern=nil) click to toggle source
# File lib/base_chip/list_menu.rb, line 59
def actions(pattern=nil)
  before(pattern)
  BaseChip.actions.each do |action|
    name = action.name
    c = action.configuration
    b = c.block
    smart_print "#{b.name}:#{c.name}:#{name}", action, b.name.to_s, c.name.to_s, name.to_s
  end
  after
end
after() click to toggle source
# File lib/base_chip/list_menu.rb, line 30
def after
  if @table.size > 0
    print_table(@table,'=>')
  end
end
before(pattern) click to toggle source
# File lib/base_chip/list_menu.rb, line 21
def before(pattern)
  BaseChip.load_environment
  @table = []
  case pattern
  when /^\/(.*)\/$/ ; @pattern = /#{$1}/
  else              ; @pattern = pattern
  end
  exit unless BaseChip.project.blocks
end
blocks(pattern=nil) click to toggle source
# File lib/base_chip/list_menu.rb, line 39
def blocks(pattern=nil)
  before(pattern)
  BaseChip.blocks.each do |block|
    smart_print block.name.to_s, block
  end
  after
end
configurations(pattern=nil) click to toggle source
# File lib/base_chip/list_menu.rb, line 48
def configurations(pattern=nil)
  before(pattern)
  BaseChip.configurations.each do |configuration|
    name   = configuration.name
    b_name = configuration.block.name
    smart_print "#{b_name}:#{name}", configuration, b_name.to_s, name.to_s
  end
  after
end
plugins(pattern=nil) click to toggle source
# File lib/base_chip/list_menu.rb, line 107
def plugins(pattern=nil)
  fault "This feature is soon forthcoming"
end
recipes(pattern=nil) click to toggle source
# File lib/base_chip/list_menu.rb, line 113
def recipes(pattern=nil)
  begin
    infile = open("http://basechip.com/recipe_list#{"?name=#{pattern}" if pattern}")
  rescue OpenURI::HTTPError
    fault "Could not access basechip.com"
  end
  puts "available recipes are:"
  puts infile.read.gsub(/^/,'  ')
end
test_lists(pattern=nil) click to toggle source
# File lib/base_chip/list_menu.rb, line 71
def test_lists(pattern=nil)
  before(pattern)
  BaseChip.test_lists.each do |list|
    name = list.name
    c = list.configuration
    b = c.block
    smart_print "#{b.name}:#{c.name}:#{name}", list, b.name.to_s, c.name.to_s, name.to_s
  end
  after
end
tests(pattern=nil) click to toggle source
# File lib/base_chip/list_menu.rb, line 83
def tests(pattern=nil)
  before(pattern)
  BaseChip.tests.each do |test|
    name = test.name
    l = test.test_list
    c = l.configuration
    b = c.block
    smart_print "#{b.name}:#{c.name}:#{l.name}:#{name}", test, b.name.to_s, c.name.to_s, l.name.to_s, name.to_s
  end
  after
end
tools(pattern=nil) click to toggle source
# File lib/base_chip/list_menu.rb, line 96
def tools(pattern=nil)
  before(pattern)
  BaseChip.tools.each do |tool|
    name = tool.name
    smart_print [name,"used by #{tool.configuration.full_name}"], tool, name.to_s
  end
  after
end
workload(*targets) click to toggle source
# File lib/base_chip/list_menu.rb, line 126
def workload(*targets)
  if targets.empty?
    help
    fault "please specify targets"
  end
  BaseChip.load_environment
  @table = []
  BaseChip.project.dereference_workload(targets).each do |item|
    list_line item.full_name, item
  end
  after
end