pluginator 1.1.0 → 1.2.0
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/.noexec.yaml +1 -0
- data/.travis.yml +5 -1
- data/Changelog.md +5 -0
- data/Gemfile +6 -3
- data/Guardfile +17 -0
- data/README.md +18 -0
- data/Rakefile +22 -3
- data/lib/pluginator/autodetect.rb +61 -18
- data/lib/pluginator/group.rb +1 -1
- data/lib/pluginator/version.rb +1 -1
- data/pluginator.gemspec +4 -1
- data/test/gems/gems/fake-gem-name-a-1.0.0/lib/fake-gem-name-a.rb +1 -0
- data/{demo → test/gems/gems/fake-gem-name-a-1.0.0/lib}/plugins/something/math/decrease.rb +0 -0
- data/{demo → test/gems/gems/fake-gem-name-a-1.0.0/lib}/plugins/something/math/increase.rb +0 -0
- data/{demo → test/gems/gems/fake-gem-name-a-1.0.0/lib}/plugins/something/nested/structure/test.rb +0 -0
- data/{demo → test/gems/gems/fake-gem-name-a-1.0.0/lib}/plugins/something/stats/max.rb +0 -0
- data/test/gems/gems/fake-gem-name-latest-1.0.0/lib/fake-gem-name-latest.rb +1 -0
- data/test/gems/gems/fake-gem-name-latest-1.0.0/lib/plugins/latest/version1/max.rb +29 -0
- data/test/gems/gems/fake-gem-name-latest-2.0.0/lib/fake-gem-name-latest.rb +1 -0
- data/test/gems/gems/fake-gem-name-latest-2.0.0/lib/plugins/latest/version2/max.rb +29 -0
- data/test/gems/gems/fake-gem-name-v1a-1.0.0/lib/fake-gem-name-v1a.rb +1 -0
- data/test/gems/gems/fake-gem-name-v1a-1.0.0/lib/plugins/v1test/stats/max.rb +29 -0
- data/test/gems/gems/fake-gem-name-v1b-1.0.0/lib/fake-gem-name-v1a.rb +1 -0
- data/test/gems/gems/fake-gem-name-v1b-1.0.0/lib/plugins/v1test/stats/max.rb +29 -0
- data/test/gems/gems/fake-gem-name-v2a-1.0.0/lib/fake-gem-name-v2a.rb +1 -0
- data/test/gems/gems/fake-gem-name-v2a-1.0.0/lib/plugins/v2test/stats/max.rb +29 -0
- data/test/gems/gems/fake-gem-name-v2b-1.0.0/lib/fake-gem-name-v2b.rb +1 -0
- data/test/gems/gems/fake-gem-name-v2b-1.0.0/lib/plugins/v2test/stats/max.rb +29 -0
- data/test/gems/specifications/fake-gem-name-a-1.0.0.gemspec +21 -0
- data/test/gems/specifications/fake-gem-name-latest-1.0.0.gemspec +21 -0
- data/test/gems/specifications/fake-gem-name-latest-2.0.0.gemspec +21 -0
- data/test/gems/specifications/fake-gem-name-v1a-1.0.0.gemspec +21 -0
- data/test/gems/specifications/fake-gem-name-v1b-1.0.0.gemspec +24 -0
- data/test/gems/specifications/fake-gem-name-v2a-1.0.0.gemspec +24 -0
- data/test/gems/specifications/fake-gem-name-v2b-1.0.0.gemspec +24 -0
- data/test/gems/specifications/pluginator-1.1.0.gemspec +44 -0
- data/test/pluginator/autodetect_test.rb +35 -9
- data/test/pluginator_test.rb +64 -8
- data/test/plugins_test/extensions/class_exist_test.rb +9 -8
- data/test/test_helper.rb +38 -3
- metadata +55 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5f89e736b2a03c5c15a34e795805bf9b7bb65de
|
4
|
+
data.tar.gz: 8bffb346e9161538eaddc7387ab0899e485fc927
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f3878958c681e05d883c2ee0aace907b31d9500be9ca2fa2f1596bf3bcb2cc582818aae0bc860dd9fd96228fd808050be8357d485aefea81c751439f8d2c0b3
|
7
|
+
data.tar.gz: f112ef035f0632413082f639c29ad89b3e2e1e2324c7ae8cbcfcb718f6faafb198c255d7654b78828c81ea7465c2e19c7cfaf1f73c118527b19074dd054d01a9
|
data/.noexec.yaml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
exclude: [rake,guard]
|
data/.travis.yml
CHANGED
@@ -2,12 +2,16 @@ language: ruby
|
|
2
2
|
rvm:
|
3
3
|
- jruby
|
4
4
|
- ruby-head
|
5
|
-
- 2.1
|
5
|
+
- 2.1
|
6
6
|
- 2.0.0
|
7
7
|
- 1.9.3
|
8
8
|
- 1.9.2
|
9
9
|
- 1.8.7
|
10
10
|
- rbx
|
11
|
+
before_script:
|
12
|
+
- 'if [[ "$TRAVIS_RUBY_VERSION" == rbx ]]; then gem update bundler; fi'
|
13
|
+
script:
|
14
|
+
- NOEXEC_DISABLE=1 rake
|
11
15
|
notifications:
|
12
16
|
irc:
|
13
17
|
channels:
|
data/Changelog.md
CHANGED
data/Gemfile
CHANGED
@@ -25,7 +25,10 @@ gemspec
|
|
25
25
|
|
26
26
|
group :development do
|
27
27
|
# statistics only on MRI 2.0 - avoid problems on older rubies
|
28
|
-
gem "redcarpet",
|
29
|
-
gem "simplecov",
|
30
|
-
gem "coveralls",
|
28
|
+
gem "redcarpet", :platforms => [:mri_20]
|
29
|
+
gem "simplecov", :platforms => [:mri_20]
|
30
|
+
gem "coveralls", :platforms => [:mri_20]
|
31
|
+
gem "guard", :platforms => [:mri_20]
|
32
|
+
gem "guard-minitest", :platforms => [:mri_20]
|
33
|
+
gem "guard-yard", :platforms => [:mri_20]
|
31
34
|
end
|
data/Guardfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard :minitest, :include => %w[lib test], :bundler => false do
|
5
|
+
watch(%r{^lib/plugins/pluginator/(.*/)?([^/]+)\.rb$}) { |m|
|
6
|
+
"test/plugins_test/#{m[1]}#{m[2]}_test.rb"
|
7
|
+
}
|
8
|
+
watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m|
|
9
|
+
"test/#{m[1]}#{m[2]}_test.rb"
|
10
|
+
}
|
11
|
+
watch(%r{^test/(.*)\/?(.*)_test\.rb$})
|
12
|
+
watch(%r{^test/test_helper\.rb$}) { 'test' }
|
13
|
+
end
|
14
|
+
|
15
|
+
guard 'yard' do
|
16
|
+
watch(%r{^lib/.+\.rb})
|
17
|
+
end
|
data/README.md
CHANGED
@@ -129,6 +129,18 @@ plugins.first_one("<type>") => first_plugin # nil when none
|
|
129
129
|
- `MissingPlugin` - raised when plugin can not be found, generated by `*!` methods
|
130
130
|
- `MissingType` - raised when type can not be found, generated by `*!` methods
|
131
131
|
|
132
|
+
## Versioning plugins
|
133
|
+
|
134
|
+
In case plugin gets moved to other gem you can sdpecify which gem to
|
135
|
+
use for loading the plugin by specifying plugin version in gems gemspec
|
136
|
+
metadata:
|
137
|
+
|
138
|
+
```ruby
|
139
|
+
s.metadata = {
|
140
|
+
"plugins/v2test/stats/max.rb" => "1"
|
141
|
+
}
|
142
|
+
```
|
143
|
+
|
132
144
|
## Examples
|
133
145
|
|
134
146
|
### Example 1 - task plugins
|
@@ -191,6 +203,12 @@ Pluginator.find("rvm2", type: "hooks/after_install").type.each{ |plugin|
|
|
191
203
|
}
|
192
204
|
```
|
193
205
|
|
206
|
+
## Testing
|
207
|
+
|
208
|
+
```bash
|
209
|
+
NOEXEC_DISABLE=1 rake test
|
210
|
+
```
|
211
|
+
|
194
212
|
## License
|
195
213
|
|
196
214
|
Copyright 2013 Michal Papis <mpapis@gmail.com>
|
data/Rakefile
CHANGED
@@ -19,12 +19,31 @@ You should have received a copy of the GNU Lesser General Public License
|
|
19
19
|
along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
20
20
|
=end
|
21
21
|
|
22
|
-
|
22
|
+
default_tasks = []
|
23
|
+
|
24
|
+
begin
|
25
|
+
require "yard"
|
26
|
+
YARD::Rake::YardocTask.new do |t|
|
27
|
+
t.files = ["lib/**/*.rb"]
|
28
|
+
# TODO: see https://github.com/lsegal/yard/pull/800
|
29
|
+
#~ t.stats_options = ["--list-undoc", "--compact"]
|
30
|
+
t.options = ["--no-stats"]
|
31
|
+
t.after = Proc.new do
|
32
|
+
YARD::CLI::Stats.new.run("--list-undoc", "--compact", "--use-cache")
|
33
|
+
end
|
34
|
+
end
|
23
35
|
|
24
|
-
task :
|
36
|
+
task :docs => [:yard]
|
37
|
+
default_tasks << :yard
|
38
|
+
rescue LoadError
|
39
|
+
end
|
25
40
|
|
41
|
+
require "rake/testtask"
|
26
42
|
Rake::TestTask.new do |t|
|
27
43
|
t.verbose = true
|
28
|
-
t.libs.push("
|
44
|
+
t.libs.push("test")
|
29
45
|
t.pattern = "test/**/*_test.rb"
|
30
46
|
end
|
47
|
+
default_tasks << :test
|
48
|
+
|
49
|
+
task :default => default_tasks
|
@@ -35,6 +35,7 @@ module Pluginator
|
|
35
35
|
setup_autodetect(options[:type])
|
36
36
|
end
|
37
37
|
|
38
|
+
# Return the forced type
|
38
39
|
def type
|
39
40
|
@plugins[@force_type] unless @force_type.nil?
|
40
41
|
end
|
@@ -57,33 +58,75 @@ module Pluginator
|
|
57
58
|
end
|
58
59
|
|
59
60
|
def load_files(file_names)
|
60
|
-
file_names.each do |
|
61
|
-
|
61
|
+
unique_gemspec_paths(file_names).each do |gemspec, path, name, type|
|
62
|
+
gemspec.activate
|
62
63
|
load_plugin(path) and
|
63
64
|
register_plugin(type, name2class(name))
|
64
65
|
end
|
65
66
|
end
|
66
67
|
|
67
|
-
def
|
68
|
-
|
68
|
+
def unique_gemspec_paths(file_names)
|
69
|
+
all = gemspec_and_paths(file_names)
|
70
|
+
gemspecs = all.map(&:first)
|
71
|
+
selected =
|
72
|
+
gemspecs.group_by{|spec| spec.name}.map(&:last).map do |specs|
|
73
|
+
activated = specs.find(&:activated?)
|
74
|
+
activated || specs.sort.last
|
75
|
+
end
|
76
|
+
all.map do |gemspec, path, name, type|
|
77
|
+
found = selected.find{|spec| spec == gemspec}
|
78
|
+
[found, path, name, type] if found
|
79
|
+
end.compact
|
80
|
+
end
|
81
|
+
|
82
|
+
def gemspec_and_paths(file_names)
|
83
|
+
unique_parsed_paths(file_names).map do |path, name, type|
|
84
|
+
gemspec = gemspec_for_path(path)
|
85
|
+
[gemspec, path, name, type] if gemspec
|
86
|
+
end.compact
|
87
|
+
end
|
88
|
+
|
89
|
+
def unique_parsed_paths(file_names)
|
90
|
+
file_names.map do |file_name|
|
91
|
+
split_file_name(file_name, @group)
|
92
|
+
end.sort.uniq
|
93
|
+
end
|
94
|
+
|
95
|
+
def gemspec_for_path(path)
|
96
|
+
gemspecs = Gem::Specification._all.reject do |spec|
|
97
|
+
Dir.glob( File.join( spec.lib_dirs_glob, path ) ).empty?
|
98
|
+
end
|
99
|
+
case gemspecs.size
|
100
|
+
when 0
|
101
|
+
nil
|
102
|
+
when 1
|
103
|
+
gemspecs.first
|
104
|
+
else
|
105
|
+
find_latest_plugin_version(gemspecs, path)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def find_latest_plugin_version(gemspecs, path)
|
110
|
+
gemspecs = gemspecs.sort_by{|spec| [((spec.metadata||{})[path]||"0").to_i, spec.name, spec.version]}
|
111
|
+
last = gemspecs.last
|
112
|
+
return last if gemspecs.size == 1
|
113
|
+
|
114
|
+
activated = gemspecs.find(&:activated?)
|
115
|
+
best = Gem::Specification.find_by_path(path)
|
69
116
|
if
|
70
|
-
|
117
|
+
(activated.nil? || last == activated) &&
|
118
|
+
!best.activated?
|
71
119
|
then
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
end
|
76
|
-
gemspec.activate if !gemspec.activated? && activated.nil?
|
77
|
-
if
|
78
|
-
activated.nil? || activated == gemspec
|
79
|
-
then
|
80
|
-
require path
|
81
|
-
true
|
82
|
-
else
|
83
|
-
nil
|
84
|
-
end
|
120
|
+
last
|
121
|
+
else
|
122
|
+
best
|
85
123
|
end
|
86
124
|
end
|
87
125
|
|
126
|
+
def load_plugin(path)
|
127
|
+
require path
|
128
|
+
true
|
129
|
+
end
|
130
|
+
|
88
131
|
end
|
89
132
|
end
|
data/lib/pluginator/group.rb
CHANGED
data/lib/pluginator/version.rb
CHANGED
data/pluginator.gemspec
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# -*- encoding: utf-8 -*-
|
3
|
+
# stub: PLUGINATOR ruby lib
|
3
4
|
|
4
5
|
=begin
|
5
6
|
Copyright 2013
|
@@ -22,7 +23,9 @@ You should have received a copy of the GNU Lesser General Public License
|
|
22
23
|
along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
23
24
|
=end
|
24
25
|
|
25
|
-
|
26
|
+
lib = File.expand_path('../lib', __FILE__)
|
27
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
28
|
+
require "pluginator/version"
|
26
29
|
|
27
30
|
Gem::Specification.new do |s|
|
28
31
|
s.email = ["mpapis@gmail.com", "envygeeks@gmail.com", "mose@mose.com"]
|
@@ -0,0 +1 @@
|
|
1
|
+
|
File without changes
|
File without changes
|
data/{demo → test/gems/gems/fake-gem-name-a-1.0.0/lib}/plugins/something/nested/structure/test.rb
RENAMED
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright 2013 Michal Papis <mpapis@gmail.com>
|
3
|
+
|
4
|
+
This file is part of pluginator.
|
5
|
+
|
6
|
+
pluginator is free software: you can redistribute it and/or modify
|
7
|
+
it under the terms of the GNU Lesser General Public License as published
|
8
|
+
by the Free Software Foundation, either version 3 of the License, or
|
9
|
+
(at your option) any later version.
|
10
|
+
|
11
|
+
pluginator is distributed in the hope that it will be useful,
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
GNU Lesser General Public License for more details.
|
15
|
+
|
16
|
+
You should have received a copy of the GNU Lesser General Public License
|
17
|
+
along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
=end
|
19
|
+
|
20
|
+
class Latest::Version1::Max
|
21
|
+
|
22
|
+
def self.handles?(what)
|
23
|
+
%w{ max maximum }.include?(what)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.action
|
27
|
+
42
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright 2013 Michal Papis <mpapis@gmail.com>
|
3
|
+
|
4
|
+
This file is part of pluginator.
|
5
|
+
|
6
|
+
pluginator is free software: you can redistribute it and/or modify
|
7
|
+
it under the terms of the GNU Lesser General Public License as published
|
8
|
+
by the Free Software Foundation, either version 3 of the License, or
|
9
|
+
(at your option) any later version.
|
10
|
+
|
11
|
+
pluginator is distributed in the hope that it will be useful,
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
GNU Lesser General Public License for more details.
|
15
|
+
|
16
|
+
You should have received a copy of the GNU Lesser General Public License
|
17
|
+
along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
=end
|
19
|
+
|
20
|
+
class Latest::Version2::Max
|
21
|
+
|
22
|
+
def self.handles?(what)
|
23
|
+
%w{ max maximum }.include?(what)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.action
|
27
|
+
42
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright 2013 Michal Papis <mpapis@gmail.com>
|
3
|
+
|
4
|
+
This file is part of pluginator.
|
5
|
+
|
6
|
+
pluginator is free software: you can redistribute it and/or modify
|
7
|
+
it under the terms of the GNU Lesser General Public License as published
|
8
|
+
by the Free Software Foundation, either version 3 of the License, or
|
9
|
+
(at your option) any later version.
|
10
|
+
|
11
|
+
pluginator is distributed in the hope that it will be useful,
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
GNU Lesser General Public License for more details.
|
15
|
+
|
16
|
+
You should have received a copy of the GNU Lesser General Public License
|
17
|
+
along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
=end
|
19
|
+
|
20
|
+
class V1test::Stats::Max
|
21
|
+
|
22
|
+
def self.handles?(what)
|
23
|
+
%w{ max maximum }.include?(what)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.action
|
27
|
+
41
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright 2013 Michal Papis <mpapis@gmail.com>
|
3
|
+
|
4
|
+
This file is part of pluginator.
|
5
|
+
|
6
|
+
pluginator is free software: you can redistribute it and/or modify
|
7
|
+
it under the terms of the GNU Lesser General Public License as published
|
8
|
+
by the Free Software Foundation, either version 3 of the License, or
|
9
|
+
(at your option) any later version.
|
10
|
+
|
11
|
+
pluginator is distributed in the hope that it will be useful,
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
GNU Lesser General Public License for more details.
|
15
|
+
|
16
|
+
You should have received a copy of the GNU Lesser General Public License
|
17
|
+
along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
=end
|
19
|
+
|
20
|
+
class V1test::Stats::Max
|
21
|
+
|
22
|
+
def self.handles?(what)
|
23
|
+
%w{ max maximum }.include?(what)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.action
|
27
|
+
42
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright 2013 Michal Papis <mpapis@gmail.com>
|
3
|
+
|
4
|
+
This file is part of pluginator.
|
5
|
+
|
6
|
+
pluginator is free software: you can redistribute it and/or modify
|
7
|
+
it under the terms of the GNU Lesser General Public License as published
|
8
|
+
by the Free Software Foundation, either version 3 of the License, or
|
9
|
+
(at your option) any later version.
|
10
|
+
|
11
|
+
pluginator is distributed in the hope that it will be useful,
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
GNU Lesser General Public License for more details.
|
15
|
+
|
16
|
+
You should have received a copy of the GNU Lesser General Public License
|
17
|
+
along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
=end
|
19
|
+
|
20
|
+
class V2test::Stats::Max
|
21
|
+
|
22
|
+
def self.handles?(what)
|
23
|
+
%w{ max maximum }.include?(what)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.action
|
27
|
+
41
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright 2013 Michal Papis <mpapis@gmail.com>
|
3
|
+
|
4
|
+
This file is part of pluginator.
|
5
|
+
|
6
|
+
pluginator is free software: you can redistribute it and/or modify
|
7
|
+
it under the terms of the GNU Lesser General Public License as published
|
8
|
+
by the Free Software Foundation, either version 3 of the License, or
|
9
|
+
(at your option) any later version.
|
10
|
+
|
11
|
+
pluginator is distributed in the hope that it will be useful,
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
GNU Lesser General Public License for more details.
|
15
|
+
|
16
|
+
You should have received a copy of the GNU Lesser General Public License
|
17
|
+
along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
=end
|
19
|
+
|
20
|
+
class V2test::Stats::Max
|
21
|
+
|
22
|
+
def self.handles?(what)
|
23
|
+
%w{ max maximum }.include?(what)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.action
|
27
|
+
42
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# stub: fake-gem-name-a 1.0.0 ruby lib
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "fake-gem-name-a"
|
6
|
+
s.version = "1.0.0"
|
7
|
+
|
8
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
|
+
s.require_paths = ["lib"]
|
10
|
+
s.authors = ["Michal Papis"]
|
11
|
+
s.date = "2014-09-21"
|
12
|
+
s.description = "Do nothing"
|
13
|
+
s.email = ["mpapis@gmail.com"]
|
14
|
+
s.files = Dir["../../gems/#{s.name}-#{s.version}/lib/**/*.rb"]
|
15
|
+
s.homepage = "https://rvm.io"
|
16
|
+
s.licenses = ["LGPL v3"]
|
17
|
+
s.rubygems_version = "2.2.2"
|
18
|
+
s.summary = "Do Nothing"
|
19
|
+
|
20
|
+
s.installed_by_version = "2.2.2" if s.respond_to? :installed_by_version
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# stub: fake-gem-name-latest 1.0.0 ruby lib
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "fake-gem-name-latest"
|
6
|
+
s.version = "1.0.0"
|
7
|
+
|
8
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
|
+
s.require_paths = ["lib"]
|
10
|
+
s.authors = ["Michal Papis"]
|
11
|
+
s.date = "2014-09-21"
|
12
|
+
s.description = "Do nothing"
|
13
|
+
s.email = ["mpapis@gmail.com"]
|
14
|
+
s.files = Dir["../../gems/#{s.name}-#{s.version}/lib/**/*.rb"]
|
15
|
+
s.homepage = "https://rvm.io"
|
16
|
+
s.licenses = ["LGPL v3"]
|
17
|
+
s.rubygems_version = "2.2.2"
|
18
|
+
s.summary = "Do Nothing"
|
19
|
+
|
20
|
+
s.installed_by_version = "2.2.2" if s.respond_to? :installed_by_version
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# stub: fake-gem-name-latest 2.0.0 ruby lib
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "fake-gem-name-latest"
|
6
|
+
s.version = "2.0.0"
|
7
|
+
|
8
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
|
+
s.require_paths = ["lib"]
|
10
|
+
s.authors = ["Michal Papis"]
|
11
|
+
s.date = "2014-09-21"
|
12
|
+
s.description = "Do nothing"
|
13
|
+
s.email = ["mpapis@gmail.com"]
|
14
|
+
s.files = Dir["../../gems/#{s.name}-#{s.version}/lib/**/*.rb"]
|
15
|
+
s.homepage = "https://rvm.io"
|
16
|
+
s.licenses = ["LGPL v3"]
|
17
|
+
s.rubygems_version = "2.2.2"
|
18
|
+
s.summary = "Do Nothing"
|
19
|
+
|
20
|
+
s.installed_by_version = "2.2.2" if s.respond_to? :installed_by_version
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# stub: fake-gem-name-v1a 1.0.0 ruby lib
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "fake-gem-name-v1a"
|
6
|
+
s.version = "1.0.0"
|
7
|
+
|
8
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
|
+
s.require_paths = ["lib"]
|
10
|
+
s.authors = ["Michal Papis"]
|
11
|
+
s.date = "2014-09-21"
|
12
|
+
s.description = "Do nothing"
|
13
|
+
s.email = ["mpapis@gmail.com"]
|
14
|
+
s.files = Dir["../../gems/#{s.name}-#{s.version}/lib/**/*.rb"]
|
15
|
+
s.homepage = "https://rvm.io"
|
16
|
+
s.licenses = ["LGPL v3"]
|
17
|
+
s.rubygems_version = "2.2.2"
|
18
|
+
s.summary = "Do Nothing"
|
19
|
+
|
20
|
+
s.installed_by_version = "2.2.2" if s.respond_to? :installed_by_version
|
21
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# stub: fake-gem-name-v1b 1.0.0 ruby lib
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "fake-gem-name-v1b"
|
6
|
+
s.version = "1.0.0"
|
7
|
+
|
8
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
|
+
s.require_paths = ["lib"]
|
10
|
+
s.authors = ["Michal Papis"]
|
11
|
+
s.date = "2014-09-21"
|
12
|
+
s.description = "Do nothing"
|
13
|
+
s.email = ["mpapis@gmail.com"]
|
14
|
+
s.files = Dir["../../gems/#{s.name}-#{s.version}/lib/**/*.rb"]
|
15
|
+
s.homepage = "https://rvm.io"
|
16
|
+
s.licenses = ["LGPL v3"]
|
17
|
+
s.rubygems_version = "2.2.2"
|
18
|
+
s.summary = "Do Nothing"
|
19
|
+
s.metadata = {
|
20
|
+
"plugins/v1test/stats/max.rb" => "1"
|
21
|
+
}
|
22
|
+
|
23
|
+
s.installed_by_version = "2.2.2" if s.respond_to? :installed_by_version
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# stub: fake-gem-name-v2a 1.0.0 ruby lib
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "fake-gem-name-v2a"
|
6
|
+
s.version = "1.0.0"
|
7
|
+
|
8
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
|
+
s.require_paths = ["lib"]
|
10
|
+
s.authors = ["Michal Papis"]
|
11
|
+
s.date = "2014-09-21"
|
12
|
+
s.description = "Do nothing"
|
13
|
+
s.email = ["mpapis@gmail.com"]
|
14
|
+
s.files = Dir["../../gems/#{s.name}-#{s.version}/lib/**/*.rb"]
|
15
|
+
s.homepage = "https://rvm.io"
|
16
|
+
s.licenses = ["LGPL v3"]
|
17
|
+
s.rubygems_version = "2.2.2"
|
18
|
+
s.summary = "Do Nothing"
|
19
|
+
s.metadata = {
|
20
|
+
"plugins/v2test/stats/max.rb" => "2"
|
21
|
+
}
|
22
|
+
|
23
|
+
s.installed_by_version = "2.2.2" if s.respond_to? :installed_by_version
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# stub: fake-gem-name-v2b 1.0.0 ruby lib
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "fake-gem-name-v2b"
|
6
|
+
s.version = "1.0.0"
|
7
|
+
|
8
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
|
+
s.require_paths = ["lib"]
|
10
|
+
s.authors = ["Michal Papis"]
|
11
|
+
s.date = "2014-09-21"
|
12
|
+
s.description = "Do nothing"
|
13
|
+
s.email = ["mpapis@gmail.com"]
|
14
|
+
s.files = Dir["../../gems/#{s.name}-#{s.version}/lib/**/*.rb"]
|
15
|
+
s.homepage = "https://rvm.io"
|
16
|
+
s.licenses = ["LGPL v3"]
|
17
|
+
s.rubygems_version = "2.2.2"
|
18
|
+
s.summary = "Do Nothing"
|
19
|
+
s.metadata = {
|
20
|
+
"plugins/v2test/stats/max.rb" => "1"
|
21
|
+
}
|
22
|
+
|
23
|
+
s.installed_by_version = "2.2.2" if s.respond_to? :installed_by_version
|
24
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- encoding: utf-8 -*-
|
3
|
+
# stub: PLUGINATOR ruby lib
|
4
|
+
|
5
|
+
=begin
|
6
|
+
Copyright 2013
|
7
|
+
- Michal Papis <mpapis@gmail.com>
|
8
|
+
- Jordon Bedwell <envygeeks@gmail.com>
|
9
|
+
|
10
|
+
This file is part of pluginator.
|
11
|
+
|
12
|
+
pluginator is free software: you can redistribute it and/or modify
|
13
|
+
it under the terms of the GNU Lesser General Public License as published
|
14
|
+
by the Free Software Foundation, either version 3 of the License, or
|
15
|
+
(at your option) any later version.
|
16
|
+
|
17
|
+
pluginator is distributed in the hope that it will be useful,
|
18
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
20
|
+
GNU Lesser General Public License for more details.
|
21
|
+
|
22
|
+
You should have received a copy of the GNU Lesser General Public License
|
23
|
+
along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
24
|
+
=end
|
25
|
+
|
26
|
+
lib = File.expand_path('../lib', __FILE__)
|
27
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
28
|
+
require "pluginator/version"
|
29
|
+
|
30
|
+
Gem::Specification.new do |s|
|
31
|
+
s.email = ["mpapis@gmail.com", "envygeeks@gmail.com", "mose@mose.com"]
|
32
|
+
s.authors = ["Michal Papis", "Jordon Bedwell", "Mose"]
|
33
|
+
s.name = "pluginator"
|
34
|
+
s.version = Pluginator::VERSION
|
35
|
+
s.license = "LGPL v3"
|
36
|
+
s.files = `git ls-files`.split("\n")
|
37
|
+
s.required_ruby_version = ">= 1.8.7"
|
38
|
+
s.add_development_dependency("rake")
|
39
|
+
s.add_development_dependency("minitest")
|
40
|
+
# s.add_development_dependency("smf-gem")
|
41
|
+
s.homepage = "https://github.com/rvm/pluginator"
|
42
|
+
s.summary = "Rubygems plugin system using Gem.find_files."
|
43
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
44
|
+
end
|
@@ -20,18 +20,29 @@ along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
require 'test_helper'
|
21
21
|
require 'pluginator/autodetect'
|
22
22
|
|
23
|
-
def
|
24
|
-
|
23
|
+
def gem_file(path, options = {})
|
24
|
+
options.merge!({
|
25
|
+
:gem_name => "fake-gem-name-a",
|
26
|
+
:gem_version => "1.0.0",
|
27
|
+
})
|
28
|
+
File.expand_path(
|
29
|
+
File.join(
|
30
|
+
"../../gems/gems/#{options[:gem_name]}-#{options[:gem_version]}/lib",
|
31
|
+
path
|
32
|
+
),
|
33
|
+
__FILE__
|
34
|
+
)
|
25
35
|
end
|
26
36
|
|
27
|
-
def
|
28
|
-
paths.
|
37
|
+
def gem_files(*paths)
|
38
|
+
options = paths.last.is_a?(::Hash) ? paths.pop : {}
|
39
|
+
paths.flatten.map{|path| gem_file(path, options) }
|
29
40
|
end
|
30
41
|
|
31
42
|
describe Pluginator::Autodetect do
|
32
43
|
before do
|
33
|
-
@math_files =
|
34
|
-
@all_files =
|
44
|
+
@math_files = gem_files("plugins/something/math/increase.rb", "plugins/something/math/decrease.rb")
|
45
|
+
@all_files = gem_files(
|
35
46
|
"plugins/something/math/increase.rb", "plugins/something/math/decrease.rb",
|
36
47
|
"plugins/something/nested/structure/test.rb", "plugins/something/stats/max.rb"
|
37
48
|
)
|
@@ -47,12 +58,12 @@ describe Pluginator::Autodetect do
|
|
47
58
|
@pluginator.group.must_equal("something")
|
48
59
|
end
|
49
60
|
|
50
|
-
it "has
|
51
|
-
File.exists?(
|
61
|
+
it "has gem file" do
|
62
|
+
File.exists?(gem_file("plugins/something/math/increase.rb")).must_equal(true)
|
52
63
|
end
|
53
64
|
|
54
65
|
it "loads plugin" do
|
55
|
-
@pluginator.send(:load_plugin, "plugins/something/math/increase.rb")
|
66
|
+
@pluginator.send(:load_plugin, "plugins/something/math/increase.rb").must_equal(true)
|
56
67
|
end
|
57
68
|
|
58
69
|
it "finds files existing group" do
|
@@ -105,6 +116,7 @@ describe Pluginator::Autodetect do
|
|
105
116
|
|
106
117
|
it "makes group plugins work" do
|
107
118
|
pluginator = Pluginator::Autodetect.new("something")
|
119
|
+
pluginator.types.must_include('math')
|
108
120
|
pluginator["math"].detect{|plugin| plugin.type == "increase" }.action(2).must_equal(3)
|
109
121
|
pluginator["math"].detect{|plugin| plugin.type == "decrease" }.action(5).must_equal(4)
|
110
122
|
end
|
@@ -122,4 +134,18 @@ describe Pluginator::Autodetect do
|
|
122
134
|
pluginator.type.must_equal(pluginator['math'])
|
123
135
|
end
|
124
136
|
|
137
|
+
it "loads self" do
|
138
|
+
pluginator = Pluginator::Autodetect.new("pluginator")
|
139
|
+
pluginator.types.must_include('extensions')
|
140
|
+
pluginator.types.size.must_equal(1)
|
141
|
+
pluginator["extensions"].map(&:to_s).sort.must_equal([
|
142
|
+
"Pluginator::Extensions::ClassExist",
|
143
|
+
"Pluginator::Extensions::Conversions",
|
144
|
+
"Pluginator::Extensions::FirstAsk",
|
145
|
+
"Pluginator::Extensions::FirstClass",
|
146
|
+
"Pluginator::Extensions::Matching",
|
147
|
+
"Pluginator::Extensions::PluginsMap"
|
148
|
+
])
|
149
|
+
end
|
150
|
+
|
125
151
|
end
|
data/test/pluginator_test.rb
CHANGED
@@ -20,8 +20,8 @@ along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
require 'test_helper'
|
21
21
|
require 'pluginator'
|
22
22
|
|
23
|
-
|
24
|
-
|
23
|
+
describe Pluginator do
|
24
|
+
it "loads_plugins_automatically_for_group" do
|
25
25
|
pluginator = Pluginator.find("something")
|
26
26
|
pluginator.types.must_include('stats')
|
27
27
|
pluginator.types.must_include('math')
|
@@ -34,24 +34,80 @@ class PluginatorTest < MiniTest::Unit::TestCase
|
|
34
34
|
plugins.wont_include("Something::Math::Add")
|
35
35
|
end
|
36
36
|
|
37
|
-
|
37
|
+
it "loads_plugins_automatically_for_group_type" do
|
38
38
|
pluginator = Pluginator.find("something", :type => "stats")
|
39
39
|
pluginator.types.must_include('stats')
|
40
40
|
pluginator.types.size.must_equal(1)
|
41
41
|
end
|
42
42
|
|
43
|
-
|
43
|
+
it "loads_existing_extensions_symbol" do
|
44
44
|
pluginator = Pluginator.find("something", :extends => :conversions)
|
45
45
|
pluginator.public_methods.map(&:to_sym).must_include(:class2string)
|
46
46
|
pluginator.public_methods.map(&:to_sym).must_include(:string2class)
|
47
47
|
pluginator.public_methods.map(&:to_sym).wont_include(:plugins_map)
|
48
48
|
end
|
49
49
|
|
50
|
-
|
50
|
+
it "loads_nested_plugins" do
|
51
51
|
pluginator = Pluginator.find("something")
|
52
52
|
pluginator.types.must_include('nested/structure')
|
53
|
-
|
54
|
-
|
55
|
-
|
53
|
+
pluginator["nested/structure"].map(&:to_s).must_equal(["Something::Nested::Structure::Test"])
|
54
|
+
end
|
55
|
+
|
56
|
+
it "loads_only_plugins_from_latest_version_of_gem" do
|
57
|
+
all_gems = Gem::Specification._all.map{|s| "#{s.name}-#{s.version}" }
|
58
|
+
all_gems.must_include("fake-gem-name-latest-1.0.0")
|
59
|
+
all_gems.must_include("fake-gem-name-latest-2.0.0")
|
60
|
+
active_gems = Gem::Specification._all.map{|s| "#{s.name}-#{s.version}" if s.activated? }.compact
|
61
|
+
active_gems.wont_include("fake-gem-name-latest-1.0.0")
|
62
|
+
active_gems.wont_include("fake-gem-name-latest-2.0.0")
|
63
|
+
|
64
|
+
pluginator = Pluginator.find("latest")
|
65
|
+
|
66
|
+
active_gems = Gem::Specification._all.map{|s| "#{s.name}-#{s.version}" if s.activated? }.compact
|
67
|
+
active_gems.wont_include("fake-gem-name-latest-1.0.0")
|
68
|
+
active_gems.must_include("fake-gem-name-latest-2.0.0")
|
69
|
+
|
70
|
+
pluginator.types.must_include('version2')
|
71
|
+
pluginator.types.wont_include('version1')
|
72
|
+
pluginator.types.size.must_equal(1)
|
73
|
+
pluginator["version2"].map(&:to_s).must_equal(["Latest::Version2::Max"])
|
74
|
+
end
|
75
|
+
|
76
|
+
it "loads_latest_version_of_plugin_from_two_gems_v1" do
|
77
|
+
all_gems = Gem::Specification._all.map{|s| "#{s.name}-#{s.version}" }
|
78
|
+
all_gems.must_include("fake-gem-name-v1a-1.0.0")
|
79
|
+
all_gems.must_include("fake-gem-name-v1b-1.0.0")
|
80
|
+
active_gems = Gem::Specification._all.map{|s| "#{s.name}-#{s.version}" if s.activated? }.compact
|
81
|
+
active_gems.wont_include("fake-gem-name-v1a-1.0.0")
|
82
|
+
|
83
|
+
pluginator = Pluginator.find("v1test")
|
84
|
+
|
85
|
+
active_gems = Gem::Specification._all.map{|s| "#{s.name}-#{s.version}" if s.activated? }.compact
|
86
|
+
active_gems.wont_include("fake-gem-name-v1a-1.0.0")
|
87
|
+
active_gems.must_include("fake-gem-name-v1b-1.0.0")
|
88
|
+
|
89
|
+
pluginator.types.must_include('stats')
|
90
|
+
pluginator.types.size.must_equal(1)
|
91
|
+
pluginator["stats"].map(&:to_s).must_equal(["V1test::Stats::Max"])
|
92
|
+
pluginator["stats"].first.action.must_equal(42)
|
93
|
+
end
|
94
|
+
|
95
|
+
it "loads_latest_version_of_plugin_from_two_gems_v2" do
|
96
|
+
all_gems = Gem::Specification._all.map{|s| "#{s.name}-#{s.version}" }
|
97
|
+
all_gems.must_include("fake-gem-name-v2a-1.0.0")
|
98
|
+
all_gems.must_include("fake-gem-name-v2b-1.0.0")
|
99
|
+
active_gems = Gem::Specification._all.map{|s| "#{s.name}-#{s.version}" if s.activated? }.compact
|
100
|
+
active_gems.wont_include("fake-gem-name-v2a-1.0.0")
|
101
|
+
|
102
|
+
pluginator = Pluginator.find("v2test")
|
103
|
+
|
104
|
+
active_gems = Gem::Specification._all.map{|s| "#{s.name}-#{s.version}" if s.activated? }.compact
|
105
|
+
active_gems.must_include("fake-gem-name-v2a-1.0.0")
|
106
|
+
active_gems.wont_include("fake-gem-name-v2b-1.0.0")
|
107
|
+
|
108
|
+
pluginator.types.must_include('stats')
|
109
|
+
pluginator.types.size.must_equal(1)
|
110
|
+
pluginator["stats"].map(&:to_s).must_equal(["V2test::Stats::Max"])
|
111
|
+
pluginator["stats"].first.action.must_equal(41)
|
56
112
|
end
|
57
113
|
end
|
@@ -26,19 +26,20 @@ class ClassExistTester
|
|
26
26
|
include Pluginator::Extensions::ClassExist
|
27
27
|
end
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
describe Pluginator::Extensions::ClassExist do
|
30
|
+
subject do
|
31
|
+
tester = ClassExistTester.new
|
32
|
+
tester.plugins = { "stats" => [
|
33
33
|
Something::Stats::Max
|
34
34
|
] }
|
35
|
+
tester
|
35
36
|
end
|
36
37
|
|
37
|
-
|
38
|
-
|
38
|
+
it "plugin exists" do
|
39
|
+
subject.class_exist?("stats", "max").must_equal( true )
|
39
40
|
end
|
40
41
|
|
41
|
-
|
42
|
-
|
42
|
+
it "plugin missing" do
|
43
|
+
subject.class_exist?("stats", "min").must_equal( false )
|
43
44
|
end
|
44
45
|
end
|
data/test/test_helper.rb
CHANGED
@@ -19,8 +19,34 @@ You should have received a copy of the GNU Lesser General Public License
|
|
19
19
|
along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
20
20
|
=end
|
21
21
|
|
22
|
+
require 'rubygems'
|
23
|
+
require 'minitest'
|
24
|
+
|
25
|
+
# fix lib in LOAD_PATH and load version for gems manipulation
|
26
|
+
lib = File.expand_path('../lib', __FILE__)
|
27
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
28
|
+
require "pluginator/version"
|
29
|
+
|
30
|
+
# remove old links in fake gem home
|
31
|
+
`rm -f #{File.expand_path("../gems/specifications/pluginator-*.gemspec", __FILE__)}`
|
32
|
+
`rm -f #{File.expand_path("../gems/gems/pluginator-*", __FILE__)}`
|
33
|
+
|
34
|
+
# create new links in fake gem home
|
35
|
+
File.symlink(File.expand_path("../../pluginator.gemspec", __FILE__), File.expand_path("../gems/specifications/pluginator-#{Pluginator::VERSION}.gemspec", __FILE__))
|
36
|
+
File.symlink(File.expand_path("../../", __FILE__), File.expand_path("../gems/gems/pluginator-#{Pluginator::VERSION}", __FILE__))
|
37
|
+
|
38
|
+
# register our own path with gems
|
39
|
+
# duplicate from Gemfile for non bundler
|
40
|
+
Gem.path << File.expand_path("../gems", __FILE__)
|
41
|
+
Gem.refresh
|
42
|
+
|
43
|
+
# make sure pluginator is available as gem for tests of pluginator plugins
|
44
|
+
#Gem::Specification.add_spec(Gem::Specification.load(File.expand_path("../gems/specifications/pluginator-#{Pluginator::VERSION}.gemspec", __FILE__)))
|
45
|
+
gem 'pluginator'
|
46
|
+
|
22
47
|
if
|
23
|
-
RUBY_VERSION == "2.0.0" # check Gemfile
|
48
|
+
RUBY_VERSION == "2.0.0" && # check Gemfile
|
49
|
+
$0 != "-e" # do not do that in guard
|
24
50
|
then
|
25
51
|
require "coveralls"
|
26
52
|
require "simplecov"
|
@@ -32,7 +58,6 @@ then
|
|
32
58
|
]
|
33
59
|
command_name "Unit Tests"
|
34
60
|
add_filter "/test/"
|
35
|
-
add_filter "/demo/"
|
36
61
|
end
|
37
62
|
|
38
63
|
Coveralls.noisy = true unless ENV['CI']
|
@@ -45,6 +70,16 @@ module Something
|
|
45
70
|
module Structure; end
|
46
71
|
end
|
47
72
|
end
|
73
|
+
module Latest
|
74
|
+
module Version1; end
|
75
|
+
module Version2; end
|
76
|
+
end
|
77
|
+
module V1test
|
78
|
+
module Stats; end
|
79
|
+
end
|
80
|
+
module V2test
|
81
|
+
module Stats; end
|
82
|
+
end
|
48
83
|
|
49
|
-
require 'minitest/autorun'
|
84
|
+
require 'minitest/autorun' unless $0=="-e" # skip in guard
|
50
85
|
require 'minitest/unit'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pluginator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michal Papis
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-09-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
@@ -50,17 +50,15 @@ extensions: []
|
|
50
50
|
extra_rdoc_files: []
|
51
51
|
files:
|
52
52
|
- .gitignore
|
53
|
+
- .noexec.yaml
|
53
54
|
- .travis.yml
|
54
55
|
- COPYING
|
55
56
|
- COPYING.LESSER
|
56
57
|
- Changelog.md
|
57
58
|
- Gemfile
|
59
|
+
- Guardfile
|
58
60
|
- README.md
|
59
61
|
- Rakefile
|
60
|
-
- demo/plugins/something/math/decrease.rb
|
61
|
-
- demo/plugins/something/math/increase.rb
|
62
|
-
- demo/plugins/something/nested/structure/test.rb
|
63
|
-
- demo/plugins/something/stats/max.rb
|
64
62
|
- lib/pluginator.rb
|
65
63
|
- lib/pluginator/autodetect.rb
|
66
64
|
- lib/pluginator/errors.rb
|
@@ -75,6 +73,31 @@ files:
|
|
75
73
|
- lib/plugins/pluginator/extensions/matching.rb
|
76
74
|
- lib/plugins/pluginator/extensions/plugins_map.rb
|
77
75
|
- pluginator.gemspec
|
76
|
+
- test/gems/gems/fake-gem-name-a-1.0.0/lib/fake-gem-name-a.rb
|
77
|
+
- test/gems/gems/fake-gem-name-a-1.0.0/lib/plugins/something/math/decrease.rb
|
78
|
+
- test/gems/gems/fake-gem-name-a-1.0.0/lib/plugins/something/math/increase.rb
|
79
|
+
- test/gems/gems/fake-gem-name-a-1.0.0/lib/plugins/something/nested/structure/test.rb
|
80
|
+
- test/gems/gems/fake-gem-name-a-1.0.0/lib/plugins/something/stats/max.rb
|
81
|
+
- test/gems/gems/fake-gem-name-latest-1.0.0/lib/fake-gem-name-latest.rb
|
82
|
+
- test/gems/gems/fake-gem-name-latest-1.0.0/lib/plugins/latest/version1/max.rb
|
83
|
+
- test/gems/gems/fake-gem-name-latest-2.0.0/lib/fake-gem-name-latest.rb
|
84
|
+
- test/gems/gems/fake-gem-name-latest-2.0.0/lib/plugins/latest/version2/max.rb
|
85
|
+
- test/gems/gems/fake-gem-name-v1a-1.0.0/lib/fake-gem-name-v1a.rb
|
86
|
+
- test/gems/gems/fake-gem-name-v1a-1.0.0/lib/plugins/v1test/stats/max.rb
|
87
|
+
- test/gems/gems/fake-gem-name-v1b-1.0.0/lib/fake-gem-name-v1a.rb
|
88
|
+
- test/gems/gems/fake-gem-name-v1b-1.0.0/lib/plugins/v1test/stats/max.rb
|
89
|
+
- test/gems/gems/fake-gem-name-v2a-1.0.0/lib/fake-gem-name-v2a.rb
|
90
|
+
- test/gems/gems/fake-gem-name-v2a-1.0.0/lib/plugins/v2test/stats/max.rb
|
91
|
+
- test/gems/gems/fake-gem-name-v2b-1.0.0/lib/fake-gem-name-v2b.rb
|
92
|
+
- test/gems/gems/fake-gem-name-v2b-1.0.0/lib/plugins/v2test/stats/max.rb
|
93
|
+
- test/gems/specifications/fake-gem-name-a-1.0.0.gemspec
|
94
|
+
- test/gems/specifications/fake-gem-name-latest-1.0.0.gemspec
|
95
|
+
- test/gems/specifications/fake-gem-name-latest-2.0.0.gemspec
|
96
|
+
- test/gems/specifications/fake-gem-name-v1a-1.0.0.gemspec
|
97
|
+
- test/gems/specifications/fake-gem-name-v1b-1.0.0.gemspec
|
98
|
+
- test/gems/specifications/fake-gem-name-v2a-1.0.0.gemspec
|
99
|
+
- test/gems/specifications/fake-gem-name-v2b-1.0.0.gemspec
|
100
|
+
- test/gems/specifications/pluginator-1.1.0.gemspec
|
78
101
|
- test/pluginator/autodetect_test.rb
|
79
102
|
- test/pluginator/extendable_autodetect_test.rb
|
80
103
|
- test/pluginator/group_test.rb
|
@@ -112,6 +135,31 @@ signing_key:
|
|
112
135
|
specification_version: 4
|
113
136
|
summary: Rubygems plugin system using Gem.find_files.
|
114
137
|
test_files:
|
138
|
+
- test/gems/gems/fake-gem-name-a-1.0.0/lib/fake-gem-name-a.rb
|
139
|
+
- test/gems/gems/fake-gem-name-a-1.0.0/lib/plugins/something/math/decrease.rb
|
140
|
+
- test/gems/gems/fake-gem-name-a-1.0.0/lib/plugins/something/math/increase.rb
|
141
|
+
- test/gems/gems/fake-gem-name-a-1.0.0/lib/plugins/something/nested/structure/test.rb
|
142
|
+
- test/gems/gems/fake-gem-name-a-1.0.0/lib/plugins/something/stats/max.rb
|
143
|
+
- test/gems/gems/fake-gem-name-latest-1.0.0/lib/fake-gem-name-latest.rb
|
144
|
+
- test/gems/gems/fake-gem-name-latest-1.0.0/lib/plugins/latest/version1/max.rb
|
145
|
+
- test/gems/gems/fake-gem-name-latest-2.0.0/lib/fake-gem-name-latest.rb
|
146
|
+
- test/gems/gems/fake-gem-name-latest-2.0.0/lib/plugins/latest/version2/max.rb
|
147
|
+
- test/gems/gems/fake-gem-name-v1a-1.0.0/lib/fake-gem-name-v1a.rb
|
148
|
+
- test/gems/gems/fake-gem-name-v1a-1.0.0/lib/plugins/v1test/stats/max.rb
|
149
|
+
- test/gems/gems/fake-gem-name-v1b-1.0.0/lib/fake-gem-name-v1a.rb
|
150
|
+
- test/gems/gems/fake-gem-name-v1b-1.0.0/lib/plugins/v1test/stats/max.rb
|
151
|
+
- test/gems/gems/fake-gem-name-v2a-1.0.0/lib/fake-gem-name-v2a.rb
|
152
|
+
- test/gems/gems/fake-gem-name-v2a-1.0.0/lib/plugins/v2test/stats/max.rb
|
153
|
+
- test/gems/gems/fake-gem-name-v2b-1.0.0/lib/fake-gem-name-v2b.rb
|
154
|
+
- test/gems/gems/fake-gem-name-v2b-1.0.0/lib/plugins/v2test/stats/max.rb
|
155
|
+
- test/gems/specifications/fake-gem-name-a-1.0.0.gemspec
|
156
|
+
- test/gems/specifications/fake-gem-name-latest-1.0.0.gemspec
|
157
|
+
- test/gems/specifications/fake-gem-name-latest-2.0.0.gemspec
|
158
|
+
- test/gems/specifications/fake-gem-name-v1a-1.0.0.gemspec
|
159
|
+
- test/gems/specifications/fake-gem-name-v1b-1.0.0.gemspec
|
160
|
+
- test/gems/specifications/fake-gem-name-v2a-1.0.0.gemspec
|
161
|
+
- test/gems/specifications/fake-gem-name-v2b-1.0.0.gemspec
|
162
|
+
- test/gems/specifications/pluginator-1.1.0.gemspec
|
115
163
|
- test/pluginator/autodetect_test.rb
|
116
164
|
- test/pluginator/extendable_autodetect_test.rb
|
117
165
|
- test/pluginator/group_test.rb
|
@@ -124,3 +172,4 @@ test_files:
|
|
124
172
|
- test/plugins_test/extensions/matching_test.rb
|
125
173
|
- test/plugins_test/extensions/plugins_map_test.rb
|
126
174
|
- test/test_helper.rb
|
175
|
+
has_rdoc:
|