Skip to content

Commit

Permalink
Merge pull request ahoward#3 from ubermajestix/master
Browse files Browse the repository at this point in the history
Reload.
  • Loading branch information
ahoward committed Oct 13, 2011
2 parents 8e3965c + 11df08c commit 57bb9ea
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/fbomb
Expand Up @@ -23,7 +23,7 @@ Main {
end

def load_commands!
@commands = FBomb::Command.load(config[:commands])
FBomb::Command.load(config[:commands])
end

def load_room!
Expand Down Expand Up @@ -72,7 +72,7 @@ Main {

if arg =~ %r|^\s*/|
path = arg.strip
command = @commands[path]
command = FBomb::Command.table[path]
if command
logging_errors do
logger.info("#{ path } #{ args.join(' ') }")
Expand Down
2 changes: 2 additions & 0 deletions lib/fbomb/command.rb
Expand Up @@ -16,9 +16,11 @@ class << Command
fattr(:table){ Table.new }
fattr(:dir){ File.join(File.expand_path(File.dirname(__FILE__)), 'commands') }
fattr(:room)
fattr(:command_paths){ [] }

def load(*args)
args.flatten.uniq.each do |arg|
Command.command_paths << arg
case arg.to_s
when %r|^/|
load_absolute_path(arg)
Expand Down
10 changes: 10 additions & 0 deletions lib/fbomb/commands/builtin.rb
Expand Up @@ -2,6 +2,16 @@

##
#
command(:reload){
help 'reload fbomb commands'

call do |*args|
FBomb::Command.table = FBomb::Command::Table.new
FBomb::Command.load(Command.command_paths)
speak('locked and loaded.')
end
}

command(:rhymeswith) {
help 'show ryhming words'

Expand Down

0 comments on commit 57bb9ea

Please sign in to comment.