Module: RVC
- Defined in:
- lib/rvc/fs.rb,
lib/rvc/path.rb,
lib/rvc/util.rb,
lib/rvc/shell.rb,
lib/rvc/modules.rb,
lib/rvc/inventory.rb,
lib/rvc/ttl_cache.rb,
lib/rvc/completion.rb,
lib/rvc/known_hosts.rb,
lib/rvc/option_parser.rb
Overview
Copyright © 2011 VMware, Inc. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Defined Under Namespace
Modules: Completion, InventoryObject, Path, ReadlineFFI, Util Classes: CmdModule, FS, FakeFolder, KnownHosts, OptionParser, RootNode, RubyEvaluator, Shell, TTLCache
Constant Summary collapse
- ALIASES =
{}
- MODULES =
{}
- BULTIN_MODULE_PATH =
[File.(File.join(File.dirname(__FILE__), 'modules')), File.join(ENV['HOME'], ".rvc")]
- ENV_MODULE_PATH =
(ENV['RVC_MODULE_PATH'] || '').split ':'
Class Method Summary collapse
Class Method Details
.reload_modules(verbose = true) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/rvc/modules.rb', line 55 def self.reload_modules verbose=true RVC::MODULES.clear RVC::ALIASES.clear RVC::MODULES['custom'] = CmdModule.new 'custom' module_path = (BULTIN_MODULE_PATH+ENV_MODULE_PATH).select { |d| File.directory?(d) } globs = module_path.map { |d| File.join(d, '*.rb') } Dir.glob(globs) do |f| module_name = File.basename(f)[0...-3] puts "loading #{module_name} from #{f}" if verbose code = File.read f unless RVC::MODULES.member? module_name m = CmdModule.new module_name CMD.define_singleton_method(module_name.to_sym) { m } RVC::MODULES[module_name] = m end RVC::MODULES[module_name].instance_eval code, f end end |