nyny 2.1.0 → 2.1.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: bd3b0074fdefc837e7c08f4c760b894165bf2755
4
- data.tar.gz: 4e7162b95bfbc2350f6f4cdccf36597ecf19ac8b
3
+ metadata.gz: eefb757442e7e6fee6409340e2764aaf6f561481
4
+ data.tar.gz: 43d71751f9f6563bdf36c86058b2b122e22ff528
5
5
  SHA512:
6
- metadata.gz: c3dc84c5a09a7dbb15ea47c52e55ff9679a473ad1241872fa81c44582ba0b3efe339f1cc1700a3dd29416191f221f58f2c926a0254cff08367dfcd50d5b59a8b
7
- data.tar.gz: 963aac17eefd5aa6d1b67fdacddba1fb4bd0e91c14a104739921701307792968f8a4d5011f568ba12a900598e30e8386286babb6c468232c01cf1a3a84be6426
6
+ metadata.gz: a99b05e35b1e634dc51a4351d19291a41020e31a81a1a592bfc623755833008422bfa77b020fe6b9372cf94f23d3ad8afdb8b485bf8a2105edcf9c15d8372fd1
7
+ data.tar.gz: c7cf0199e55dec48be37d4ef923058cc0ed25b61fc70c31bbc1683d7e1cd64633ca5066432cc7de69da3dcc357dbde973bc0de6ed4895d9644a53e57949aea52
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ 2.1.1
2
+ - After blocks will now be evaluated even if the request was halted
3
+
1
4
  2.1.0
2
5
  - Add ability to define helpers with a block
3
6
  - Remove benchmark folder, and create a single benchmark file which can be
data/README.md CHANGED
@@ -7,25 +7,31 @@
7
7
  [![Dependency Status](https://gemnasium.com/alisnic/nyny.png)](https://gemnasium.com/alisnic/nyny)
8
8
  [![Gem Version](https://badge.fury.io/rb/nyny.png)](http://badge.fury.io/rb/nyny)
9
9
 
10
- # myapp.rb
10
+ ```ruby
11
+ # myapp.rb
11
12
 
12
- require 'nyny'
13
- class App < NYNY::App
14
- get '/' do
15
- 'Hello world!'
16
- end
17
- end
13
+ require 'nyny'
14
+ class App < NYNY::App
15
+ get '/' do
16
+ 'Hello world!'
17
+ end
18
+ end
19
+
20
+ App.run!
21
+ ```
18
22
 
19
- App.run!
20
-
21
23
  Install the gem:
22
24
 
23
- gem install nyny
24
-
25
+ ```bash
26
+ gem install nyny
27
+ ```
28
+
25
29
  Run the file:
26
-
27
- ruby myapp.rb
28
-
30
+
31
+ ```bash
32
+ ruby myapp.rb
33
+ ```
34
+
29
35
  Open the browser at [http://localhost:9292](http://localhost:9292)
30
36
 
31
37
  - [TOP](#new-york-new-york)
@@ -74,11 +80,13 @@ as middleware.
74
80
 
75
81
  A NYNY app must _always_ be in a class which inherits from `NYNY::App`:
76
82
 
77
- class App < NYNY::App
78
- get '/' do
79
- 'Hello, World'
80
- end
81
- end
83
+ ```ruby
84
+ class App < NYNY::App
85
+ get '/' do
86
+ 'Hello, World'
87
+ end
88
+ end
89
+ ```
82
90
 
83
91
  ## Environment
84
92
  To get the directory in which your app is running use `NYNY.root`
data/lib/nyny/router.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  module NYNY
2
2
  class Router
3
- NullHandler = Class.new
4
-
5
3
  attr_reader :fallback, :routes, :before_hooks, :after_hooks
6
4
  def initialize options
7
5
  @fallback = options[:fallback]
@@ -30,12 +28,16 @@ module NYNY
30
28
  end
31
29
 
32
30
  def eval_response scope, handler
33
- catch (:halt) do
31
+ response = catch (:halt) do
34
32
  before_hooks.each {|h| scope.instance_eval &h }
35
- response = scope.apply_to &handler
33
+ scope.apply_to &handler
34
+ end
35
+
36
+ catch (:halt) do
36
37
  after_hooks.each {|h| scope.instance_eval &h }
37
- response
38
38
  end
39
+
40
+ response
39
41
  end
40
42
  end
41
43
  end
data/lib/nyny/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module NYNY
2
- VERSION = "2.1.0"
2
+ VERSION = "2.1.1"
3
3
  end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe Router do
4
+ let (:app) do
5
+ mock_app do
6
+ get '/' do
7
+ halt 200, {}, "Bar"
8
+ "Foo"
9
+ end
10
+
11
+ after do
12
+ response.body = "Zaz"
13
+ end
14
+ end
15
+ end
16
+
17
+ it "should eval after blocks even if the request was halted" do
18
+ response = app.get('/')
19
+ response.body.should == "Zaz"
20
+ end
21
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nyny
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrei Lisnic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-15 00:00:00.000000000 Z
11
+ date: 2013-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -98,6 +98,7 @@ files:
98
98
  - spec/nyny_spec.rb
99
99
  - spec/primitives_spec.rb
100
100
  - spec/request_scope_spec.rb
101
+ - spec/router_spec.rb
101
102
  - spec/runner_spec.rb
102
103
  - spec/spec_helper.rb
103
104
  homepage: http://alisnic.github.io/nyny/
@@ -120,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
121
  version: '0'
121
122
  requirements: []
122
123
  rubyforge_project:
123
- rubygems_version: 2.0.3
124
+ rubygems_version: 2.1.9
124
125
  signing_key:
125
126
  specification_version: 4
126
127
  summary: New York, New York.
@@ -129,5 +130,6 @@ test_files:
129
130
  - spec/nyny_spec.rb
130
131
  - spec/primitives_spec.rb
131
132
  - spec/request_scope_spec.rb
133
+ - spec/router_spec.rb
132
134
  - spec/runner_spec.rb
133
135
  - spec/spec_helper.rb