utopia 0.11.5 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZWI3NDM0Y2E3NDI3ZTUxMzg3Njc2NGM0ODUyNDJhYWViNzkyZDc3OQ==
4
+ ZmQ5MzEwYTYwZjY3NDI0MzUzYmIwYmYyODUxNDg2ODM0N2M2YjM4Yg==
5
5
  data.tar.gz: !binary |-
6
- MmM1MTA3ZGVlZWMwMWZmZDU3Y2Q5Y2FlMmIxNDNmMjkxNDBlN2JiNA==
6
+ ZDk3OTk2ZjQ4NzY3NzZhOTIwZWFhY2E0ZGY2MGQ3MGRkOTE3M2Q4MA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NWU5ZTBkOTlhZTExYjM2NzA5NzUzZjg1YjUxNDhjOTJjNmE1NTRjYTNlZTU2
10
- Njc5YTdlNzAxZTg2YTk5YWE2NzUzYmZjM2Y3MjY5ODUyNGY3MDNjOTEzMGM5
11
- YmUzNzg3Zjk1YTJhNGNlM2YxNTMyNDk0NDQxYjE0OGMyMmJkNjU=
9
+ ZTU0ODE1MGI1YjBjMTY5NWRmZTBmMzYyNTk0ZDZmYTFmZjcyNWEzNzY1NTM1
10
+ NjYyZWIyNGYyZjlhODk1NTM1MGRjMTgzNWQzMGJmNjBlMzYzNDZmODBlM2Jm
11
+ ODE1YjUyOGQ4OTkzMDM0NmE4Yzc1OWZlYzAzNWQzNWNlZWI4YmE=
12
12
  data.tar.gz: !binary |-
13
- ZTVlMmE0OWM2YWFlMmQwZGM3ZWU0NTM2NTgwOThhNGRkNmEwZmQ3ZmU3MTAw
14
- ZDE3NzlhN2MyOTFjZjkyNTY4Y2UxMmRkYjg1NzA5ZTkwNzE4NWU5YWZlOTA3
15
- NDJhYjVhN2E1OWUzMmE4YWY0NjczYTU5OGE3YzZkMzk0MzViNjY=
13
+ MDU2M2E4NTZiMGMyMjhhYjhlMTdmNmQwNGEyYTYyYjA5Y2RhOGRkYjdhY2Jm
14
+ OTBiYTczMTEwNDg5MDk1ZTY0NWNlMGY2Y2MxNGJkMjE1ZmU5NzIyYjVhOWM5
15
+ MWI3NzdmNTE0N2EyYzU2NjJjOWI5NjE3YWVlOWU0ZmY1MzVlYjY=
data/.travis.yml CHANGED
@@ -1,8 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - "1.8.7"
4
- - "1.9.2"
5
4
  - "1.9.3"
5
+ - "2.0"
6
6
  - jruby-18mode # JRuby in 1.8 mode
7
7
  - jruby-19mode # JRuby in 1.9 mode
8
8
  - rbx-18mode
@@ -166,7 +166,7 @@ module Utopia
166
166
  @_controller.app.call(env)
167
167
  end
168
168
 
169
- def respond! (*args)
169
+ def respond!(*args)
170
170
  throw :response, args
171
171
  end
172
172
 
@@ -182,6 +182,10 @@ module Utopia
182
182
  respond! error
183
183
  end
184
184
 
185
+ def success!(*args)
186
+ respond! :success, *args
187
+ end
188
+
185
189
  def respond_with(*args)
186
190
  return args[0] if args[0] == nil || Array === args[0]
187
191
 
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Utopia
22
- VERSION = "0.11.5"
22
+ VERSION = "0.12.0"
23
23
  end
@@ -0,0 +1,66 @@
1
+ # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require 'test/unit'
22
+ require 'rack/mock'
23
+ require 'utopia/middleware/controller'
24
+
25
+ class TestControllerMiddleware < Test::Unit::TestCase
26
+ APP = lambda {|env| [404, [], []]}
27
+
28
+ class TestController < Utopia::Middleware::Controller::Base
29
+ def on_success(path, request)
30
+ success!
31
+ end
32
+
33
+ def on_failure(path, request)
34
+ fail!
35
+ end
36
+
37
+ def on_variable(path, request)
38
+ @variable = :value
39
+ end
40
+ end
41
+
42
+ class MockControllerMiddleware
43
+ attr :env
44
+
45
+ def call(env)
46
+ @env = env
47
+ end
48
+ end
49
+
50
+ def test_controller_response
51
+ variables = Utopia::Middleware::Controller::Variables.new
52
+ request = Rack::Request.new("utopia.controller" => variables)
53
+ middleware = MockControllerMiddleware.new
54
+ controller = TestController.new(middleware)
55
+
56
+ result = controller.process!(Utopia::Path["/success"], request)
57
+ assert_equal [200, {}, []], result
58
+
59
+ result = controller.process!(Utopia::Path["/failure"], request)
60
+ assert_equal [400, {}, ["Bad Request"]], result
61
+
62
+ result = controller.process!(Utopia::Path["/variable"], request)
63
+ assert_equal({"variable"=>:value}, variables.to_hash)
64
+ end
65
+ end
66
+
data/utopia.gemspec CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
15
15
  structure representing the website.
16
16
  EOF
17
17
  gem.summary = %q{Utopia is a framework for building dynamic content-driven websites.}
18
- gem.homepage = ""
18
+ gem.homepage = "https://github.com/ioquatix/utopia"
19
19
 
20
20
  gem.files = `git ls-files`.split($/)
21
21
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utopia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.5
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-07 00:00:00.000000000 Z
11
+ date: 2013-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trenni
@@ -152,9 +152,10 @@ files:
152
152
  - test/content_root/_heading.xnode
153
153
  - test/content_root/index.xnode
154
154
  - test/test_content_middleware.rb
155
+ - test/test_controller_middleware.rb
155
156
  - test/test_path.rb
156
157
  - utopia.gemspec
157
- homepage: ''
158
+ homepage: https://github.com/ioquatix/utopia
158
159
  licenses: []
159
160
  metadata: {}
160
161
  post_install_message:
@@ -181,4 +182,5 @@ test_files:
181
182
  - test/content_root/_heading.xnode
182
183
  - test/content_root/index.xnode
183
184
  - test/test_content_middleware.rb
185
+ - test/test_controller_middleware.rb
184
186
  - test/test_path.rb