pluginator 0.11.0 → 0.11.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0db9991966679d973e056d3fc78fdc31f6ee06ba
4
- data.tar.gz: 8e7f9c12a90c8799dc1b8cb901ccda0a3794bddb
3
+ metadata.gz: 177ed9844b5c23c064d42ea785fd4aa27a5a3b2a
4
+ data.tar.gz: 59b7f79ca608cfa3471462d527f9e6c85a8de2ad
5
5
  SHA512:
6
- metadata.gz: c8c4125ef8eb09e0b54d4c01be7c836310ed687874ab9c6cf09d20df00e972975b6a8581a836bcc5adcef4d6dce973da82e2602cd91039379a567164ec55a1bc
7
- data.tar.gz: d782e278f8563218cabacab95c09c259b98dec719dc532ecb3edc8656b5e54ded69a4457ba7f5b572ccd8b5128e5828c616645566c8f91b2dd05841035c84c8d
6
+ metadata.gz: 17326a839cf7457e8d29096404a28f543340e44693a8615fb59b2eeb45676b56d47fbb97b8d3c463c5c97b67a454eb3fa08dcef4fb27edd88545d10480b735a8
7
+ data.tar.gz: f19ec0686a73d26bf399dc3ccfd0969fbddef6a0156e000573187dc3334bd32e3e250ae325bbe5a547716c4a62bd51c43830dafceaf55d380f78687fd7a14b70
data/.gitignore CHANGED
@@ -1,2 +1,3 @@
1
- *.gem
2
- Gemfile.lock
1
+ /*.gem
2
+ /Gemfile.lock
3
+ /coverage
data/Rakefile CHANGED
@@ -4,6 +4,6 @@ task :default => [:test]
4
4
 
5
5
  Rake::TestTask.new do |t|
6
6
  t.verbose = true
7
- t.libs.push("demo")
7
+ t.libs.push("demo", "test")
8
8
  t.pattern = "test/**/*_test.rb"
9
9
  end
@@ -1,18 +1,20 @@
1
1
  module Pluginator
2
2
  class PluginatorError < RuntimeError
3
+ private
4
+ def list_to_s(list)
5
+ list.map{|e| "'#{e}'" }.join(", ")
6
+ end
3
7
  end
4
8
 
5
9
  class MissingPlugin < PluginatorError
6
10
  def initialize(type, name, list)
7
- list = list.map{|e| "'#{e}'" }.join(", ")
8
- super("Can not find plugin '#{name}' in #{list} for type '#{type}'.")
11
+ super("Can not find plugin '#{name}' in #{list_to_s(list)} for type '#{type}'.")
9
12
  end
10
13
  end
11
14
 
12
15
  class MissingType < PluginatorError
13
16
  def initialize(type, list)
14
- list = list.map{|e| "'#{e}'" }.join(", ")
15
- super("Can not find type '#{type}' in #{list}.")
17
+ super("Can not find type '#{type}' in #{list_to_s(list)}.")
16
18
  end
17
19
  end
18
20
  end
@@ -1,3 +1,3 @@
1
1
  module Pluginator
2
- VERSION = "0.11.0"
2
+ VERSION = "0.11.1"
3
3
  end
@@ -12,7 +12,7 @@ module Pluginator::Extensions
12
12
  end
13
13
 
14
14
  def first_ask!(type, method_name, *params)
15
- @plugins[type] or raise Pluginator::MissingType.new(type, @plugins.types)
15
+ @plugins[type] or raise Pluginator::MissingType.new(type, @plugins.keys)
16
16
  @plugins[type].detect do |plugin|
17
17
  plugin.public_send(method_name, *params)
18
18
  end or
data/pluginator.gemspec CHANGED
@@ -12,6 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.required_ruby_version = ">= 1.9.3"
13
13
  s.add_development_dependency("rake")
14
14
  s.add_development_dependency("minitest")
15
+ s.add_development_dependency("simplecov")
15
16
  # s.add_development_dependency("smf-gem")
16
17
  s.homepage = "https://github.com/rvm/pluginator"
17
18
  s.summary = "Rubygems plugin system using Gem.find_files."
@@ -1,4 +1,4 @@
1
- require 'minitest/autorun'
1
+ require 'test_helper'
2
2
  require 'pluginator/autodetect'
3
3
 
4
4
  module Something
@@ -1,4 +1,4 @@
1
- require 'minitest/autorun'
1
+ require 'test_helper'
2
2
  require 'pluginator/extendable_autodetect'
3
3
 
4
4
  describe Pluginator::ExtendableAutodetect do
data/test/group_test.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'minitest/autorun'
1
+ require 'test_helper'
2
2
  require 'pluginator/group'
3
3
 
4
4
  describe Pluginator::Group do
@@ -1,4 +1,4 @@
1
- require 'minitest/autorun'
1
+ require 'test_helper'
2
2
  require 'pluginator/name_converter'
3
3
 
4
4
  class Converter
@@ -1,4 +1,4 @@
1
- require 'minitest/autorun'
1
+ require 'test_helper'
2
2
  require 'plugins/pluginator/extensions/conversions'
3
3
 
4
4
  class ConversionsTester
@@ -1,4 +1,4 @@
1
- require 'minitest/autorun'
1
+ require 'test_helper'
2
2
  require 'plugins/pluginator/extensions/first_ask'
3
3
  require 'plugins/something/stats/max'
4
4
 
@@ -23,6 +23,10 @@ describe Pluginator::Extensions::FirstAsk do
23
23
  @tester.first_ask("stats", "handles?", "max").must_equal( Something::Stats::Max )
24
24
  end
25
25
 
26
+ it "finds proper plugin" do
27
+ @tester.first_ask("stats", "handles?", "max").action.must_equal( 42 )
28
+ end
29
+
26
30
  it "finds existing plugin - no exception" do
27
31
  @tester.first_ask!("stats", "handles?", "max").must_equal( Something::Stats::Max )
28
32
  end
@@ -31,9 +35,14 @@ describe Pluginator::Extensions::FirstAsk do
31
35
  @tester.first_ask("stats", "handles?", "min").must_equal( nil )
32
36
  end
33
37
 
34
- it "finds existing plugin" do
38
+ it "does not find missing plugin - exception plugin" do
35
39
  lambda {
36
40
  @tester.first_ask!("stats", "handles?", "min")
37
41
  }.must_raise(Pluginator::MissingPlugin)
38
42
  end
43
+ it "does not find missing plugin - exception type" do
44
+ lambda {
45
+ @tester.first_ask!("stats2", "handles?", "max")
46
+ }.must_raise(Pluginator::MissingType)
47
+ end
39
48
  end
@@ -1,4 +1,4 @@
1
- require 'minitest/autorun'
1
+ require 'test_helper'
2
2
  require 'plugins/pluginator/extensions/matching'
3
3
 
4
4
  class MatchingTester
@@ -1,4 +1,4 @@
1
- require 'minitest/autorun'
1
+ require 'test_helper'
2
2
  require 'plugins/pluginator/extensions/plugins_map'
3
3
 
4
4
  class PluginsMapTester
@@ -0,0 +1,8 @@
1
+ require 'simplecov'
2
+ SimpleCov.command_name "Unit Tests"
3
+ SimpleCov.start do
4
+ add_filter "/test/"
5
+ add_filter "/demo/"
6
+ end
7
+
8
+ require 'minitest/autorun'
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: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Papis
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: simplecov
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  description:
42
56
  email:
43
57
  - mpapis@gmail.com
@@ -73,6 +87,7 @@ files:
73
87
  - test/plugins/extensions/first_ask_test.rb
74
88
  - test/plugins/extensions/matching_test.rb
75
89
  - test/plugins/extensions/plugins_map_test.rb
90
+ - test/test_helper.rb
76
91
  homepage: https://github.com/rvm/pluginator
77
92
  licenses: []
78
93
  metadata: {}
@@ -105,4 +120,5 @@ test_files:
105
120
  - test/plugins/extensions/first_ask_test.rb
106
121
  - test/plugins/extensions/matching_test.rb
107
122
  - test/plugins/extensions/plugins_map_test.rb
123
+ - test/test_helper.rb
108
124
  has_rdoc: