plugin_manager 1.4 → 1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/plugin_manager.rb +27 -0
- metadata +5 -7
data/lib/plugin_manager.rb
CHANGED
@@ -8,6 +8,13 @@ require 'plugin_manager/definition_builder'
|
|
8
8
|
class PluginManager
|
9
9
|
attr_reader :unreadable_definitions, :plugins_with_errors, :loaded_plugins, :unloaded_plugins, :output
|
10
10
|
|
11
|
+
# A list of plugins that should not be loaded. You can feel free to assign
|
12
|
+
# plugins that are dependencies of plugins that are not disabled. In that
|
13
|
+
# case the plugin manager will just ignore your request to disable the
|
14
|
+
# plugin. This ensures that you only disable plugins in such a way that it is
|
15
|
+
# stable to the system.
|
16
|
+
attr_writer :disabled_plugins
|
17
|
+
|
11
18
|
class << self
|
12
19
|
attr_accessor :current
|
13
20
|
end
|
@@ -18,6 +25,7 @@ class PluginManager
|
|
18
25
|
@loaded_plugins = []
|
19
26
|
@unreadable_definitions = []
|
20
27
|
@plugins_with_errors = []
|
28
|
+
@disabled_plugins = []
|
21
29
|
@output = output
|
22
30
|
end
|
23
31
|
|
@@ -28,6 +36,21 @@ class PluginManager
|
|
28
36
|
def plugins
|
29
37
|
@plugins
|
30
38
|
end
|
39
|
+
|
40
|
+
# A subset of the plugins that have been requested to be disabled.
|
41
|
+
def disabled_plugins
|
42
|
+
plugins.find_all do |pd|
|
43
|
+
@disabled_plugins.include?(pd.name) &&
|
44
|
+
derivative_plugins_for(pd).all? {|der| @disabled_plugins.include? der.name}
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Returns all plugins that are dependent on the given plugin
|
49
|
+
def derivative_plugins_for(plugin)
|
50
|
+
plugins.find_all do |pd|
|
51
|
+
pd.dependencies.any? {|dep| dep.required_name == plugin.name}
|
52
|
+
end
|
53
|
+
end
|
31
54
|
|
32
55
|
def plugin_objects
|
33
56
|
@loaded_plugins.map {|definition| definition.object}
|
@@ -118,6 +141,10 @@ class PluginManager
|
|
118
141
|
end
|
119
142
|
|
120
143
|
def load(*plugin_names)
|
144
|
+
# Make sure disabled plugins are not listed as unloaded so we don't
|
145
|
+
# try to load them.
|
146
|
+
@unloaded_plugins -= disabled_plugins
|
147
|
+
|
121
148
|
if plugin_names.empty?
|
122
149
|
return load_maximal
|
123
150
|
else
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plugin_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.5'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
default_executable:
|
12
|
+
date: 2012-02-15 00:00:00.000000000Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: rspec
|
17
|
-
requirement: &
|
16
|
+
requirement: &70340178171860 !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
18
|
requirements:
|
20
19
|
- - ! '>='
|
@@ -22,7 +21,7 @@ dependencies:
|
|
22
21
|
version: '0'
|
23
22
|
type: :development
|
24
23
|
prerelease: false
|
25
|
-
version_requirements: *
|
24
|
+
version_requirements: *70340178171860
|
26
25
|
description:
|
27
26
|
email: dan@fluentradical.com
|
28
27
|
executables: []
|
@@ -36,7 +35,6 @@ files:
|
|
36
35
|
- lib/plugin_manager/plugin.rb
|
37
36
|
- lib/plugin_manager/plugin_definition.rb
|
38
37
|
- lib/plugin_manager.rb
|
39
|
-
has_rdoc: true
|
40
38
|
homepage: http://github.com/danlucraft/plugin_manager
|
41
39
|
licenses: []
|
42
40
|
post_install_message:
|
@@ -59,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
59
57
|
version: '0'
|
60
58
|
requirements: []
|
61
59
|
rubyforge_project:
|
62
|
-
rubygems_version: 1.
|
60
|
+
rubygems_version: 1.8.16
|
63
61
|
signing_key:
|
64
62
|
specification_version: 3
|
65
63
|
summary: A Ruby plugin loader
|