pluginfactory 1.0.2 → 1.0.3
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.
- data/ChangeLog +293 -70
- data/LICENSE +27 -0
- data/README +189 -24
- data/Rakefile +252 -0
- data/lib/pluginfactory.rb +126 -128
- data/rake/dependencies.rb +62 -0
- data/rake/helpers.rb +382 -0
- data/rake/manual.rb +384 -0
- data/rake/packaging.rb +112 -0
- data/rake/publishing.rb +303 -0
- data/rake/rdoc.rb +30 -0
- data/rake/style.rb +62 -0
- data/rake/svn.rb +461 -0
- data/rake/testing.rb +191 -0
- data/rake/verifytask.rb +64 -0
- data/spec/pluginfactory_spec.rb +223 -0
- metadata +62 -43
- data/COPYRIGHT +0 -131
- data/install.rb +0 -172
- data/test.rb +0 -72
- data/tests/dir/deepsubofmybase.rb +0 -3
- data/tests/mybase.rb +0 -11
- data/tests/othersub.rb +0 -5
- data/tests/subofmybase.rb +0 -5
- data/utils.rb +0 -672
data/test.rb
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
#
|
3
|
-
# Tests for the PluginFactory module
|
4
|
-
#
|
5
|
-
|
6
|
-
BEGIN {
|
7
|
-
require 'pathname'
|
8
|
-
basedir = Pathname.new( __FILE__ ).dirname
|
9
|
-
|
10
|
-
$:.unshift( basedir + "lib" )
|
11
|
-
$:.unshift( basedir + "tests" )
|
12
|
-
}
|
13
|
-
|
14
|
-
require "pluginfactory"
|
15
|
-
require "test/unit"
|
16
|
-
require 'mybase'
|
17
|
-
|
18
|
-
class FactoryTests < Test::Unit::TestCase
|
19
|
-
|
20
|
-
def setup
|
21
|
-
if $DEBUG
|
22
|
-
PluginFactory.logger_callback = lambda {|lvl, msg|
|
23
|
-
$deferr.puts msg
|
24
|
-
}
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_inclusion_of_mixin_should_add_a_create_class_method
|
29
|
-
subclass = rval = nil
|
30
|
-
|
31
|
-
assert_nothing_raised do
|
32
|
-
subclass = Class::new { include PluginFactory }
|
33
|
-
end
|
34
|
-
|
35
|
-
assert_respond_to subclass, :create
|
36
|
-
end
|
37
|
-
|
38
|
-
|
39
|
-
@@subs = %w{subof OtherSub SubOfMyBase othersubmybase deepsubof}
|
40
|
-
|
41
|
-
|
42
|
-
def test_create_should_fetch_search_dirs_from_base_class
|
43
|
-
subclass = rval = nil
|
44
|
-
|
45
|
-
assert_nothing_raised do
|
46
|
-
subclass = Class::new {
|
47
|
-
include PluginFactory
|
48
|
-
@method_called = false
|
49
|
-
|
50
|
-
class << self
|
51
|
-
attr_accessor :method_called
|
52
|
-
end
|
53
|
-
def self.derivative_dirs
|
54
|
-
method_called = true
|
55
|
-
end
|
56
|
-
}
|
57
|
-
end
|
58
|
-
|
59
|
-
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_creation
|
63
|
-
@@subs.each do |sub|
|
64
|
-
result = nil
|
65
|
-
assert_nothing_raised {result = MyBase.create(sub)}
|
66
|
-
assert result.kind_of?(MyBase)
|
67
|
-
assert_match %r[#{sub}]i, result.class.name
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
|
72
|
-
end # class FactoryTests
|
data/tests/mybase.rb
DELETED
data/tests/othersub.rb
DELETED