Module: RubyRaider::PluginExposer
- Defined in:
- lib/plugin/plugin_exposer.rb
Constant Summary collapse
- FILE_PATH =
File.('../commands/loaded_commands.rb', __dir__)
Class Method Summary collapse
-
.expose_commands(plugin_name) ⇒ Object
:reek:NestedIterators { enabled: false }.
- .remove_command(plugin_name) ⇒ Object
Class Method Details
.expose_commands(plugin_name) ⇒ Object
:reek:NestedIterators { enabled: false }
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/plugin/plugin_exposer.rb', line 10 def expose_commands(plugin_name) return pp 'The plugin is already installed' if plugin_present?(plugin_name) commands = read_loaded_commands File.open(FILE_PATH, 'w') do |file| commands.each do |line| file.puts line file.puts require_plugin(plugin_name, line) file.puts select_command_formatting(plugin_name, line) end end end |
.remove_command(plugin_name) ⇒ Object
24 25 26 27 28 |
# File 'lib/plugin/plugin_exposer.rb', line 24 def remove_command(plugin_name) return pp 'The plugin is not installed' unless plugin_present?(plugin_name) delete_plugin_command(plugin_name) end |