spank 0.0.1385937112 → 0.0.1393558686
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/Rakefile +4 -17
- data/lib/spank/container.rb +0 -6
- data/lib/spank/container_error.rb +7 -0
- data/lib/spank/ioc.rb +18 -5
- data/lib/spank/lambda_behaviours.rb +1 -1
- data/lib/spank/version.rb +1 -1
- data/lib/spank.rb +8 -7
- data/spec/unit/ioc_spec.rb +11 -1
- metadata +18 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f22e9dd039cb92502287408966d3b003a1600584
|
4
|
+
data.tar.gz: 98747dd79ff26679657056709f1144acd64f2bda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7b8ff019a4b9efbb4766bd3df164f5c2a9ea24f45a5ff1c8bc446080e7933b1299e594fe330dca281d73620c49b715eb5a29fb9637d2ce495be1d2385aed144
|
7
|
+
data.tar.gz: 5b7d86c2f9a623e98c762edf305c7ce12e183f1ce638fc2e1f653dbdeeca15e60b8b63e2118e2cb1df2842336c1db05e5dbc980ff83539c7b11e454f534fcd82
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.1.1
|
data/Rakefile
CHANGED
@@ -1,20 +1,7 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
+
require 'rspec/core/rake_task'
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
task :spec do
|
6
|
-
system 'rspec'
|
7
|
-
end
|
8
|
-
|
9
|
-
task :clean do
|
10
|
-
system 'rm *.gem'
|
11
|
-
system 'rm -fr pkg'
|
12
|
-
end
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
13
5
|
|
14
|
-
task :
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
task :publish => :build do
|
19
|
-
system 'gem push *.gem'
|
20
|
-
end
|
6
|
+
task :default => :spec
|
7
|
+
task :publish => [:build, :release]
|
data/lib/spank/container.rb
CHANGED
data/lib/spank/ioc.rb
CHANGED
@@ -1,11 +1,24 @@
|
|
1
1
|
module Spank
|
2
2
|
class IOC
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
class << self
|
4
|
+
def bind_to(container)
|
5
|
+
@@container = container
|
6
|
+
end
|
7
|
+
|
8
|
+
def resolve(symbol)
|
9
|
+
raise create_error unless class_variable_defined?(:@@container)
|
10
|
+
@@container.resolve(symbol)
|
11
|
+
end
|
12
|
+
|
13
|
+
def unbind
|
14
|
+
remove_class_variable(:@@container) if class_variable_defined?(:@@container)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
6
18
|
|
7
|
-
|
8
|
-
|
19
|
+
def create_error
|
20
|
+
ContainerError.new("Spank::IOC.bind_to(container) has not been called.")
|
21
|
+
end
|
9
22
|
end
|
10
23
|
end
|
11
24
|
end
|
data/lib/spank/version.rb
CHANGED
data/lib/spank.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
require 'spank/
|
2
|
-
require 'spank/
|
3
|
-
require 'spank/
|
4
|
-
require 'spank/
|
5
|
-
require 'spank/
|
6
|
-
require 'spank/
|
7
|
-
require 'spank/
|
1
|
+
require 'spank/container_error'
|
2
|
+
require 'spank/lambda_behaviours'
|
3
|
+
require 'spank/component'
|
4
|
+
require 'spank/container'
|
5
|
+
require 'spank/interceptor_registration'
|
6
|
+
require 'spank/invocation'
|
7
|
+
require 'spank/ioc'
|
8
|
+
require 'spank/proxy'
|
8
9
|
require 'spank/interceptor_chain'
|
9
10
|
require 'spank/version'
|
data/spec/unit/ioc_spec.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe Spank::IOC do
|
4
|
+
after :each do
|
5
|
+
Spank::IOC.unbind
|
6
|
+
end
|
7
|
+
|
4
8
|
context "when bound to a container" do
|
5
9
|
let(:container) { double }
|
6
10
|
let(:component) { double }
|
@@ -12,8 +16,14 @@ describe Spank::IOC do
|
|
12
16
|
|
13
17
|
let(:result) { Spank::IOC.resolve(:idbconnection) }
|
14
18
|
|
15
|
-
it "
|
19
|
+
it "resolves the item from the container" do
|
16
20
|
result.should == component
|
17
21
|
end
|
18
22
|
end
|
23
|
+
|
24
|
+
context "when nothing is bound" do
|
25
|
+
it "raises a meaningful exception" do
|
26
|
+
expect { Spank::IOC.resolve(:food) }.to raise_error(Spank::ContainerError)
|
27
|
+
end
|
28
|
+
end
|
19
29
|
end
|
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spank
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1393558686
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mo khan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: simplecov
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
description: A simple ruby container
|
@@ -73,10 +73,10 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
-
- .gitignore
|
77
|
-
- .ruby-gemset
|
78
|
-
- .ruby-version
|
79
|
-
- .travis.yml
|
76
|
+
- ".gitignore"
|
77
|
+
- ".ruby-gemset"
|
78
|
+
- ".ruby-version"
|
79
|
+
- ".travis.yml"
|
80
80
|
- Gemfile
|
81
81
|
- LICENSE.txt
|
82
82
|
- README.md
|
@@ -84,6 +84,7 @@ files:
|
|
84
84
|
- lib/spank.rb
|
85
85
|
- lib/spank/component.rb
|
86
86
|
- lib/spank/container.rb
|
87
|
+
- lib/spank/container_error.rb
|
87
88
|
- lib/spank/interceptor_chain.rb
|
88
89
|
- lib/spank/interceptor_registration.rb
|
89
90
|
- lib/spank/invocation.rb
|
@@ -106,17 +107,17 @@ require_paths:
|
|
106
107
|
- lib
|
107
108
|
required_ruby_version: !ruby/object:Gem::Requirement
|
108
109
|
requirements:
|
109
|
-
- -
|
110
|
+
- - ">="
|
110
111
|
- !ruby/object:Gem::Version
|
111
112
|
version: 2.0.0
|
112
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
114
|
requirements:
|
114
|
-
- -
|
115
|
+
- - ">="
|
115
116
|
- !ruby/object:Gem::Version
|
116
117
|
version: '0'
|
117
118
|
requirements: []
|
118
119
|
rubyforge_project:
|
119
|
-
rubygems_version: 2.
|
120
|
+
rubygems_version: 2.2.2
|
120
121
|
signing_key:
|
121
122
|
specification_version: 4
|
122
123
|
summary: spank!
|