fedux_org-stdlib 0.7.31 → 0.7.33
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.
- checksums.yaml +4 -4
- data/Gemfile +4 -3
- data/Gemfile.lock +19 -25
- data/fixtures/plugin-load-app/{fedux_org_stdlib-fixtures-plugin_manager-plugin-load.gemspec → fedux_org_stdlib-fixtures-plugin_manager-load.gemspec} +2 -2
- data/fixtures/plugin-load-app/lib/fedux_org_stdlib-fixtures-plugin_manager-load-plugin.rb +1 -0
- data/fixtures/plugin-load-app/lib/{fedux_org_stdlib/fixtures/plugin_manager/plugin/load.rb → fedux_org_stdlib-fixtures-plugin_manager-load.rb} +0 -0
- data/lib/fedux_org_stdlib/gem_plugins/plugin.rb +19 -64
- data/lib/fedux_org_stdlib/gem_plugins/plugin_manager.rb +59 -61
- data/lib/fedux_org_stdlib/list.rb +1 -0
- data/lib/fedux_org_stdlib/version.rb +1 -1
- data/spec/gem_plugins/plugin_manager_spec.rb +29 -23
- metadata +5 -6
- data/fixtures/plugin-no_load-app/fedux_org_stdlib-fixtures-plugin_manager-plugin-no_load.gemspec +0 -21
- data/fixtures/plugin-no_load-app/lib/fedux_org_stdlib/fixtures/plugin_manager/plugin/no_load.rb +0 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2df3bafb3b745bddbd69a9f0537867eedec950b6
|
|
4
|
+
data.tar.gz: 0b1051884555097787efc2771df1479eae33f1d8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e9f5967d86a4a088582bcc535ba777d90bc9e912414e3db8db9f4464142c17a5b9ed041bfddde2a650ff693e892651e5f54007e3009fee2811bfe4438df42abb
|
|
7
|
+
data.tar.gz: 7567209863dbd40e9491b691fc571e4fcddaee1f703e4845b4bbcc624b4e0b7a120a272de106781cac2878f84eeb12dddc1beb30acfedb79a35c781f45f33adf
|
data/Gemfile
CHANGED
|
@@ -4,7 +4,7 @@ source 'https://rubygems.org'
|
|
|
4
4
|
gemspec
|
|
5
5
|
|
|
6
6
|
group :development, :test do
|
|
7
|
-
gem 'pry'
|
|
7
|
+
gem 'pry'
|
|
8
8
|
gem 'pry-doc', require: false
|
|
9
9
|
|
|
10
10
|
if RUBY_VERSION < '2.0.0'
|
|
@@ -41,7 +41,8 @@ group :development, :test do
|
|
|
41
41
|
gem 'travis-lint'
|
|
42
42
|
gem 'facter'
|
|
43
43
|
gem 'hirb'
|
|
44
|
+
#gem 'tty'
|
|
44
45
|
|
|
45
|
-
gem 'fedux_org_stdlib-fixtures-plugin_manager-
|
|
46
|
-
gem 'fedux_org_stdlib-fixtures-plugin_manager-
|
|
46
|
+
gem 'fedux_org_stdlib-fixtures-plugin_manager-load', require: false, path: File.expand_path('../fixtures/plugin-load-app', __FILE__)
|
|
47
|
+
# gem 'fedux_org_stdlib-fixtures-plugin_manager-no_load', require: false, path: File.expand_path('../fixtures/plugin-no_load-app', __FILE__)
|
|
47
48
|
end
|
data/Gemfile.lock
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
fedux_org-stdlib (0.7.
|
|
4
|
+
fedux_org-stdlib (0.7.32)
|
|
5
5
|
activesupport
|
|
6
6
|
|
|
7
7
|
PATH
|
|
8
8
|
remote: fixtures/plugin-load-app
|
|
9
9
|
specs:
|
|
10
|
-
fedux_org_stdlib-fixtures-plugin_manager-
|
|
11
|
-
|
|
12
|
-
PATH
|
|
13
|
-
remote: fixtures/plugin-no_load-app
|
|
14
|
-
specs:
|
|
15
|
-
fedux_org_stdlib-fixtures-plugin_manager-plugin-no_load (0.0.1)
|
|
10
|
+
fedux_org_stdlib-fixtures-plugin_manager-load (0.0.1)
|
|
16
11
|
|
|
17
12
|
GEM
|
|
18
13
|
remote: https://rubygems.org/
|
|
@@ -35,11 +30,11 @@ GEM
|
|
|
35
30
|
awesome_print (1.2.0)
|
|
36
31
|
blockenspiel (0.4.5)
|
|
37
32
|
builder (3.2.2)
|
|
38
|
-
byebug (3.
|
|
33
|
+
byebug (3.5.1)
|
|
39
34
|
columnize (~> 0.8)
|
|
40
35
|
debugger-linecache (~> 1.2)
|
|
41
36
|
slop (~> 3.6)
|
|
42
|
-
childprocess (0.5.
|
|
37
|
+
childprocess (0.5.5)
|
|
43
38
|
ffi (~> 1.0, >= 1.0.11)
|
|
44
39
|
coderay (1.1.0)
|
|
45
40
|
columnize (0.8.9)
|
|
@@ -53,7 +48,7 @@ GEM
|
|
|
53
48
|
simplecov (>= 0.7)
|
|
54
49
|
term-ansicolor
|
|
55
50
|
thor
|
|
56
|
-
cucumber (1.3.
|
|
51
|
+
cucumber (1.3.17)
|
|
57
52
|
builder (>= 2.1.2)
|
|
58
53
|
diff-lcs (>= 1.1.3)
|
|
59
54
|
gherkin (~> 2.12)
|
|
@@ -65,7 +60,7 @@ GEM
|
|
|
65
60
|
erubis (2.7.0)
|
|
66
61
|
facter (2.2.0)
|
|
67
62
|
CFPropertyList (~> 2.2.6)
|
|
68
|
-
ffi (1.9.
|
|
63
|
+
ffi (1.9.5)
|
|
69
64
|
filegen (0.4.3)
|
|
70
65
|
activesupport
|
|
71
66
|
fuubar (2.0.0)
|
|
@@ -73,7 +68,7 @@ GEM
|
|
|
73
68
|
ruby-progressbar (~> 1.4)
|
|
74
69
|
gherkin (2.12.2)
|
|
75
70
|
multi_json (~> 1.3)
|
|
76
|
-
github-markup (1.
|
|
71
|
+
github-markup (1.3.0)
|
|
77
72
|
posix-spawn (~> 0.3.8)
|
|
78
73
|
hirb (0.7.2)
|
|
79
74
|
i18n (0.6.11)
|
|
@@ -83,12 +78,12 @@ GEM
|
|
|
83
78
|
mail (2.6.1)
|
|
84
79
|
mime-types (>= 1.16, < 3)
|
|
85
80
|
method_source (0.8.2)
|
|
86
|
-
mime-types (2.
|
|
81
|
+
mime-types (2.4.1)
|
|
87
82
|
minitest (5.4.2)
|
|
88
83
|
multi_json (1.10.1)
|
|
89
84
|
multi_test (0.1.1)
|
|
90
85
|
netrc (0.7.7)
|
|
91
|
-
parser (2.2.0.pre.
|
|
86
|
+
parser (2.2.0.pre.5)
|
|
92
87
|
ast (>= 1.1, < 3.0)
|
|
93
88
|
slop (~> 3.4, >= 3.4.5)
|
|
94
89
|
posix-spawn (0.3.9)
|
|
@@ -113,27 +108,27 @@ GEM
|
|
|
113
108
|
rspec-core (~> 3.1.0)
|
|
114
109
|
rspec-expectations (~> 3.1.0)
|
|
115
110
|
rspec-mocks (~> 3.1.0)
|
|
116
|
-
rspec-core (3.1.
|
|
111
|
+
rspec-core (3.1.6)
|
|
117
112
|
rspec-support (~> 3.1.0)
|
|
118
|
-
rspec-expectations (3.1.
|
|
113
|
+
rspec-expectations (3.1.2)
|
|
119
114
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
120
115
|
rspec-support (~> 3.1.0)
|
|
121
116
|
rspec-legacy_formatters (1.0.0)
|
|
122
117
|
rspec-core (>= 3.0.0.beta2)
|
|
123
118
|
rspec-support (>= 3.0.0.beta2)
|
|
124
|
-
rspec-mocks (3.1.
|
|
119
|
+
rspec-mocks (3.1.3)
|
|
125
120
|
rspec-support (~> 3.1.0)
|
|
126
|
-
rspec-support (3.1.
|
|
127
|
-
rubocop (0.26.
|
|
121
|
+
rspec-support (3.1.2)
|
|
122
|
+
rubocop (0.26.1)
|
|
128
123
|
astrolabe (~> 1.3)
|
|
129
124
|
parser (>= 2.2.0.pre.4, < 3.0)
|
|
130
125
|
powerpack (~> 0.0.6)
|
|
131
126
|
rainbow (>= 1.99.1, < 3.0)
|
|
132
127
|
ruby-progressbar (~> 1.4)
|
|
133
|
-
ruby-progressbar (1.
|
|
134
|
-
simplecov (0.9.
|
|
128
|
+
ruby-progressbar (1.6.0)
|
|
129
|
+
simplecov (0.9.1)
|
|
135
130
|
docile (~> 1.1.0)
|
|
136
|
-
multi_json
|
|
131
|
+
multi_json (~> 1.0)
|
|
137
132
|
simplecov-html (~> 0.8.0)
|
|
138
133
|
simplecov-html (0.8.0)
|
|
139
134
|
slop (3.6.0)
|
|
@@ -145,7 +140,7 @@ GEM
|
|
|
145
140
|
tins (~> 1.0)
|
|
146
141
|
thor (0.19.1)
|
|
147
142
|
thread_safe (0.3.4)
|
|
148
|
-
tins (1.3.
|
|
143
|
+
tins (1.3.3)
|
|
149
144
|
tmrb (1.2.7)
|
|
150
145
|
thor
|
|
151
146
|
travis-lint (2.0.0)
|
|
@@ -171,8 +166,7 @@ DEPENDENCIES
|
|
|
171
166
|
erubis
|
|
172
167
|
facter
|
|
173
168
|
fedux_org-stdlib!
|
|
174
|
-
fedux_org_stdlib-fixtures-plugin_manager-
|
|
175
|
-
fedux_org_stdlib-fixtures-plugin_manager-plugin-no_load!
|
|
169
|
+
fedux_org_stdlib-fixtures-plugin_manager-load!
|
|
176
170
|
filegen
|
|
177
171
|
fuubar
|
|
178
172
|
github-markup
|
|
@@ -3,12 +3,12 @@ lib = File.expand_path('../lib', __FILE__)
|
|
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |spec|
|
|
6
|
-
spec.name = 'fedux_org_stdlib-fixtures-plugin_manager-
|
|
6
|
+
spec.name = 'fedux_org_stdlib-fixtures-plugin_manager-load'
|
|
7
7
|
spec.version = '0.0.1'
|
|
8
8
|
spec.authors = ['Blub']
|
|
9
9
|
spec.email = ['email@example.com']
|
|
10
10
|
spec.summary = 'Summary'
|
|
11
|
-
spec.homepage = ''
|
|
11
|
+
spec.homepage = 'http://example.com'
|
|
12
12
|
spec.license = 'MIT'
|
|
13
13
|
|
|
14
14
|
spec.files = `git ls-files -z`.split("\x0")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'fedux_org_stdlib-fixtures-plugin_manager-plugin-load'
|
|
File without changes
|
|
@@ -9,33 +9,14 @@ module FeduxOrgStdlib
|
|
|
9
9
|
class Plugin
|
|
10
10
|
include Comparable
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
attr_reader :name, :version, :author, :homepage
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
attr_reader :name, :gem_name, :required_file
|
|
21
|
-
|
|
22
|
-
def initialize(name, gem_name:, enabled:, prefix: nil)
|
|
23
|
-
@name = name
|
|
24
|
-
@gem_name = gem_name
|
|
25
|
-
@enabled = enabled
|
|
26
|
-
@prefix = prefix
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
# Disable a plugin. (prevents plugin from being loaded, cannot
|
|
30
|
-
# disable an already activated plugin)
|
|
31
|
-
def disable
|
|
32
|
-
self.enabled = false
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
# Enable a plugin. (does not load it immediately but puts on
|
|
36
|
-
# 'white list' to be loaded)
|
|
37
|
-
def enable
|
|
38
|
-
self.enabled = true
|
|
14
|
+
def initialize(spec:)
|
|
15
|
+
@name = spec.name
|
|
16
|
+
@author = Array(spec.authors).zip(Array(spec.email)).map { |a, e| format( '%s (%s)', a, e) }.to_list
|
|
17
|
+
@version = spec.version
|
|
18
|
+
@homagepage = spec.homepage
|
|
19
|
+
@active = false
|
|
39
20
|
end
|
|
40
21
|
|
|
41
22
|
# Activate the plugin (require the gem - enables/loads the
|
|
@@ -43,38 +24,23 @@ module FeduxOrgStdlib
|
|
|
43
24
|
# disabled)
|
|
44
25
|
# Does not reload plugin if it's already active.
|
|
45
26
|
def activate
|
|
46
|
-
|
|
47
|
-
unless active?
|
|
48
|
-
begin
|
|
49
|
-
required_file = variants.shift
|
|
50
|
-
require required_file
|
|
27
|
+
return if active?
|
|
51
28
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
retry unless variants.blank?
|
|
55
|
-
|
|
56
|
-
raise LoadError
|
|
57
|
-
end
|
|
58
|
-
end
|
|
29
|
+
begin
|
|
30
|
+
require name
|
|
59
31
|
rescue LoadError => e
|
|
60
|
-
warn "Found plugin #{
|
|
32
|
+
warn "Found plugin \"#{name}\", but could not require \"#{require_file}\""
|
|
61
33
|
warn e
|
|
62
34
|
rescue StandardError => e
|
|
63
|
-
warn "
|
|
35
|
+
warn "Require plugin \"#{name}\" failed, saying: #{e}\n#{e.backtrace.join("\n")}"
|
|
64
36
|
end
|
|
65
37
|
|
|
66
|
-
|
|
67
|
-
self.enabled = true
|
|
38
|
+
@active = true
|
|
68
39
|
end
|
|
69
40
|
|
|
70
41
|
# Is plugin active?
|
|
71
42
|
def active?
|
|
72
|
-
active == true
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
# Is plugin enabled?
|
|
76
|
-
def enabled?
|
|
77
|
-
enabled == true
|
|
43
|
+
@active == true
|
|
78
44
|
end
|
|
79
45
|
|
|
80
46
|
# Is an existing plugin
|
|
@@ -82,26 +48,15 @@ module FeduxOrgStdlib
|
|
|
82
48
|
false
|
|
83
49
|
end
|
|
84
50
|
|
|
51
|
+
# Path of require file
|
|
52
|
+
def require_file
|
|
53
|
+
"#{name}.rb"
|
|
54
|
+
end
|
|
55
|
+
|
|
85
56
|
# @private
|
|
86
57
|
def <=>(other)
|
|
87
58
|
name <=> other.name
|
|
88
59
|
end
|
|
89
|
-
|
|
90
|
-
private
|
|
91
|
-
|
|
92
|
-
def local_variant; end
|
|
93
|
-
|
|
94
|
-
def variants
|
|
95
|
-
return @__v if @__v
|
|
96
|
-
|
|
97
|
-
@__v = []
|
|
98
|
-
@__v << gem_name
|
|
99
|
-
@__v << gem_name.gsub(/-/, '/')
|
|
100
|
-
@__v << local_variant if local_variant
|
|
101
|
-
@__v << prefix.source.sub(/-$/, '') if prefix
|
|
102
|
-
|
|
103
|
-
@__v
|
|
104
|
-
end
|
|
105
60
|
end
|
|
106
61
|
end
|
|
107
62
|
end
|
|
@@ -13,8 +13,9 @@ module FeduxOrgStdlib
|
|
|
13
13
|
#
|
|
14
14
|
# To use the plugin manager you should build the plugins for your
|
|
15
15
|
# application as rubygems. How you name the plugins is up to you, but it is
|
|
16
|
-
# recommended to use something like `your-application-<plugin
|
|
17
|
-
#
|
|
16
|
+
# recommended to use something like `your-application-<plugin>`. For
|
|
17
|
+
# the plugin to be found, it needs to include the so called plugin file
|
|
18
|
+
# `your-application-extension.rb`.
|
|
18
19
|
#
|
|
19
20
|
# @example PluginManager-class
|
|
20
21
|
#
|
|
@@ -31,7 +32,7 @@ module FeduxOrgStdlib
|
|
|
31
32
|
# # -- main.rb --
|
|
32
33
|
# # main module
|
|
33
34
|
# module YourApplication
|
|
34
|
-
# # The manager uses "#{self.name.underscore.gsub(/\//, '-')}-" as
|
|
35
|
+
# # The manager uses "#{self.name.underscore.gsub(/\//, '-')}-plugin.rb" as plugin-file
|
|
35
36
|
# @plugin_manager = PluginManager.new
|
|
36
37
|
#
|
|
37
38
|
# class << self
|
|
@@ -44,12 +45,12 @@ module FeduxOrgStdlib
|
|
|
44
45
|
# end
|
|
45
46
|
#
|
|
46
47
|
#
|
|
47
|
-
# @example Use different
|
|
48
|
+
# @example Use different plugin file
|
|
48
49
|
# # -- main.rb --
|
|
49
50
|
# # main module
|
|
50
51
|
# module YourApplication
|
|
51
|
-
# # The manager uses 'asdf-'
|
|
52
|
-
# @plugin_manager = PluginManager.new(
|
|
52
|
+
# # The manager uses 'asdf-plugin1.rb' to find plugins
|
|
53
|
+
# @plugin_manager = PluginManager.new(plugin_file: 'asdf-plugin1.rb')
|
|
53
54
|
#
|
|
54
55
|
# [...]
|
|
55
56
|
# end
|
|
@@ -65,87 +66,84 @@ module FeduxOrgStdlib
|
|
|
65
66
|
class PluginManager
|
|
66
67
|
private
|
|
67
68
|
|
|
68
|
-
attr_reader :plugins, :
|
|
69
|
+
attr_reader :plugins, :creator, :plugin_file
|
|
69
70
|
|
|
70
71
|
public
|
|
71
72
|
|
|
72
|
-
def initialize(
|
|
73
|
-
@
|
|
74
|
-
@
|
|
75
|
-
@blacklist = Array(blacklist)
|
|
76
|
-
@creator = creator
|
|
73
|
+
def initialize(creator: Plugin, plugin_file: File.join('lib', __plugin_prefix + 'plugin.rb'))
|
|
74
|
+
@creator = creator
|
|
75
|
+
@plugin_file = plugin_file
|
|
77
76
|
|
|
78
77
|
# needs variables above
|
|
79
|
-
@plugins =
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
# Disable a plugin
|
|
83
|
-
def disable_plugin(name)
|
|
84
|
-
plugin = plugins.find(NoPlugin.new(name)) { |p| p.name == name }
|
|
85
|
-
|
|
86
|
-
return if plugin.blank?
|
|
87
|
-
|
|
88
|
-
plugin.disable
|
|
78
|
+
@plugins = plugins_in_rubygems_path
|
|
89
79
|
end
|
|
90
80
|
|
|
91
81
|
# Enable a plugin
|
|
92
|
-
def
|
|
93
|
-
|
|
82
|
+
def activate_plugin(*names)
|
|
83
|
+
names.flatten.each do |n|
|
|
84
|
+
plugin = plugins.find(NoPlugin.new(n)) { |p| p.name == n }
|
|
94
85
|
|
|
95
|
-
|
|
86
|
+
return if plugin.blank?
|
|
96
87
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
# Require all enabled plugins, disabled plugins are skipped.
|
|
101
|
-
def load_plugins
|
|
102
|
-
each_enabled_plugin(&:activate)
|
|
88
|
+
plugin.activate
|
|
89
|
+
end
|
|
103
90
|
end
|
|
104
91
|
|
|
105
92
|
# String representation
|
|
106
93
|
def to_s
|
|
107
|
-
data = plugins.sort.reduce([])
|
|
94
|
+
data = plugins.sort.reduce([]) do |a, e|
|
|
95
|
+
a << {
|
|
96
|
+
name: e.name,
|
|
97
|
+
version: e.version,
|
|
98
|
+
author: e.author,
|
|
99
|
+
homepage: e.homepage,
|
|
100
|
+
activated: e.active?,
|
|
101
|
+
require_file: e.require_file
|
|
102
|
+
}
|
|
103
|
+
end
|
|
108
104
|
|
|
109
105
|
List.new(data).to_s(
|
|
110
|
-
fields: [:name, :
|
|
106
|
+
fields: [:name, :version, :author, :homepage, :activated, :require_file]
|
|
111
107
|
)
|
|
112
108
|
end
|
|
113
109
|
|
|
114
110
|
private
|
|
115
111
|
|
|
116
|
-
def each_enabled_plugin(&block)
|
|
117
|
-
plugins.select(&:enabled?).each(&block)
|
|
118
|
-
end
|
|
119
|
-
|
|
120
112
|
# Find all installed plugins and store them in an internal array.
|
|
121
|
-
def
|
|
122
|
-
|
|
123
|
-
|
|
113
|
+
def plugins_in_rubygems_path
|
|
114
|
+
require 'rubygems'
|
|
124
115
|
Gem.refresh
|
|
125
116
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
next if plgs.any? { |plugin| plugin.name == name }
|
|
131
|
-
|
|
132
|
-
enabled = if !whitelist.blank? && !whitelist.include?(name)
|
|
133
|
-
false
|
|
134
|
-
elsif !blacklist.blank? && blacklist.include?(name)
|
|
135
|
-
false
|
|
136
|
-
else
|
|
137
|
-
true
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
plgs << creator.new(
|
|
141
|
-
name,
|
|
142
|
-
gem_name: gem.name,
|
|
143
|
-
enabled: enabled,
|
|
144
|
-
prefix: prefix
|
|
145
|
-
)
|
|
117
|
+
specs = rubygems_latest_specs.select { |s| spec_has_file?(s) }
|
|
118
|
+
|
|
119
|
+
specs.map do |s|
|
|
120
|
+
creator.new(spec: s)
|
|
146
121
|
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# Where a given Gem::Specification has a specific file. Used
|
|
125
|
+
# to discover plugins.
|
|
126
|
+
#
|
|
127
|
+
# @private
|
|
128
|
+
# @param [Gem::Specification] spec
|
|
129
|
+
# @param [String] path Path to look for
|
|
130
|
+
# @return [Boolean] Whether the file exists
|
|
131
|
+
def spec_has_file?(spec)
|
|
132
|
+
File.exist? File.join(spec.full_gem_path, plugin_file)
|
|
133
|
+
end
|
|
147
134
|
|
|
148
|
-
|
|
135
|
+
# Backwards compatible means of finding all the latest gemspecs
|
|
136
|
+
# available on the system
|
|
137
|
+
#
|
|
138
|
+
# @private
|
|
139
|
+
# @return [Array] Array of latest Gem::Specification
|
|
140
|
+
def rubygems_latest_specs
|
|
141
|
+
# If newer Rubygems
|
|
142
|
+
if ::Gem::Specification.respond_to? :latest_specs
|
|
143
|
+
::Gem::Specification.latest_specs(true)
|
|
144
|
+
else
|
|
145
|
+
::Gem.source_index.latest_specs
|
|
146
|
+
end
|
|
149
147
|
end
|
|
150
148
|
|
|
151
149
|
def __plugin_prefix
|
|
@@ -3,42 +3,48 @@ require 'spec_helper'
|
|
|
3
3
|
require 'fedux_org_stdlib/gem_plugins/plugin_manager'
|
|
4
4
|
|
|
5
5
|
RSpec.describe GemPlugins::PluginManager do
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
module FeduxOrgStdlib
|
|
7
|
+
module Fixtures
|
|
8
|
+
module PluginManager
|
|
9
|
+
module Load
|
|
10
|
+
class PluginManager < GemPlugins::PluginManager
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
13
14
|
end
|
|
14
15
|
end
|
|
15
16
|
|
|
16
|
-
context '#
|
|
17
|
-
it '
|
|
18
|
-
|
|
19
|
-
manager.disable_plugin 'plugin-no_load'
|
|
20
|
-
manager.load_plugins
|
|
17
|
+
context '#activate_plugin' do
|
|
18
|
+
it 'loads available plugins by its name' do
|
|
19
|
+
FeduxOrgStdlib::Fixtures::PluginManager::Load::PluginManager.new
|
|
21
20
|
|
|
22
|
-
expect('FeduxOrgStdlib::Fixtures::PluginManager::Plugin::
|
|
21
|
+
expect('FeduxOrgStdlib::Fixtures::PluginManager::Plugin::Load').not_to be_defined
|
|
23
22
|
end
|
|
24
23
|
|
|
25
|
-
it '
|
|
26
|
-
manager =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
it 'loads available plugins only on request' do
|
|
25
|
+
manager = FeduxOrgStdlib::Fixtures::PluginManager::Load::PluginManager.new
|
|
26
|
+
manager.activate_plugin 'fedux_org_stdlib-fixtures-plugin_manager-load'
|
|
27
|
+
|
|
28
|
+
expect('FeduxOrgStdlib::Fixtures::PluginManager::Plugin::Load').to be_defined
|
|
29
|
+
end
|
|
30
|
+
end
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
it 'outputs warning if plugin cannout be found' do
|
|
33
|
+
manager = FeduxOrgStdlib::Fixtures::PluginManager::Load::PluginManager.new
|
|
34
|
+
|
|
35
|
+
result = capture :stderr do
|
|
36
|
+
manager.activate_plugin 'plugin-blub'
|
|
32
37
|
end
|
|
38
|
+
|
|
39
|
+
expect(result).to include 'plugin-blub'
|
|
33
40
|
end
|
|
34
41
|
|
|
35
42
|
context '#to_s' do
|
|
36
43
|
it 'has a string representation' do
|
|
37
|
-
manager =
|
|
38
|
-
manager.
|
|
39
|
-
manager.load_plugins
|
|
44
|
+
manager = FeduxOrgStdlib::Fixtures::PluginManager::Load::PluginManager.new
|
|
45
|
+
manager.activate_plugin 'fedux_org_stdlib-fixtures-plugin_manager-load'
|
|
40
46
|
|
|
41
|
-
expect(manager.to_s).to include '
|
|
47
|
+
expect(manager.to_s).to include '1 row in set'
|
|
42
48
|
end
|
|
43
49
|
end
|
|
44
50
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fedux_org-stdlib
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.7.
|
|
4
|
+
version: 0.7.33
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Max Meyer
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-10-
|
|
11
|
+
date: 2014-10-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -50,10 +50,9 @@ files:
|
|
|
50
50
|
- doc/logic_converters.md
|
|
51
51
|
- doc/models.md
|
|
52
52
|
- fedux_org-stdlib.gemspec
|
|
53
|
-
- fixtures/plugin-load-app/fedux_org_stdlib-fixtures-plugin_manager-
|
|
54
|
-
- fixtures/plugin-load-app/lib/fedux_org_stdlib
|
|
55
|
-
- fixtures/plugin-
|
|
56
|
-
- fixtures/plugin-no_load-app/lib/fedux_org_stdlib/fixtures/plugin_manager/plugin/no_load.rb
|
|
53
|
+
- fixtures/plugin-load-app/fedux_org_stdlib-fixtures-plugin_manager-load.gemspec
|
|
54
|
+
- fixtures/plugin-load-app/lib/fedux_org_stdlib-fixtures-plugin_manager-load-plugin.rb
|
|
55
|
+
- fixtures/plugin-load-app/lib/fedux_org_stdlib-fixtures-plugin_manager-load.rb
|
|
57
56
|
- lib/fedux_org_stdlib.rb
|
|
58
57
|
- lib/fedux_org_stdlib/app_config.rb
|
|
59
58
|
- lib/fedux_org_stdlib/app_config/exceptions.rb
|
data/fixtures/plugin-no_load-app/fedux_org_stdlib-fixtures-plugin_manager-plugin-no_load.gemspec
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
-
|
|
5
|
-
Gem::Specification.new do |spec|
|
|
6
|
-
spec.name = 'fedux_org_stdlib-fixtures-plugin_manager-plugin-no_load'
|
|
7
|
-
spec.version = '0.0.1'
|
|
8
|
-
spec.authors = ['blub']
|
|
9
|
-
spec.email = ['example@email.com']
|
|
10
|
-
spec.summary = 'Summary'
|
|
11
|
-
spec.homepage = ''
|
|
12
|
-
spec.license = 'MIT'
|
|
13
|
-
|
|
14
|
-
spec.files = `git ls-files -z`.split("\x0")
|
|
15
|
-
spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
|
|
16
|
-
spec.test_files = spec.files.grep(/^(test|spec|features)\//)
|
|
17
|
-
spec.require_paths = ['lib']
|
|
18
|
-
|
|
19
|
-
spec.add_development_dependency 'bundler', '~> 1.6'
|
|
20
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
|
21
|
-
end
|