module MiGA::Project::Plugins

Helper module including specific functions handle plugins.

Public Instance Methods

install_plugin(path) click to toggle source

Installs the plugin in the specified path.

# File lib/miga/project/plugins.rb, line 10
def install_plugin(path)
  abs_path = File.absolute_path(path)
  raise "Plugin already installed in project: #{abs_path}." unless
    metadata[:plugins].nil? or not metadata[:plugins].include?(abs_path)
  raise "Malformed MiGA plugin: #{abs_path}." unless
    File.exist?(File.expand_path("miga-plugin.json", abs_path))
  self.metadata[:plugins] ||= []
  self.metadata[:plugins] << abs_path
  save
end
load_plugins() click to toggle source

Loads the plugins installed in the project.

# File lib/miga/project/plugins.rb, line 37
def load_plugins
  plugins.each { |pl| require File.expand_path("lib-plugin.rb", pl) }
end
plugins() click to toggle source

List plugins installed in the project.

# File lib/miga/project/plugins.rb, line 33
def plugins ; metadata[:plugins] ||= [] ; end
uninstall_plugin(path) click to toggle source

Uninstall the plugin in the specified path.

# File lib/miga/project/plugins.rb, line 23
def uninstall_plugin(path)
  abs_path = File.absolute_path(path)
  raise "Plugin not currently installed: #{abs_path}." if
    metadata[:plugins].nil? or not metadata[:plugins].include?(abs_path)
  self.metadata[:plugins].delete(abs_path)
  save
end