pakada 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/pakada/module.rb CHANGED
@@ -8,7 +8,9 @@ class Pakada
8
8
  def included(klass)
9
9
  klass.send :include, Hooked::Container
10
10
 
11
- klass.singleton_class.class_eval { attr_reader :module_name, :path }
11
+ class << klass
12
+ attr_reader :module_name, :path
13
+ end
12
14
 
13
15
  unless klass.module_name
14
16
  klass.instance_variable_set :@module_name, detect_name(klass.to_s)
@@ -1,3 +1,3 @@
1
1
  class Pakada
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/pakada.rb CHANGED
@@ -30,6 +30,10 @@ class Pakada
30
30
  env == :production
31
31
  end
32
32
 
33
+ def [](name)
34
+ modules[name]
35
+ end
36
+
33
37
  def boot
34
38
  load_env
35
39
  load_modules
data/spec/pakada_spec.rb CHANGED
@@ -26,7 +26,7 @@ describe Pakada do
26
26
 
27
27
  describe "::DEFAULT_APP" do
28
28
  it "prints a tender welcome greeting" do
29
- Pakada::DEFAULT_APP.call({})[2].to_a.to_s.should =~ /Pakada #{Pakada::VERSION}/
29
+ Pakada::DEFAULT_APP.call({})[2].body.to_s.should =~ /Pakada #{Pakada::VERSION}/
30
30
  end
31
31
  end
32
32
 
@@ -127,6 +127,14 @@ describe Pakada do
127
127
  end
128
128
  end
129
129
 
130
+ describe ".[]" do
131
+ it "forwards to .modules" do
132
+ mod = stub "module"
133
+ subject.stub(:modules) { {:some_module => mod} }
134
+ subject[:some_module].should == subject.modules[:some_module]
135
+ end
136
+ end
137
+
130
138
  describe ".load_hooking" do
131
139
  it "initializes the hooking controller" do
132
140
  subject.stub(:modules) { {} }
@@ -238,7 +246,7 @@ describe Pakada do
238
246
  Rack::Request.stub(:new).with(req.env) { req }
239
247
  res = Rack::Response.new
240
248
  subject.boot
241
- subject.hooking.should_receive(:invoke).with(:request, req) {|r_e| res }
249
+ subject.hooking.should_receive(:invoke).with(:request, req) {|n, r_e| res }
242
250
  subject.handle_request(req.env).should == res.finish
243
251
  end
244
252
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
+ - 1
7
8
  - 0
8
- - 2
9
- version: 0.0.2
9
+ version: 0.1.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Lars Gierth
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-30 00:00:00 +01:00
17
+ date: 2011-01-13 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -142,7 +142,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - ">="
144
144
  - !ruby/object:Gem::Version
145
- hash: -781941123
145
+ hash: -268766609
146
146
  segments:
147
147
  - 0
148
148
  version: "0"
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  requirements:
152
152
  - - ">="
153
153
  - !ruby/object:Gem::Version
154
- hash: -781941123
154
+ hash: -268766609
155
155
  segments:
156
156
  - 0
157
157
  version: "0"