otto 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +5 -0
- data/VERSION.yml +1 -1
- data/example/app.rb +11 -10
- data/lib/otto.rb +2 -3
- metadata +6 -6
data/CHANGES.txt
CHANGED
data/VERSION.yml
CHANGED
data/example/app.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
|
2
2
|
|
3
3
|
class App
|
4
|
-
|
4
|
+
|
5
5
|
# An instance of Rack::Request
|
6
6
|
attr_reader :req
|
7
7
|
# An instance of Rack::Response
|
8
8
|
attr_reader :res
|
9
|
-
|
9
|
+
|
10
10
|
# Otto creates an instance of this class for every request
|
11
11
|
# and passess the Rack::Request and Rack::Response objects.
|
12
12
|
def initialize req, res
|
13
13
|
@req, @res = req, res
|
14
14
|
res.header['Content-Type'] = "text/html; charset=utf-8"
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
def index
|
18
18
|
lines = [
|
19
19
|
'<img src="/img/otto.jpg" /><br/><br/>',
|
@@ -21,29 +21,30 @@ class App
|
|
21
21
|
'<form method="post"><input name="msg" /><input type="submit" /></form>',
|
22
22
|
'<a href="/product/100">A product example</a>'
|
23
23
|
]
|
24
|
+
res.send_cookie :sess, 1234567, 3600
|
24
25
|
res.body = lines.join($/)
|
25
26
|
end
|
26
|
-
|
27
|
+
|
27
28
|
def receive_feedback
|
28
29
|
res.body = req.params.inspect
|
29
30
|
end
|
30
|
-
|
31
|
+
|
31
32
|
def redirect
|
32
33
|
res.redirect '/robots.txt'
|
33
34
|
end
|
34
|
-
|
35
|
+
|
35
36
|
def robots_text
|
36
37
|
res.header['Content-Type'] = "text/plain"
|
37
38
|
rules = 'User-agent: *', 'Disallow: /private'
|
38
39
|
res.body = rules.join($/)
|
39
40
|
end
|
40
|
-
|
41
|
+
|
41
42
|
def display_product
|
42
43
|
res.header['Content-Type'] = "application/json; charset=utf-8"
|
43
44
|
prodid = req.params[:prodid]
|
44
45
|
res.body = '{"product":%s,"msg":"Hint: try another value"}' % [prodid]
|
45
46
|
end
|
46
|
-
|
47
|
+
|
47
48
|
def not_found
|
48
49
|
res.status = 404
|
49
50
|
res.body = "Item not found!"
|
@@ -53,5 +54,5 @@ class App
|
|
53
54
|
res.status = 500
|
54
55
|
res.body = "There was a server error!"
|
55
56
|
end
|
56
|
-
|
57
|
-
end
|
57
|
+
|
58
|
+
end
|
data/lib/otto.rb
CHANGED
@@ -393,11 +393,10 @@ class Otto
|
|
393
393
|
opts = {
|
394
394
|
:value => value,
|
395
395
|
:path => '/',
|
396
|
-
:expires => (Time.now + ttl + 10)
|
396
|
+
:expires => (Time.now.utc + ttl + 10),
|
397
397
|
:secure => secure
|
398
398
|
}
|
399
|
-
opts[:domain] = request.env['SERVER_NAME']
|
400
|
-
#pp [:cookie, name, opts]
|
399
|
+
#opts[:domain] = request.env['SERVER_NAME']
|
401
400
|
set_cookie name, opts
|
402
401
|
end
|
403
402
|
def delete_cookie name
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: otto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
16
|
-
requirement: &
|
16
|
+
requirement: &70115756593820 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.2.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70115756593820
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: addressable
|
27
|
-
requirement: &
|
27
|
+
requirement: &70115756593340 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: 2.2.6
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70115756593340
|
36
36
|
description: Auto-define your rack-apps in plaintext.
|
37
37
|
email: delano@solutious.com
|
38
38
|
executables: []
|