Class: KPM::PluginsInstaller
- Inherits:
-
Object
- Object
- KPM::PluginsInstaller
- Includes:
- Singleton
- Defined in:
- lib/kpm/plugins_installer.rb
Instance Attribute Summary collapse
-
#initialized ⇒ Object
(also: #initialized?)
readonly
Returns the value of attribute initialized.
Instance Method Summary collapse
- #all(latest = true) ⇒ Object
- #initialize!(root_dir, conf_dir, kb_apis, logger) ⇒ Object
-
#install(plugin_key, kb_version, specified_artifact_id, specified_version = nil, specified_group_id = nil, specified_packaging = nil, specified_classifier = nil, specified_type = nil, force_download = false) ⇒ Object
If an earlier version of the plugin is installed, Kill Bill will only start the latest one (see org.killbill.billing.osgi.FileInstall).
- #install_from_fs(plugin_key, file_path, version, type) ⇒ Object
- #lookup(artifact_id, latest = true) ⇒ Object
- #restart(plugin_name, version = nil) ⇒ Object
- #uninstall(plugin_key, version = nil) ⇒ Object
Instance Attribute Details
#initialized ⇒ Object (readonly) Also known as: initialized?
Returns the value of attribute initialized.
5 6 7 |
# File 'lib/kpm/plugins_installer.rb', line 5 def initialized @initialized end |
Instance Method Details
#all(latest = true) ⇒ Object
63 64 65 |
# File 'lib/kpm/plugins_installer.rb', line 63 def all(latest=true) KPM::PluginsDirectory.all(latest) end |
#initialize!(root_dir, conf_dir, kb_apis, logger) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/kpm/plugins_installer.rb', line 8 def initialize!(root_dir, conf_dir, kb_apis, logger) @kb_apis = kb_apis @logger = logger configure!(Pathname.new(conf_dir)..join('kpm.yml')) @bundles_dir = Pathname.new(root_dir).join('..').join('..').join('..').join('..'). plugins_dir = @bundles_dir.join('plugins') @installer = ::KPM::BaseInstaller.new(@logger, @glob_config[:kpm][:nexus], @glob_config[:kpm][:ssl_verify]) @manager = ::KPM::PluginsManager.new(plugins_dir, @logger) @initialized = true end |
#install(plugin_key, kb_version, specified_artifact_id, specified_version = nil, specified_group_id = nil, specified_packaging = nil, specified_classifier = nil, specified_type = nil, force_download = false) ⇒ Object
If an earlier version of the plugin is installed, Kill Bill will only start the latest one (see org.killbill.billing.osgi.FileInstall)
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/kpm/plugins_installer.rb', line 24 def install(plugin_key, kb_version, specified_artifact_id, specified_version=nil, specified_group_id=nil, specified_packaging=nil, specified_classifier=nil, specified_type=nil, force_download=false) @logger.info("Instructed to install plugin_key=#{plugin_key} artifact_id=#{specified_artifact_id} version=#{specified_version} group_id=#{specified_group_id} packaging=#{specified_packaging} classifier=#{specified_classifier} type=#{specified_type} force_download=#{force_download}") info = @installer.install_plugin(plugin_key, kb_version, specified_group_id, specified_artifact_id, specified_packaging, specified_classifier, specified_version, @bundles_dir, specified_type, force_download, @glob_config[:kpm][:verify_sha1]) if info.nil? @logger.warn("Error during installation of plugin #{specified_artifact_id}") else path = info[:bundle_dir] notify_fs_change(plugin_key, path, :NEW_VERSION) end info end |
#install_from_fs(plugin_key, file_path, version, type) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/kpm/plugins_installer.rb', line 36 def install_from_fs(plugin_key, file_path, version, type) @logger.info("Instructed to install file_path=#{file_path} plugin_key=#{plugin_key} version=#{version} type=#{type}") info = @installer.install_plugin_from_fs(plugin_key, file_path, plugin_key, version, @bundles_dir, type) if info.nil? @logger.warn("Error during installation of plugin #{plugin_key}") else path = info[:bundle_dir] || info[:dir_name] notify_fs_change(plugin_key, path, :NEW_VERSION) end info end |
#lookup(artifact_id, latest = true) ⇒ Object
59 60 61 |
# File 'lib/kpm/plugins_installer.rb', line 59 def lookup(artifact_id, latest=true) KPM::PluginsDirectory.lookup(artifact_id, latest) end |
#restart(plugin_name, version = nil) ⇒ Object
55 56 57 |
# File 'lib/kpm/plugins_installer.rb', line 55 def restart(plugin_name, version=nil) @manager.restart(plugin_name, version || :all) end |
#uninstall(plugin_key, version = nil) ⇒ Object
48 49 50 51 52 53 |
# File 'lib/kpm/plugins_installer.rb', line 48 def uninstall(plugin_key, version=nil) modified = @installer.uninstall_plugin(plugin_key, version || :all, @bundles_dir) modified.each do |path| notify_fs_change(plugin_key, path, :DISABLED) end end |