pluginator 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +10 -0
- data/README.md +7 -5
- data/lib/pluginator/autodetect/finder.rb +85 -0
- data/lib/pluginator/autodetect/formatted_finder.rb +110 -0
- data/lib/pluginator/autodetect.rb +41 -73
- data/lib/pluginator/errors.rb +3 -2
- data/lib/pluginator/extendable_autodetect.rb +5 -9
- data/lib/pluginator/name_converter.rb +6 -16
- data/lib/pluginator/version.rb +2 -2
- data/lib/pluginator.rb +2 -2
- data/lib/plugins/pluginator/extensions/conversions.rb +8 -5
- data/lib/plugins/pluginator/extensions/first_ask.rb +2 -2
- data/lib/plugins/pluginator/extensions/first_class.rb +3 -3
- data/lib/plugins/pluginator/extensions/plugins_map.rb +8 -3
- metadata +43 -103
- data/.gitignore +0 -5
- data/.noexec.yaml +0 -1
- data/.travis.yml +0 -26
- data/Gemfile +0 -34
- data/Guardfile +0 -17
- data/Rakefile +0 -49
- data/pluginator.gemspec +0 -44
- data/test/gems/gems/fake-gem-name-a-1.0.0/lib/fake-gem-name-a.rb +0 -1
- data/test/gems/gems/fake-gem-name-a-1.0.0/lib/plugins/something/math/decrease.rb +0 -27
- data/test/gems/gems/fake-gem-name-a-1.0.0/lib/plugins/something/math/increase.rb +0 -27
- data/test/gems/gems/fake-gem-name-a-1.0.0/lib/plugins/something/nested/structure/test.rb +0 -25
- data/test/gems/gems/fake-gem-name-a-1.0.0/lib/plugins/something/stats/max.rb +0 -29
- data/test/gems/gems/fake-gem-name-activated-1.0.0/lib/fake-gem-name-activated.rb +0 -1
- data/test/gems/gems/fake-gem-name-activated-1.0.0/lib/plugins/activated/version1/max.rb +0 -29
- data/test/gems/gems/fake-gem-name-activated-2.0.0/lib/fake-gem-name-activated.rb +0 -1
- data/test/gems/gems/fake-gem-name-activated-2.0.0/lib/plugins/activated/version1/max.rb +0 -29
- data/test/gems/gems/fake-gem-name-latest-1.0.0/lib/fake-gem-name-latest.rb +0 -1
- data/test/gems/gems/fake-gem-name-latest-1.0.0/lib/plugins/latest/version1/max.rb +0 -29
- data/test/gems/gems/fake-gem-name-latest-2.0.0/lib/fake-gem-name-latest.rb +0 -1
- data/test/gems/gems/fake-gem-name-latest-2.0.0/lib/plugins/latest/version2/max.rb +0 -29
- data/test/gems/gems/fake-gem-name-v1a-1.0.0/lib/fake-gem-name-v1a.rb +0 -1
- data/test/gems/gems/fake-gem-name-v1a-1.0.0/lib/plugins/v1test/stats/max.rb +0 -29
- data/test/gems/gems/fake-gem-name-v1b-1.0.0/lib/fake-gem-name-v1a.rb +0 -1
- data/test/gems/gems/fake-gem-name-v1b-1.0.0/lib/plugins/v1test/stats/max.rb +0 -29
- data/test/gems/gems/fake-gem-name-v2a-1.0.0/lib/fake-gem-name-v2a.rb +0 -1
- data/test/gems/gems/fake-gem-name-v2a-1.0.0/lib/plugins/v2test/stats/max.rb +0 -29
- data/test/gems/gems/fake-gem-name-v2b-1.0.0/lib/fake-gem-name-v2b.rb +0 -1
- data/test/gems/gems/fake-gem-name-v2b-1.0.0/lib/plugins/v2test/stats/max.rb +0 -29
- data/test/gems/specifications/fake-gem-name-a-1.0.0.gemspec +0 -21
- data/test/gems/specifications/fake-gem-name-activated-1.0.0.gemspec +0 -21
- data/test/gems/specifications/fake-gem-name-activated-2.0.0.gemspec +0 -21
- data/test/gems/specifications/fake-gem-name-latest-1.0.0.gemspec +0 -21
- data/test/gems/specifications/fake-gem-name-latest-2.0.0.gemspec +0 -21
- data/test/gems/specifications/fake-gem-name-v1a-1.0.0.gemspec +0 -21
- data/test/gems/specifications/fake-gem-name-v1b-1.0.0.gemspec +0 -24
- data/test/gems/specifications/fake-gem-name-v2a-1.0.0.gemspec +0 -24
- data/test/gems/specifications/fake-gem-name-v2b-1.0.0.gemspec +0 -24
- data/test/pluginator/autodetect_test.rb +0 -170
- data/test/pluginator/extendable_autodetect_test.rb +0 -43
- data/test/pluginator/group_test.rb +0 -45
- data/test/pluginator/name_converter_test.rb +0 -52
- data/test/pluginator_test.rb +0 -132
- data/test/plugins_test/extensions/class_exist_test.rb +0 -45
- data/test/plugins_test/extensions/conversions_test.rb +0 -34
- data/test/plugins_test/extensions/first_ask_test.rb +0 -63
- data/test/plugins_test/extensions/first_class_test.rb +0 -63
- data/test/plugins_test/extensions/matching_test.rb +0 -55
- data/test/plugins_test/extensions/plugins_map_test.rb +0 -35
- data/test/test_helper.rb +0 -88
@@ -1,29 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
1
|
-
|
@@ -1,29 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
1
|
-
|
@@ -1,29 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
1
|
-
|
@@ -1,29 +0,0 @@
|
|
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
|
@@ -1,21 +0,0 @@
|
|
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
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: fake-gem-name-activated 1.0.0 ruby lib
|
3
|
-
|
4
|
-
Gem::Specification.new do |s|
|
5
|
-
s.name = "fake-gem-name-activated"
|
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
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: fake-gem-name-activated 2.0.0 ruby lib
|
3
|
-
|
4
|
-
Gem::Specification.new do |s|
|
5
|
-
s.name = "fake-gem-name-activated"
|
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
|
@@ -1,21 +0,0 @@
|
|
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
|
@@ -1,21 +0,0 @@
|
|
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
|
@@ -1,21 +0,0 @@
|
|
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
|
@@ -1,24 +0,0 @@
|
|
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
|
@@ -1,24 +0,0 @@
|
|
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
|
@@ -1,24 +0,0 @@
|
|
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
|
@@ -1,170 +0,0 @@
|
|
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
|
-
require "test_helper"
|
21
|
-
require "pluginator/autodetect"
|
22
|
-
|
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
|
-
)
|
35
|
-
end
|
36
|
-
|
37
|
-
def gem_files(*paths)
|
38
|
-
options = paths.last.is_a?(::Hash) ? paths.pop : {}
|
39
|
-
paths.flatten.map{|path| gem_file(path, options) }
|
40
|
-
end
|
41
|
-
|
42
|
-
describe Pluginator::Autodetect do
|
43
|
-
before do
|
44
|
-
@math_files = gem_files("plugins/something/math/increase.rb", "plugins/something/math/decrease.rb")
|
45
|
-
@all_files = gem_files(
|
46
|
-
"plugins/something/math/increase.rb", "plugins/something/math/decrease.rb",
|
47
|
-
"plugins/something/nested/structure/test.rb", "plugins/something/stats/max.rb"
|
48
|
-
)
|
49
|
-
end
|
50
|
-
|
51
|
-
describe "separate" do
|
52
|
-
before do
|
53
|
-
@pluginator = Pluginator::Autodetect.allocate
|
54
|
-
@pluginator.send(:setup_group, "something")
|
55
|
-
end
|
56
|
-
|
57
|
-
it "has name" do
|
58
|
-
@pluginator.group.must_equal("something")
|
59
|
-
end
|
60
|
-
|
61
|
-
it "has gem file" do
|
62
|
-
File.exists?(gem_file("plugins/something/math/increase.rb")).must_equal(true)
|
63
|
-
end
|
64
|
-
|
65
|
-
it "loads plugin" do
|
66
|
-
@pluginator.send(:load_plugin, "plugins/something/math/increase.rb").must_equal(true)
|
67
|
-
end
|
68
|
-
|
69
|
-
it "finds files existing group" do
|
70
|
-
@pluginator.send(:find_files).sort.must_equal(@all_files.sort)
|
71
|
-
end
|
72
|
-
|
73
|
-
it "finds files group and missing type" do
|
74
|
-
@pluginator.instance_variable_set(:@force_type, "none")
|
75
|
-
@pluginator.send(:find_files).must_equal([])
|
76
|
-
end
|
77
|
-
|
78
|
-
it "finds files group and existing type" do
|
79
|
-
@pluginator.instance_variable_set(:@force_type, "math")
|
80
|
-
@pluginator.send(:find_files).sort.must_equal(@math_files.sort)
|
81
|
-
end
|
82
|
-
|
83
|
-
it "finds files group and existing type" do
|
84
|
-
@pluginator.send(:force_type, "math")
|
85
|
-
@pluginator.type.must_equal( @pluginator["math"] )
|
86
|
-
end
|
87
|
-
|
88
|
-
it "loads files" do
|
89
|
-
@pluginator.send(:load_files, @math_files)
|
90
|
-
@pluginator.types.must_include("math")
|
91
|
-
plugins = @pluginator["math"].map(&:to_s)
|
92
|
-
plugins.size.must_equal(2)
|
93
|
-
plugins.must_include("Something::Math::Increase")
|
94
|
-
plugins.must_include("Something::Math::Decrease")
|
95
|
-
plugins.wont_include("Something::Math::Substract")
|
96
|
-
end
|
97
|
-
|
98
|
-
it "finds unique gems for paths" do
|
99
|
-
@pluginator.send(:gemspec_and_paths, @math_files).map{ |gemspec, path, name, type|
|
100
|
-
[gemspec.name, gemspec.version.to_s, path, name, type]
|
101
|
-
}.must_equal([
|
102
|
-
["fake-gem-name-a", "1.0.0", "plugins/something/math/decrease.rb", "something/math/decrease", "math"],
|
103
|
-
["fake-gem-name-a", "1.0.0", "plugins/something/math/increase.rb", "something/math/increase", "math"],
|
104
|
-
])
|
105
|
-
end
|
106
|
-
|
107
|
-
it "finds unique gems for paths" do
|
108
|
-
@pluginator.send(:unique_gemspec_paths, @math_files).map{ |gemspec, path, name, type|
|
109
|
-
[gemspec.name, gemspec.version.to_s, path, name, type]
|
110
|
-
}.must_equal([
|
111
|
-
["fake-gem-name-a", "1.0.0", "plugins/something/math/decrease.rb", "something/math/decrease", "math"],
|
112
|
-
["fake-gem-name-a", "1.0.0", "plugins/something/math/increase.rb", "something/math/increase", "math"],
|
113
|
-
])
|
114
|
-
end
|
115
|
-
|
116
|
-
end
|
117
|
-
|
118
|
-
it "loads plugins automatically for group" do
|
119
|
-
pluginator = Pluginator::Autodetect.new("something")
|
120
|
-
pluginator.types.must_include("stats")
|
121
|
-
pluginator.types.must_include("math")
|
122
|
-
pluginator.types.size.must_equal(3)
|
123
|
-
plugins = pluginator["math"].map(&:to_s)
|
124
|
-
plugins.size.must_equal(2)
|
125
|
-
plugins.must_include("Something::Math::Increase")
|
126
|
-
plugins.must_include("Something::Math::Decrease")
|
127
|
-
plugins.wont_include("Something::Math::Add")
|
128
|
-
end
|
129
|
-
|
130
|
-
it "loads plugins automatically for group/type" do
|
131
|
-
pluginator = Pluginator::Autodetect.new("something", :type => "stats")
|
132
|
-
pluginator.types.must_include("stats")
|
133
|
-
pluginator.types.size.must_equal(1)
|
134
|
-
end
|
135
|
-
|
136
|
-
it "makes group plugins work" do
|
137
|
-
pluginator = Pluginator::Autodetect.new("something")
|
138
|
-
pluginator.types.must_include("math")
|
139
|
-
pluginator["math"].detect{|plugin| plugin.type == "increase" }.action(2).must_equal(3)
|
140
|
-
pluginator["math"].detect{|plugin| plugin.type == "decrease" }.action(5).must_equal(4)
|
141
|
-
end
|
142
|
-
|
143
|
-
it "hides methods" do
|
144
|
-
pluginator = Pluginator::Autodetect.new("something")
|
145
|
-
pluginator.public_methods.map(&:to_sym).must_include(:register_plugin)
|
146
|
-
pluginator.public_methods.map(&:to_sym).wont_include(:load_plugins)
|
147
|
-
pluginator.public_methods.map(&:to_sym).wont_include(:split_file_name)
|
148
|
-
pluginator.type.must_equal(nil)
|
149
|
-
end
|
150
|
-
|
151
|
-
it "defines type method dynamically" do
|
152
|
-
pluginator = Pluginator::Autodetect.new("something", :type => "math")
|
153
|
-
pluginator.type.must_equal(pluginator["math"])
|
154
|
-
end
|
155
|
-
|
156
|
-
it "loads self" do
|
157
|
-
pluginator = Pluginator::Autodetect.new("pluginator")
|
158
|
-
pluginator.types.must_include("extensions")
|
159
|
-
pluginator.types.size.must_equal(1)
|
160
|
-
pluginator["extensions"].map(&:to_s).sort.must_equal([
|
161
|
-
"Pluginator::Extensions::ClassExist",
|
162
|
-
"Pluginator::Extensions::Conversions",
|
163
|
-
"Pluginator::Extensions::FirstAsk",
|
164
|
-
"Pluginator::Extensions::FirstClass",
|
165
|
-
"Pluginator::Extensions::Matching",
|
166
|
-
"Pluginator::Extensions::PluginsMap"
|
167
|
-
])
|
168
|
-
end
|
169
|
-
|
170
|
-
end
|
@@ -1,43 +0,0 @@
|
|
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
|
-
require "test_helper"
|
21
|
-
require "pluginator/extendable_autodetect"
|
22
|
-
|
23
|
-
describe Pluginator::ExtendableAutodetect do
|
24
|
-
it "loads existing extensions - array" do
|
25
|
-
pluginator = Pluginator::ExtendableAutodetect.new("something", :extends => [:conversions])
|
26
|
-
pluginator.public_methods.map(&:to_sym).must_include(:class2string)
|
27
|
-
pluginator.public_methods.map(&:to_sym).must_include(:string2class)
|
28
|
-
pluginator.public_methods.map(&:to_sym).wont_include(:plugins_map)
|
29
|
-
end
|
30
|
-
|
31
|
-
it "loads existing extensions - symbol" do
|
32
|
-
pluginator = Pluginator::ExtendableAutodetect.new("something", :extends => :conversions)
|
33
|
-
pluginator.public_methods.map(&:to_sym).must_include(:class2string)
|
34
|
-
pluginator.public_methods.map(&:to_sym).must_include(:string2class)
|
35
|
-
pluginator.public_methods.map(&:to_sym).wont_include(:plugins_map)
|
36
|
-
end
|
37
|
-
|
38
|
-
it "fails to load missing extension" do
|
39
|
-
lambda {
|
40
|
-
Pluginator::ExtendableAutodetect.new("something", :extends => [:missing_conversions])
|
41
|
-
}.must_raise(Pluginator::MissingPlugin)
|
42
|
-
end
|
43
|
-
end
|
@@ -1,45 +0,0 @@
|
|
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
|
-
require "test_helper"
|
21
|
-
require "pluginator/group"
|
22
|
-
|
23
|
-
describe Pluginator::Group do
|
24
|
-
it "has name" do
|
25
|
-
Pluginator::Group.new("something").group.must_equal("something")
|
26
|
-
end
|
27
|
-
|
28
|
-
describe "plugins list" do
|
29
|
-
before do
|
30
|
-
@group = Pluginator::Group.new("something")
|
31
|
-
end
|
32
|
-
|
33
|
-
it "adds type" do
|
34
|
-
@group.register_plugin("type1", nil)
|
35
|
-
@group.types.must_include("type1")
|
36
|
-
@group.types.wont_include("type2")
|
37
|
-
end
|
38
|
-
|
39
|
-
it "adds plugin" do
|
40
|
-
@group.register_plugin("type1", "test1")
|
41
|
-
@group["type1"].must_include("test1")
|
42
|
-
@group["type1"].wont_include("test2")
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,52 +0,0 @@
|
|
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
|
-
require "test_helper"
|
21
|
-
require "pluginator/name_converter"
|
22
|
-
|
23
|
-
class Converter
|
24
|
-
extend Pluginator::NameConverter
|
25
|
-
end
|
26
|
-
|
27
|
-
describe Pluginator::NameConverter do
|
28
|
-
describe "files" do
|
29
|
-
it "extracts file name components" do
|
30
|
-
Converter.send(:split_file_name, "/path/to/plugins/group1/type1/name1.rb", "group1").
|
31
|
-
must_equal(["plugins/group1/type1/name1.rb", "group1/type1/name1", "type1"])
|
32
|
-
end
|
33
|
-
|
34
|
-
it "builds group pattern" do
|
35
|
-
Converter.send(:file_name_pattern, "group2").must_equal("plugins/group2/**/*.rb")
|
36
|
-
end
|
37
|
-
|
38
|
-
it "builds group/<nil> pattern" do
|
39
|
-
Converter.send(:file_name_pattern, "group2").must_equal("plugins/group2/**/*.rb")
|
40
|
-
end
|
41
|
-
|
42
|
-
it "builds group/type pattern" do
|
43
|
-
Converter.send(:file_name_pattern, "group2", "type3").must_equal("plugins/group2/type3/*.rb")
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
describe "classes" do
|
48
|
-
it "builds class" do
|
49
|
-
Converter.send(:name2class, "Converter").must_equal(Converter)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|