utopia 0.12.6 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +6 -2
  3. data/Gemfile +6 -0
  4. data/README.md +48 -14
  5. data/Rakefile +5 -0
  6. data/bin/utopia +132 -15
  7. data/lib/utopia.rb +13 -10
  8. data/lib/utopia/content.rb +140 -0
  9. data/lib/utopia/content/link.rb +124 -0
  10. data/lib/utopia/content/links.rb +228 -0
  11. data/lib/utopia/content/node.rb +387 -0
  12. data/lib/utopia/content/processor.rb +128 -0
  13. data/lib/utopia/content/tag.rb +102 -0
  14. data/lib/utopia/controller.rb +137 -0
  15. data/lib/utopia/controller/action.rb +112 -0
  16. data/lib/utopia/controller/base.rb +174 -0
  17. data/lib/utopia/{middleware/controller → controller}/variables.rb +36 -38
  18. data/lib/utopia/exception_handler.rb +79 -0
  19. data/lib/utopia/extensions/array.rb +2 -2
  20. data/lib/utopia/localization.rb +143 -0
  21. data/lib/utopia/mail_exceptions.rb +136 -0
  22. data/lib/utopia/middleware.rb +7 -22
  23. data/lib/utopia/path.rb +150 -60
  24. data/lib/utopia/redirector.rb +152 -0
  25. data/lib/utopia/{extensions/hash.rb → session.rb} +4 -6
  26. data/lib/utopia/session/encrypted_cookie.rb +46 -48
  27. data/lib/utopia/{middleware/directory_index.rb → session/lazy_hash.rb} +44 -27
  28. data/lib/utopia/static.rb +255 -0
  29. data/lib/utopia/tags/deferred.rb +12 -8
  30. data/lib/utopia/tags/environment.rb +18 -6
  31. data/lib/utopia/tags/node.rb +12 -8
  32. data/lib/utopia/tags/override.rb +12 -12
  33. data/lib/utopia/version.rb +1 -1
  34. data/setup/.bowerrc +3 -0
  35. data/{lib/utopia/setup → setup}/Gemfile +1 -1
  36. data/setup/Rakefile +4 -0
  37. data/{lib/utopia/setup → setup}/cache/head/readme.txt +0 -0
  38. data/{lib/utopia/setup → setup}/cache/meta/readme.txt +0 -0
  39. data/setup/config.ru +64 -0
  40. data/{lib/utopia/setup → setup}/lib/readme.txt +0 -0
  41. data/{lib/utopia/setup → setup}/pages/_heading.xnode +0 -0
  42. data/{lib/utopia/setup → setup}/pages/_page.xnode +1 -1
  43. data/{lib/utopia/setup → setup}/pages/_static/icon.png +0 -0
  44. data/setup/pages/_static/site.css +70 -0
  45. data/{lib/utopia/setup → setup}/pages/errors/exception.xnode +0 -0
  46. data/{lib/utopia/setup → setup}/pages/errors/file-not-found.xnode +0 -0
  47. data/{lib/utopia/setup → setup}/pages/links.yaml +0 -0
  48. data/setup/pages/welcome/index.xnode +17 -0
  49. data/{lib/utopia/setup → setup}/public/readme.txt +0 -0
  50. data/spec/utopia/content/link_spec.rb +108 -0
  51. data/spec/utopia/content/links/foo/index.xnode +0 -0
  52. data/spec/utopia/content/links/foo/links.yaml +2 -0
  53. data/spec/utopia/content/links/foo/test.de.xnode +0 -0
  54. data/spec/utopia/content/links/foo/test.en.xnode +0 -0
  55. data/spec/utopia/content/links/links.yaml +9 -0
  56. data/spec/utopia/content/links/welcome.xnode +0 -0
  57. data/spec/utopia/content/localized/five/index.en.xnode +0 -0
  58. data/spec/utopia/content/localized/four/index.en.xnode +0 -0
  59. data/spec/utopia/content/localized/four/index.zh.xnode +0 -0
  60. data/spec/utopia/content/localized/four/links.yaml +4 -0
  61. data/spec/utopia/content/localized/links.yaml +16 -0
  62. data/spec/utopia/content/localized/one.xnode +0 -0
  63. data/spec/utopia/content/localized/three/index.xnode +0 -0
  64. data/spec/utopia/content/localized/two.en.xnode +0 -0
  65. data/spec/utopia/content/localized/two.zh.xnode +0 -0
  66. data/spec/utopia/content/node/ordered/first.xnode +0 -0
  67. data/spec/utopia/content/node/ordered/index.xnode +0 -0
  68. data/spec/utopia/content/node/ordered/links.yaml +4 -0
  69. data/spec/utopia/content/node/ordered/second.xnode +0 -0
  70. data/spec/utopia/content/node/related/foo.en.xnode +0 -0
  71. data/spec/utopia/content/node/related/foo.ja.xnode +0 -0
  72. data/spec/utopia/content/node/related/links.yaml +4 -0
  73. data/spec/utopia/content/node_spec.rb +63 -0
  74. data/spec/utopia/{middleware/content_spec.rb → content/processor_spec.rb} +34 -23
  75. data/spec/utopia/content_spec.rb +87 -0
  76. data/spec/utopia/content_spec.ru +10 -0
  77. data/spec/utopia/{middleware/controller_spec.rb → controller_spec.rb} +61 -16
  78. data/spec/utopia/controller_spec.ru +4 -0
  79. data/spec/utopia/extensions_spec.rb +6 -17
  80. data/spec/utopia/localization_spec.rb +60 -0
  81. data/spec/utopia/localization_spec.ru +11 -0
  82. data/{lib/utopia/tags.rb → spec/utopia/middleware_spec.rb} +8 -14
  83. data/spec/utopia/{middleware/content_root → pages}/_heading.xnode +0 -0
  84. data/spec/utopia/pages/content/_show-value.xnode +1 -0
  85. data/spec/utopia/pages/content/test-partial.xnode +1 -0
  86. data/spec/utopia/pages/controller/controller.rb +28 -0
  87. data/spec/utopia/pages/controller/index.xnode +1 -0
  88. data/spec/utopia/pages/controller/nested/controller.rb +4 -0
  89. data/spec/utopia/{middleware/content_root → pages}/index.xnode +0 -0
  90. data/spec/utopia/pages/localized.de.txt +1 -0
  91. data/spec/utopia/pages/localized.en.txt +1 -0
  92. data/spec/utopia/pages/localized.jp.txt +1 -0
  93. data/spec/utopia/pages/node/index.xnode +1 -0
  94. data/spec/utopia/pages/test.txt +1 -0
  95. data/spec/utopia/path_spec.rb +109 -0
  96. data/spec/utopia/rack_spec.rb +2 -0
  97. data/spec/utopia/session_spec.rb +82 -0
  98. data/spec/utopia/session_spec.ru +20 -0
  99. data/spec/utopia/spec_helper.rb +16 -0
  100. data/{lib/utopia/extensions/string.rb → spec/utopia/static_spec.rb} +24 -15
  101. data/spec/utopia/static_spec.ru +4 -0
  102. data/utopia.gemspec +3 -3
  103. metadata +138 -54
  104. data/lib/utopia/extensions/regexp.rb +0 -33
  105. data/lib/utopia/link.rb +0 -288
  106. data/lib/utopia/middleware/all.rb +0 -33
  107. data/lib/utopia/middleware/content.rb +0 -157
  108. data/lib/utopia/middleware/content/node.rb +0 -386
  109. data/lib/utopia/middleware/content/processor.rb +0 -123
  110. data/lib/utopia/middleware/controller.rb +0 -130
  111. data/lib/utopia/middleware/controller/action.rb +0 -121
  112. data/lib/utopia/middleware/controller/base.rb +0 -184
  113. data/lib/utopia/middleware/exception_handler.rb +0 -80
  114. data/lib/utopia/middleware/localization.rb +0 -147
  115. data/lib/utopia/middleware/localization/name.rb +0 -69
  116. data/lib/utopia/middleware/mail_exceptions.rb +0 -138
  117. data/lib/utopia/middleware/redirector.rb +0 -146
  118. data/lib/utopia/middleware/requester.rb +0 -126
  119. data/lib/utopia/middleware/static.rb +0 -295
  120. data/lib/utopia/setup.rb +0 -60
  121. data/lib/utopia/setup/config.ru +0 -47
  122. data/lib/utopia/setup/pages/_static/background.png +0 -0
  123. data/lib/utopia/setup/pages/_static/site.css +0 -48
  124. data/lib/utopia/setup/pages/welcome/index.xnode +0 -7
  125. data/lib/utopia/tag.rb +0 -105
  126. data/lib/utopia/tags/all.rb +0 -34
@@ -0,0 +1,4 @@
1
+
2
+ use Utopia::Controller, root: File.expand_path('../pages', __FILE__)
3
+
4
+ run lambda {|env| [404, {}, []]}
@@ -18,10 +18,10 @@
18
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  # THE SOFTWARE.
20
20
 
21
+ require_relative 'spec_helper'
22
+
21
23
  require 'utopia/extensions/array'
22
24
  require 'utopia/extensions/date'
23
- require 'utopia/extensions/hash'
24
- require 'utopia/extensions/regexp'
25
25
 
26
26
  module Utopia::ExtensionsSpec
27
27
  describe Array do
@@ -34,6 +34,10 @@ module Utopia::ExtensionsSpec
34
34
  expect(b).to be == 3
35
35
  expect(c).to be == [4, 5]
36
36
  end
37
+
38
+ it "should not split empty array" do
39
+ expect([].split_at('a')).to be == [[], nil, []]
40
+ end
37
41
  end
38
42
 
39
43
  describe Date do
@@ -66,19 +70,4 @@ module Utopia::ExtensionsSpec
66
70
  expect(today.to_time <=> yesterday.to_time).to be == 1
67
71
  end
68
72
  end
69
-
70
- describe Hash do
71
- it "should symbolize keys" do
72
- hash = {'a' => 1, 'b' => 2}
73
-
74
- expect(hash.symbolize_keys).to be == {a: 1, b: 2}
75
- end
76
- end
77
-
78
- describe Regexp do
79
- it "should start with" do
80
- expect(Regexp.starts_with("foobar")).to be =~ "foobarbaz"
81
- expect(Regexp.starts_with("bar")).to_not be =~ "blubarbaz"
82
- end
83
- end
84
73
  end
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env rspec
2
+ # Copyright, 2014, by Samuel G. D. Williams. <http://www.codeotaku.com>
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ # of this software and associated documentation files (the "Software"), to deal
6
+ # in the Software without restriction, including without limitation the rights
7
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ # copies of the Software, and to permit persons to whom the Software is
9
+ # furnished to do so, subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in
12
+ # all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ # THE SOFTWARE.
21
+
22
+ require_relative 'spec_helper'
23
+
24
+ require 'rack'
25
+ require 'rack/test'
26
+
27
+ require 'utopia/static'
28
+ require 'utopia/content'
29
+ require 'utopia/localization'
30
+
31
+ module Utopia::StaticSpec
32
+ describe Utopia::Static do
33
+ include Rack::Test::Methods
34
+
35
+ let(:app) {Rack::Builder.parse_file(File.expand_path('../localization_spec.ru', __FILE__)).first}
36
+
37
+ it "should respond with default localization" do
38
+ get '/localized.txt'
39
+
40
+ expect(last_response.body).to be == 'localized.en.txt'
41
+ end
42
+
43
+ it "should respond with the requested localization" do
44
+ get '/en/localized.txt'
45
+ expect(last_response.body).to be == 'localized.en.txt'
46
+
47
+ get '/de/localized.txt'
48
+ expect(last_response.body).to be == 'localized.de.txt'
49
+
50
+ get '/jp/localized.txt'
51
+ expect(last_response.body).to be == 'localized.jp.txt'
52
+ end
53
+
54
+ it "should respond with accepted language localization" do
55
+ get '/localized.txt', {}, 'HTTP_ACCEPT_LANGUAGE' => 'jp,en'
56
+
57
+ expect(last_response.body).to be == 'localized.jp.txt'
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,11 @@
1
+
2
+ use Utopia::Localization,
3
+ locales: ['en', 'jp', 'de']
4
+
5
+ use Utopia::Static,
6
+ root: File.expand_path('../pages', __FILE__)
7
+
8
+ use Utopia::Content,
9
+ root: File.expand_path('../pages', __FILE__)
10
+
11
+ run lambda { |env| [404, {}, []] }
@@ -18,20 +18,14 @@
18
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  # THE SOFTWARE.
20
20
 
21
- module Utopia
22
- module Tags
23
- @@all = {}
24
-
25
- def self.register(name, tag)
26
- @@all[name] = tag
27
- end
28
-
29
- def self.create(name, &block)
30
- @@all[name] = block
31
- end
32
-
33
- def self.all
34
- @@all
21
+ require_relative 'spec_helper'
22
+
23
+ require 'utopia/middleware'
24
+
25
+ module Utopia::MiddlewareSpec
26
+ describe Utopia do
27
+ it "should give a default path relative to the cwd" do
28
+ expect(File).to exist(Utopia::default_root('pages', File.dirname(__FILE__)))
35
29
  end
36
30
  end
37
31
  end
@@ -0,0 +1 @@
1
+ #{attributes[:value]}
@@ -0,0 +1 @@
1
+ #{partial 'show-value', value: 10}
@@ -0,0 +1,28 @@
1
+
2
+ on 'flat' do
3
+ success! content: "flat"
4
+ end
5
+
6
+ on '**/hello-world' do
7
+ success! content: @hello_world
8
+ end
9
+
10
+ on '**' do
11
+ @hello_world = "Hello World"
12
+ end
13
+
14
+ on 'ignore' do
15
+ ignore!
16
+ end
17
+
18
+ on 'redirect' do
19
+ redirect! 'bar'
20
+ end
21
+
22
+ on 'rewrite' do
23
+ rewrite! 'index'
24
+ end
25
+
26
+ on 'index' do
27
+ success! content: 'Hello World'
28
+ end
@@ -0,0 +1,4 @@
1
+
2
+ on 'foobar' do
3
+ success! content: "Foobar"
4
+ end
@@ -0,0 +1 @@
1
+ localized.de.txt
@@ -0,0 +1 @@
1
+ localized.en.txt
@@ -0,0 +1 @@
1
+ localized.jp.txt
@@ -0,0 +1 @@
1
+ #{local_path}
@@ -0,0 +1 @@
1
+ Hello World!
@@ -1,3 +1,5 @@
1
+ #!/usr/bin/env rspec
2
+
1
3
  # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -18,10 +20,19 @@
18
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
21
  # THE SOFTWARE.
20
22
 
23
+ require_relative 'spec_helper'
24
+
21
25
  require 'utopia/path'
22
26
 
23
27
  module Utopia::PathSpec
24
28
  describe Utopia::Path do
29
+ it "should be root path" do
30
+ root = Utopia::Path["/"]
31
+
32
+ expect(root.components).to be == ['', '']
33
+ expect(root.to_local_path).to be == '/'
34
+ end
35
+
25
36
  it "should concatenate absolute paths" do
26
37
  root = Utopia::Path["/"]
27
38
 
@@ -42,5 +53,103 @@ module Utopia::PathSpec
42
53
 
43
54
  expect(descendants.reverse).to be == ascendants
44
55
  end
56
+
57
+ it "should be able to remove relative path entries" do
58
+ path = Utopia::Path["/foo/bar/../baz/."]
59
+ expect(path.simplify.components).to be == ['', 'foo', 'baz']
60
+
61
+ path = Utopia::Path["/foo/bar/../baz/./"]
62
+ expect(path.simplify.components).to be == ['', 'foo', 'baz', '']
63
+ end
64
+
65
+ it "should remove the extension from the basename" do
66
+ path = Utopia::Path["dir/foo.html"]
67
+
68
+ basename = path.basename("html")
69
+
70
+ expect(basename.name).to be == 'foo'
71
+ expect(basename.extension).to be == 'html'
72
+ end
73
+
74
+ it "should be able to convert into a directory" do
75
+ path = Utopia::Path["foo/bar"]
76
+
77
+ expect(path).to_not be_directory
78
+
79
+ expect(path.to_directory).to be_directory
80
+
81
+ dir_path = path.to_directory
82
+ expect(dir_path.to_directory).to be == dir_path
83
+ end
84
+
85
+ it "should start with the given path" do
86
+ path = Utopia::Path["/a/b/c/d/e"]
87
+
88
+ expect(path.start_with?(path.dirname)).to be true
89
+ end
90
+
91
+ it "should split at the specified point" do
92
+ path = Utopia::Path["/a/b/c/d/e"]
93
+
94
+ expect(path.split('c')).to be == [Utopia::Path['/a/b'], Utopia::Path['d/e']]
95
+ end
96
+
97
+ it "shouldn't be able to modify frozen paths" do
98
+ path = Utopia::Path["dir/foo.html"]
99
+
100
+ path.freeze
101
+
102
+ expect(path.frozen?).to be true
103
+
104
+ expect{path[0] = 'bob'}.to raise_exception(RuntimeError)
105
+ end
106
+
107
+ it "should give the correct variant" do
108
+ path = Utopia::Path["foo.en"]
109
+
110
+ expect(path.basename.variant).to be == 'en'
111
+ end
112
+
113
+ it "should give no variant" do
114
+ path = Utopia::Path["foo"]
115
+
116
+ expect(path.basename.variant).to be == nil
117
+ end
118
+
119
+ it "should expand relative paths" do
120
+ root = Utopia::Path['/root']
121
+ path = Utopia::Path["dir/foo.html"]
122
+
123
+ expect(path.expand(root)).to be == (root + path)
124
+ end
125
+
126
+ it "shouldn't expand absolute paths" do
127
+ root = Utopia::Path['/root']
128
+ path = Utopia::Path["dir/foo.html"]
129
+
130
+ expect(root.expand(root)).to be == root
131
+ end
132
+
133
+ it "should give the shortest path for outer paths" do
134
+ input = Utopia::Path.create("/a/b/c/index")
135
+ output = Utopia::Path.create("/a/b/c/d/e/")
136
+
137
+ short = input.shortest_path(output)
138
+
139
+ expect(short.components).to be == ["..", "..", "index"]
140
+
141
+ expect((output + short).simplify).to be == input
142
+ end
143
+
144
+ it "should give the shortest path for inner paths" do
145
+ input = Utopia::Path.create("/a/b/c/index")
146
+ output = Utopia::Path.create("/a/")
147
+
148
+ short = input.shortest_path(output)
149
+
150
+ expect(short.components).to be == ["b", "c", "index"]
151
+
152
+ expect((output + short).simplify).to be == input
153
+ end
45
154
  end
46
155
  end
@@ -18,6 +18,8 @@
18
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  # THE SOFTWARE.
20
20
 
21
+ require_relative 'spec_helper'
22
+
21
23
  require 'utopia/extensions/date'
22
24
  require 'utopia/extensions/rack'
23
25
 
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env rspec
2
+ # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ # of this software and associated documentation files (the "Software"), to deal
6
+ # in the Software without restriction, including without limitation the rights
7
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ # copies of the Software, and to permit persons to whom the Software is
9
+ # furnished to do so, subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in
12
+ # all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ # THE SOFTWARE.
21
+
22
+ require_relative 'spec_helper'
23
+
24
+ require 'rack'
25
+ require 'rack/test'
26
+
27
+ require 'utopia/session'
28
+ require 'utopia/session/encrypted_cookie'
29
+
30
+ module Utopia::SessionSpec
31
+ describe Utopia::Session do
32
+ include Rack::Test::Methods
33
+
34
+ let(:app) {Rack::Builder.parse_file(File.expand_path('../session_spec.ru', __FILE__)).first}
35
+
36
+ it "shouldn't commit session values unless required" do
37
+ # This URL doesn't update the session:
38
+ get "/"
39
+ expect(last_response.header).to be == {}
40
+
41
+ # This URL updates the session:
42
+ get "/login"
43
+ expect(last_response.header).to_not be == {}
44
+ expect(last_response.header).to be_include 'Set-Cookie'
45
+ end
46
+
47
+ it "should set and get values correctly" do
48
+ get "/session-set?key=foo&value=bar"
49
+ expect(last_response.header).to be_include 'Set-Cookie'
50
+
51
+ get "/session-get?key=foo"
52
+ expect(last_response.body).to be == "bar"
53
+ end
54
+ end
55
+
56
+ describe Utopia::Session::LazyHash do
57
+ it "should load hash when required" do
58
+ loaded = false
59
+
60
+ hash = Utopia::Session::LazyHash.new do
61
+ loaded = true
62
+ {a: 10, b: 20}
63
+ end
64
+
65
+ expect(loaded).to be false
66
+
67
+ expect(hash[:a]).to be 10
68
+
69
+ expect(loaded).to be true
70
+ end
71
+
72
+ it "should delete the specified item" do
73
+ hash = Utopia::Session::LazyHash.new do
74
+ {a: 10, b: 20}
75
+ end
76
+
77
+ expect(hash.include?(:a)).to be true
78
+ expect(hash.delete(:a)).to be 10
79
+ expect(hash.include?(:a)).to be false
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,20 @@
1
+
2
+ use Utopia::Session::EncryptedCookie, secret: "97111cabf4c1a5e85b8029cf7c61aa44424fc24a"
3
+
4
+ run lambda { |env|
5
+ request = Rack::Request.new(env)
6
+
7
+ if env['PATH_INFO'] =~ /login/
8
+ env['rack.session']['login'] = 'true'
9
+
10
+ [200, {}, []]
11
+ elsif env['PATH_INFO'] =~ /session-set/
12
+ env['rack.session'][request[:key]] = request[:value]
13
+
14
+ [200, {}, []]
15
+ elsif env['PATH_INFO'] =~ /session-get/
16
+ [200, {}, [env['rack.session'][request[:key]]]]
17
+ else
18
+ [404, {}, []]
19
+ end
20
+ }