pluginator 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +10 -0
  3. data/README.md +7 -5
  4. data/lib/pluginator/autodetect/finder.rb +85 -0
  5. data/lib/pluginator/autodetect/formatted_finder.rb +110 -0
  6. data/lib/pluginator/autodetect.rb +41 -73
  7. data/lib/pluginator/errors.rb +3 -2
  8. data/lib/pluginator/extendable_autodetect.rb +5 -9
  9. data/lib/pluginator/name_converter.rb +6 -16
  10. data/lib/pluginator/version.rb +2 -2
  11. data/lib/pluginator.rb +2 -2
  12. data/lib/plugins/pluginator/extensions/conversions.rb +8 -5
  13. data/lib/plugins/pluginator/extensions/first_ask.rb +2 -2
  14. data/lib/plugins/pluginator/extensions/first_class.rb +3 -3
  15. data/lib/plugins/pluginator/extensions/plugins_map.rb +8 -3
  16. metadata +43 -103
  17. data/.gitignore +0 -5
  18. data/.noexec.yaml +0 -1
  19. data/.travis.yml +0 -26
  20. data/Gemfile +0 -34
  21. data/Guardfile +0 -17
  22. data/Rakefile +0 -49
  23. data/pluginator.gemspec +0 -44
  24. data/test/gems/gems/fake-gem-name-a-1.0.0/lib/fake-gem-name-a.rb +0 -1
  25. data/test/gems/gems/fake-gem-name-a-1.0.0/lib/plugins/something/math/decrease.rb +0 -27
  26. data/test/gems/gems/fake-gem-name-a-1.0.0/lib/plugins/something/math/increase.rb +0 -27
  27. data/test/gems/gems/fake-gem-name-a-1.0.0/lib/plugins/something/nested/structure/test.rb +0 -25
  28. data/test/gems/gems/fake-gem-name-a-1.0.0/lib/plugins/something/stats/max.rb +0 -29
  29. data/test/gems/gems/fake-gem-name-activated-1.0.0/lib/fake-gem-name-activated.rb +0 -1
  30. data/test/gems/gems/fake-gem-name-activated-1.0.0/lib/plugins/activated/version1/max.rb +0 -29
  31. data/test/gems/gems/fake-gem-name-activated-2.0.0/lib/fake-gem-name-activated.rb +0 -1
  32. data/test/gems/gems/fake-gem-name-activated-2.0.0/lib/plugins/activated/version1/max.rb +0 -29
  33. data/test/gems/gems/fake-gem-name-latest-1.0.0/lib/fake-gem-name-latest.rb +0 -1
  34. data/test/gems/gems/fake-gem-name-latest-1.0.0/lib/plugins/latest/version1/max.rb +0 -29
  35. data/test/gems/gems/fake-gem-name-latest-2.0.0/lib/fake-gem-name-latest.rb +0 -1
  36. data/test/gems/gems/fake-gem-name-latest-2.0.0/lib/plugins/latest/version2/max.rb +0 -29
  37. data/test/gems/gems/fake-gem-name-v1a-1.0.0/lib/fake-gem-name-v1a.rb +0 -1
  38. data/test/gems/gems/fake-gem-name-v1a-1.0.0/lib/plugins/v1test/stats/max.rb +0 -29
  39. data/test/gems/gems/fake-gem-name-v1b-1.0.0/lib/fake-gem-name-v1a.rb +0 -1
  40. data/test/gems/gems/fake-gem-name-v1b-1.0.0/lib/plugins/v1test/stats/max.rb +0 -29
  41. data/test/gems/gems/fake-gem-name-v2a-1.0.0/lib/fake-gem-name-v2a.rb +0 -1
  42. data/test/gems/gems/fake-gem-name-v2a-1.0.0/lib/plugins/v2test/stats/max.rb +0 -29
  43. data/test/gems/gems/fake-gem-name-v2b-1.0.0/lib/fake-gem-name-v2b.rb +0 -1
  44. data/test/gems/gems/fake-gem-name-v2b-1.0.0/lib/plugins/v2test/stats/max.rb +0 -29
  45. data/test/gems/specifications/fake-gem-name-a-1.0.0.gemspec +0 -21
  46. data/test/gems/specifications/fake-gem-name-activated-1.0.0.gemspec +0 -21
  47. data/test/gems/specifications/fake-gem-name-activated-2.0.0.gemspec +0 -21
  48. data/test/gems/specifications/fake-gem-name-latest-1.0.0.gemspec +0 -21
  49. data/test/gems/specifications/fake-gem-name-latest-2.0.0.gemspec +0 -21
  50. data/test/gems/specifications/fake-gem-name-v1a-1.0.0.gemspec +0 -21
  51. data/test/gems/specifications/fake-gem-name-v1b-1.0.0.gemspec +0 -24
  52. data/test/gems/specifications/fake-gem-name-v2a-1.0.0.gemspec +0 -24
  53. data/test/gems/specifications/fake-gem-name-v2b-1.0.0.gemspec +0 -24
  54. data/test/pluginator/autodetect_test.rb +0 -170
  55. data/test/pluginator/extendable_autodetect_test.rb +0 -43
  56. data/test/pluginator/group_test.rb +0 -45
  57. data/test/pluginator/name_converter_test.rb +0 -52
  58. data/test/pluginator_test.rb +0 -132
  59. data/test/plugins_test/extensions/class_exist_test.rb +0 -45
  60. data/test/plugins_test/extensions/conversions_test.rb +0 -34
  61. data/test/plugins_test/extensions/first_ask_test.rb +0 -63
  62. data/test/plugins_test/extensions/first_class_test.rb +0 -63
  63. data/test/plugins_test/extensions/matching_test.rb +0 -55
  64. data/test/plugins_test/extensions/plugins_map_test.rb +0 -35
  65. data/test/test_helper.rb +0 -88
@@ -1,132 +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"
22
-
23
- describe Pluginator do
24
- it "loads_plugins_automatically_for_group" do
25
- pluginator = Pluginator.find("something")
26
- pluginator.types.must_include("stats")
27
- pluginator.types.must_include("math")
28
- pluginator.types.must_include("nested/structure")
29
- pluginator.types.size.must_equal(3)
30
- plugins = pluginator["math"].map(&:to_s)
31
- plugins.size.must_equal(2)
32
- plugins.must_include("Something::Math::Increase")
33
- plugins.must_include("Something::Math::Decrease")
34
- plugins.wont_include("Something::Math::Add")
35
- end
36
-
37
- it "loads_plugins_automatically_for_group_type" do
38
- pluginator = Pluginator.find("something", :type => "stats")
39
- pluginator.types.must_include("stats")
40
- pluginator.types.size.must_equal(1)
41
- end
42
-
43
- it "loads_existing_extensions_symbol" do
44
- pluginator = Pluginator.find("something", :extends => :conversions)
45
- pluginator.public_methods.map(&:to_sym).must_include(:class2string)
46
- pluginator.public_methods.map(&:to_sym).must_include(:string2class)
47
- pluginator.public_methods.map(&:to_sym).wont_include(:plugins_map)
48
- end
49
-
50
- it "loads_nested_plugins" do
51
- pluginator = Pluginator.find("something")
52
- pluginator.types.must_include("nested/structure")
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_only_plugins_from_activated_version_of_gem" do
77
- all_gems = Gem::Specification._all.map{|s| "#{s.name}-#{s.version}" }
78
- all_gems.must_include("fake-gem-name-activated-1.0.0")
79
- all_gems.must_include("fake-gem-name-activated-2.0.0")
80
- Gem::Specification._all.find{|s| [s.name, s.version.to_s] == ["fake-gem-name-activated", "1.0.0"] }.activate
81
- active_gems = Gem::Specification._all.map{|s| "#{s.name}-#{s.version}" if s.activated? }.compact
82
- active_gems.must_include("fake-gem-name-activated-1.0.0")
83
- active_gems.wont_include("fake-gem-name-activated-2.0.0")
84
-
85
- pluginator = Pluginator.find("activated")
86
-
87
- active_gems = Gem::Specification._all.map{|s| "#{s.name}-#{s.version}" if s.activated? }.compact
88
- active_gems.must_include("fake-gem-name-activated-1.0.0")
89
-
90
- pluginator.types.must_include("version1")
91
- pluginator.types.size.must_equal(1)
92
- pluginator["version1"].map(&:to_s).must_equal(["Activated::Version1::Max"])
93
- end
94
-
95
- it "loads_latest_version_of_plugin_from_two_gems_v1" do
96
- all_gems = Gem::Specification._all.map{|s| "#{s.name}-#{s.version}" }
97
- all_gems.must_include("fake-gem-name-v1a-1.0.0")
98
- all_gems.must_include("fake-gem-name-v1b-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-v1a-1.0.0")
101
-
102
- pluginator = Pluginator.find("v1test")
103
-
104
- active_gems = Gem::Specification._all.map{|s| "#{s.name}-#{s.version}" if s.activated? }.compact
105
- active_gems.wont_include("fake-gem-name-v1a-1.0.0")
106
- active_gems.must_include("fake-gem-name-v1b-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(["V1test::Stats::Max"])
111
- pluginator["stats"].first.action.must_equal(42)
112
- end
113
-
114
- it "loads_latest_version_of_plugin_from_two_gems_v2" do
115
- all_gems = Gem::Specification._all.map{|s| "#{s.name}-#{s.version}" }
116
- all_gems.must_include("fake-gem-name-v2a-1.0.0")
117
- all_gems.must_include("fake-gem-name-v2b-1.0.0")
118
- active_gems = Gem::Specification._all.map{|s| "#{s.name}-#{s.version}" if s.activated? }.compact
119
- active_gems.wont_include("fake-gem-name-v2a-1.0.0")
120
-
121
- pluginator = Pluginator.find("v2test")
122
-
123
- active_gems = Gem::Specification._all.map{|s| "#{s.name}-#{s.version}" if s.activated? }.compact
124
- active_gems.must_include("fake-gem-name-v2a-1.0.0")
125
- active_gems.wont_include("fake-gem-name-v2b-1.0.0")
126
-
127
- pluginator.types.must_include("stats")
128
- pluginator.types.size.must_equal(1)
129
- pluginator["stats"].map(&:to_s).must_equal(["V2test::Stats::Max"])
130
- pluginator["stats"].first.action.must_equal(41)
131
- end
132
- 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 "plugins/pluginator/extensions/class_exist"
22
- require "plugins/something/stats/max"
23
-
24
- class ClassExistTester
25
- attr_accessor :plugins
26
- include Pluginator::Extensions::ClassExist
27
- end
28
-
29
- describe Pluginator::Extensions::ClassExist do
30
- subject do
31
- tester = ClassExistTester.new
32
- tester.plugins = { "stats" => [
33
- Something::Stats::Max
34
- ] }
35
- tester
36
- end
37
-
38
- it "plugin exists" do
39
- subject.class_exist?("stats", "max").must_equal( true )
40
- end
41
-
42
- it "plugin missing" do
43
- subject.class_exist?("stats", "min").must_equal( false )
44
- end
45
- end
@@ -1,34 +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 "plugins/pluginator/extensions/conversions"
22
-
23
- class ConversionsTester
24
- extend Pluginator::Extensions::Conversions
25
- end
26
-
27
- describe Pluginator::Extensions::Conversions do
28
- it "class2string" do
29
- ConversionsTester.class2string("SomethingLong").must_match("something_long")
30
- end
31
- it "string2class" do
32
- ConversionsTester.string2class("something_long").must_match("SomethingLong")
33
- end
34
- end
@@ -1,63 +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 "plugins/pluginator/extensions/first_ask"
22
- require "plugins/something/stats/max"
23
-
24
- class FirstAskTester
25
- attr_accessor :plugins
26
- include Pluginator::Extensions::FirstAsk
27
- end
28
-
29
- describe Pluginator::Extensions::FirstAsk do
30
- before do
31
- @tester = FirstAskTester.new
32
- @tester.plugins = { "stats" => [
33
- Something::Stats::Max
34
- ] }
35
- end
36
-
37
- it "finds existing plugin" do
38
- @tester.first_ask("stats", "handles?", "max").must_equal( Something::Stats::Max )
39
- end
40
-
41
- it "finds proper plugin" do
42
- @tester.first_ask("stats", "handles?", "max").action.must_equal( 42 )
43
- end
44
-
45
- it "finds existing plugin - no exception" do
46
- @tester.first_ask!("stats", "handles?", "max").must_equal( Something::Stats::Max )
47
- end
48
-
49
- it "does not find missing plugin - no exception" do
50
- @tester.first_ask("stats", "handles?", "min").must_equal( nil )
51
- end
52
-
53
- it "does not find missing plugin - exception plugin" do
54
- lambda {
55
- @tester.first_ask!("stats", "handles?", "min")
56
- }.must_raise(Pluginator::MissingPlugin)
57
- end
58
- it "does not find missing plugin - exception type" do
59
- lambda {
60
- @tester.first_ask!("stats2", "handles?", "max")
61
- }.must_raise(Pluginator::MissingType)
62
- end
63
- end
@@ -1,63 +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 "plugins/pluginator/extensions/first_class"
22
- require "plugins/something/stats/max"
23
-
24
- class FirstClassTester
25
- attr_accessor :plugins
26
- include Pluginator::Extensions::FirstClass
27
- end
28
-
29
- describe Pluginator::Extensions::FirstClass do
30
- before do
31
- @tester = FirstClassTester.new
32
- @tester.plugins = { "stats" => [
33
- Something::Stats::Max
34
- ] }
35
- end
36
-
37
- it "finds existing plugin" do
38
- @tester.first_class("stats", "max").must_equal( Something::Stats::Max )
39
- end
40
-
41
- it "finds proper plugin" do
42
- @tester.first_class("stats", "max").action.must_equal( 42 )
43
- end
44
-
45
- it "finds existing plugin - no exception" do
46
- @tester.first_class!("stats", "max").must_equal( Something::Stats::Max )
47
- end
48
-
49
- it "does not find missing plugin - no exception" do
50
- @tester.first_class("stats", "min").must_equal( nil )
51
- end
52
-
53
- it "does not find missing plugin - exception plugin" do
54
- lambda {
55
- @tester.first_class!("stats", "min")
56
- }.must_raise(Pluginator::MissingPlugin)
57
- end
58
- it "does not find missing plugin - exception type" do
59
- lambda {
60
- @tester.first_class!("stats2", "max")
61
- }.must_raise(Pluginator::MissingType)
62
- end
63
- end
@@ -1,55 +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 "plugins/pluginator/extensions/matching"
22
-
23
- class MatchingTester
24
- attr_accessor :plugins
25
- include Pluginator::Extensions::Matching
26
- end
27
-
28
- describe Pluginator::Extensions::Matching do
29
- before do
30
- @tester = MatchingTester.new
31
- @tester.plugins = { "extensions" => [
32
- Pluginator::Extensions::PluginsMap,
33
- Pluginator::Extensions::Conversions,
34
- Pluginator::Extensions::Matching
35
- ] }
36
- end
37
-
38
- it "finds existing plugin" do
39
- @tester.matching("extensions", ["plugins_map"]).must_equal( [Pluginator::Extensions::PluginsMap] )
40
- end
41
-
42
- it "finds existing plugin - no exception" do
43
- @tester.matching!("extensions", ["plugins_map"]).must_equal( [Pluginator::Extensions::PluginsMap] )
44
- end
45
-
46
- it "does not find missing plugin - no exception" do
47
- @tester.matching("extensions", ["plugins_map2"]).must_equal( [nil] )
48
- end
49
-
50
- it "finds existing plugin" do
51
- lambda {
52
- @tester.matching!("extensions", ["plugins_map2"])
53
- }.must_raise(Pluginator::MissingPlugin)
54
- end
55
- end
@@ -1,35 +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 "plugins/pluginator/extensions/plugins_map"
22
-
23
- class PluginsMapTester
24
- attr_accessor :plugins
25
- include Pluginator::Extensions::PluginsMap
26
- end
27
-
28
- describe Pluginator::Extensions::PluginsMap do
29
- it "creates map" do
30
- tester = PluginsMapTester.new
31
- tester.plugins = { "extensions" => [Pluginator::Extensions::PluginsMap] }
32
- expected = { "PluginsMap" => Pluginator::Extensions::PluginsMap }
33
- tester.plugins_map("extensions").must_equal( expected )
34
- end
35
- end
data/test/test_helper.rb DELETED
@@ -1,88 +0,0 @@
1
- =begin
2
- Copyright 2013
3
- - Michal Papis <mpapis@gmail.com>
4
- - Jordon Bedwell <envygeeks@gmail.com>
5
-
6
- This file is part of pluginator.
7
-
8
- pluginator is free software: you can redistribute it and/or modify
9
- it under the terms of the GNU Lesser General Public License as published
10
- by the Free Software Foundation, either version 3 of the License, or
11
- (at your option) any later version.
12
-
13
- pluginator is distributed in the hope that it will be useful,
14
- but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- GNU Lesser General Public License for more details.
17
-
18
- You should have received a copy of the GNU Lesser General Public License
19
- along with pluginator. If not, see <http://www.gnu.org/licenses/>.
20
- =end
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
-
47
- if
48
- RUBY_VERSION == "2.0.0" && # check Gemfile
49
- $0 != "-e" # do not do that in guard
50
- then
51
- require "coveralls"
52
- require "simplecov"
53
-
54
- SimpleCov.start do
55
- formatter SimpleCov::Formatter::MultiFormatter[
56
- SimpleCov::Formatter::HTMLFormatter,
57
- Coveralls::SimpleCov::Formatter,
58
- ]
59
- command_name "Unit Tests"
60
- add_filter "/test/"
61
- end
62
-
63
- Coveralls.noisy = true unless ENV["CI"]
64
- end
65
-
66
- module Something
67
- module Math; end
68
- module Stats; end
69
- module Nested
70
- module Structure; end
71
- end
72
- end
73
- module Activated
74
- module Version1; end
75
- end
76
- module Latest
77
- module Version1; end
78
- module Version2; end
79
- end
80
- module V1test
81
- module Stats; end
82
- end
83
- module V2test
84
- module Stats; end
85
- end
86
-
87
- require "minitest/autorun" unless $0=="-e" # skip in guard
88
- require "minitest/unit"