rainman 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.rspec +1 -0
- data/.travis.yml +11 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +252 -0
- data/Rakefile +16 -0
- data/example/domain/enom/nameservers.rb +10 -0
- data/example/domain/enom.rb +13 -0
- data/example/domain/opensrs/nameservers.rb +10 -0
- data/example/domain/opensrs.rb +13 -0
- data/example/domain.rb +28 -0
- data/lib/rainman/driver.rb +287 -0
- data/lib/rainman/exceptions.rb +43 -0
- data/lib/rainman/handler.rb +37 -0
- data/lib/rainman/runner.rb +81 -0
- data/lib/rainman/support.rb +75 -0
- data/lib/rainman/version.rb +3 -0
- data/lib/rainman.rb +9 -0
- data/rainman.gemspec +20 -0
- data/spec/integration_spec.rb +40 -0
- data/spec/rainman/driver_spec.rb +323 -0
- data/spec/rainman/exceptions_spec.rb +36 -0
- data/spec/rainman/handler_spec.rb +27 -0
- data/spec/rainman/runner_spec.rb +33 -0
- data/spec/rainman/support_spec.rb +33 -0
- data/spec/rainman_spec.rb +4 -0
- data/spec/spec_helper.rb +1 -0
- metadata +125 -0
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Rainman::Runner do
|
4
|
+
before do
|
5
|
+
@handler = mock("Handler")
|
6
|
+
@handler.stub(:hello).and_return(:hello)
|
7
|
+
@handler.class.stub(:handler_name).and_return(:name)
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:handler) { @handler }
|
11
|
+
let(:name) { :name }
|
12
|
+
subject { Rainman::Runner.new(handler) }
|
13
|
+
|
14
|
+
context "Accessors" do
|
15
|
+
its(:name) { should eql(name) }
|
16
|
+
its(:handler) { should eql(handler) }
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
describe "#execute" do
|
21
|
+
pending
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "#method_missing" do
|
25
|
+
it "should delegate to the handler" do
|
26
|
+
args = { :arg => 1 }
|
27
|
+
handler.should_receive(:hello).with(args).once
|
28
|
+
subject.hello(args)
|
29
|
+
end
|
30
|
+
|
31
|
+
it { expect { subject.missing }.to raise_error(NoMethodError) }
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# This file is pulled right from ActiveSupport 3.1, but we'll add a few specs
|
4
|
+
# anyway :)
|
5
|
+
describe "Rainman support" do
|
6
|
+
describe "String#constantize" do
|
7
|
+
"String".constantize.should == String
|
8
|
+
"Rainman".constantize.should == Rainman
|
9
|
+
"Rainman::Driver".constantize.should == Rainman::Driver
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "String#camelize" do
|
13
|
+
"foo_bar".camelize.should == "FooBar"
|
14
|
+
"some_module/some_class".camelize.should == "SomeModule::SomeClass"
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "Hash#reverse_merge" do
|
18
|
+
a = { :first => :ABC, :a => :a }
|
19
|
+
b = { :first => :XYZ, :b => :b }
|
20
|
+
|
21
|
+
c = a.reverse_merge(b)
|
22
|
+
c.should_not == a
|
23
|
+
c[:a].should == :a
|
24
|
+
c[:b].should == :b
|
25
|
+
c[:first].should == :ABC
|
26
|
+
|
27
|
+
b.reverse_merge!(a)
|
28
|
+
b[:first].should == :XYZ
|
29
|
+
b[:a].should == :a
|
30
|
+
b[:b].should == :b
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'rainman'
|
metadata
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rainman
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Justin Mazzi
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-01-13 00:00:00.000000000 -05:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rspec
|
17
|
+
requirement: &70116374547760 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 2.7.0
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *70116374547760
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: autotest-standalone
|
28
|
+
requirement: &70116374547060 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 4.5.8
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *70116374547060
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rake
|
39
|
+
requirement: &70116374546260 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 0.9.2.2
|
45
|
+
type: :development
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *70116374546260
|
48
|
+
description: A library for writing drivers using the abstract factory pattern
|
49
|
+
email:
|
50
|
+
- jmazzi@gmail.com
|
51
|
+
executables: []
|
52
|
+
extensions: []
|
53
|
+
extra_rdoc_files: []
|
54
|
+
files:
|
55
|
+
- .gitignore
|
56
|
+
- .rspec
|
57
|
+
- .travis.yml
|
58
|
+
- Gemfile
|
59
|
+
- LICENSE
|
60
|
+
- README.md
|
61
|
+
- Rakefile
|
62
|
+
- example/domain.rb
|
63
|
+
- example/domain/enom.rb
|
64
|
+
- example/domain/enom/nameservers.rb
|
65
|
+
- example/domain/opensrs.rb
|
66
|
+
- example/domain/opensrs/nameservers.rb
|
67
|
+
- lib/rainman.rb
|
68
|
+
- lib/rainman/driver.rb
|
69
|
+
- lib/rainman/exceptions.rb
|
70
|
+
- lib/rainman/handler.rb
|
71
|
+
- lib/rainman/runner.rb
|
72
|
+
- lib/rainman/support.rb
|
73
|
+
- lib/rainman/version.rb
|
74
|
+
- rainman.gemspec
|
75
|
+
- spec/integration_spec.rb
|
76
|
+
- spec/rainman/driver_spec.rb
|
77
|
+
- spec/rainman/exceptions_spec.rb
|
78
|
+
- spec/rainman/handler_spec.rb
|
79
|
+
- spec/rainman/runner_spec.rb
|
80
|
+
- spec/rainman/support_spec.rb
|
81
|
+
- spec/rainman_spec.rb
|
82
|
+
- spec/spec_helper.rb
|
83
|
+
has_rdoc: true
|
84
|
+
homepage: http://www.eng5.com
|
85
|
+
licenses: []
|
86
|
+
post_install_message:
|
87
|
+
rdoc_options: []
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ! '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
segments:
|
97
|
+
- 0
|
98
|
+
hash: -1604667842833133172
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
102
|
+
- - ! '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
segments:
|
106
|
+
- 0
|
107
|
+
hash: -1604667842833133172
|
108
|
+
requirements: []
|
109
|
+
rubyforge_project:
|
110
|
+
rubygems_version: 1.6.2
|
111
|
+
signing_key:
|
112
|
+
specification_version: 3
|
113
|
+
summary: Rainman is an experiment in writing drivers and handlers. It is a Ruby implementation
|
114
|
+
of the abstract factory pattern. Abstract factories provide the general API used
|
115
|
+
to interact with any number of interfaces. Interfaces perform actual operations.
|
116
|
+
Rainman provides a simple DSL for implementing this design.
|
117
|
+
test_files:
|
118
|
+
- spec/integration_spec.rb
|
119
|
+
- spec/rainman/driver_spec.rb
|
120
|
+
- spec/rainman/exceptions_spec.rb
|
121
|
+
- spec/rainman/handler_spec.rb
|
122
|
+
- spec/rainman/runner_spec.rb
|
123
|
+
- spec/rainman/support_spec.rb
|
124
|
+
- spec/rainman_spec.rb
|
125
|
+
- spec/spec_helper.rb
|