Module: FSR::Cmd
- Included in:
- CommandSocket
- Defined in:
- lib/fsr/cmd.rb,
lib/fsr/cmd/chat.rb,
lib/fsr/cmd/enum.rb,
lib/fsr/cmd/kill.rb,
lib/fsr/cmd/calls.rb,
lib/fsr/cmd/fsctl.rb,
lib/fsr/cmd/sofia.rb,
lib/fsr/cmd/status.rb,
lib/fsr/cmd/channels.rb,
lib/fsr/cmd/originate.rb,
lib/fsr/cmd/uuid_dump.rb,
lib/fsr/cmd/conference.rb,
lib/fsr/cmd/valet_info.rb,
lib/fsr/cmd/call_center.rb,
lib/fsr/cmd/sched_hangup.rb,
lib/fsr/cmd/sofia/status.rb,
lib/fsr/cmd/sofia/profile.rb,
lib/fsr/cmd/sofia_contact.rb,
lib/fsr/cmd/uuid_transfer.rb,
lib/fsr/cmd/sched_transfer.rb,
lib/fsr/cmd/uuid_send_dtmf.rb
Defined Under Namespace
Classes: CallCenter, Calls, Channels, Chat, Command, Conference, Enum, Fsctl, Kill, Originate, SchedHangup, SchedTransfer, Sofia, SofiaContact, Status, UuidDump, UuidSendDtmf, UuidTransfer, ValetInfo
Constant Summary collapse
Class Method Summary collapse
- .list ⇒ Object
-
.load_all(force_reload = false) ⇒ Object
Load all of the commands we find in Cmd::LOAD_PATH.
- .load_command(command, force_reload = false) ⇒ Object
- .register(command, obj) ⇒ Object
Instance Method Summary collapse
Class Method Details
.list ⇒ Object
34 35 36 |
# File 'lib/fsr/cmd.rb', line 34 def self.list COMMANDS.keys end |
.load_all(force_reload = false) ⇒ Object
Load all of the commands we find in Cmd::LOAD_PATH
63 64 65 66 67 68 |
# File 'lib/fsr/cmd.rb', line 63 def self.load_all(force_reload = false) LOAD_PATH.each do |load_path| Dir[load_path.join("*.rb").to_s].each { |command_file| load_command(command_file, force_reload) } end list end |
.load_command(command, force_reload = false) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/fsr/cmd.rb', line 38 def self.load_command(command, force_reload = false) # If we get a path specification and it's an existing file, load it if File.file?(command) if force_reload return load(command) else return require(command) end end Log.debug "Trying load paths" # If we find a file named the same as the command passed in LOAD_PATH, load it if found_command_path = LOAD_PATH.detect { |command_path| command_path.join("#{command}.rb").file? } command_file = found_command_path.join(command) Log.debug "Trying to load #{command_file}" if force_reload load command_file.to_s + ".rb" else require command_file end else raise "#{command} not found in #{LOAD_PATH.join(":")}" end end |