otto 0.3.1 → 0.3.2

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.
Files changed (5) hide show
  1. data/CHANGES.txt +5 -0
  2. data/VERSION.yml +1 -1
  3. data/example/app.rb +11 -10
  4. data/lib/otto.rb +2 -3
  5. metadata +6 -6
@@ -1,5 +1,10 @@
1
1
  OTTO, CHANGES
2
2
 
3
+ #### 0.3.2 (2013-01-27) ###############################
4
+
5
+ * CHANGE: send_cookie doesn't set domain
6
+
7
+
3
8
  #### 0.3.1 (2012-12-17) ###############################
4
9
 
5
10
  * ADDED: Otto.debug (set w/ Otto.debug= or env variable OTTO_DEBUG)
@@ -1,3 +1,3 @@
1
1
  :MAJOR: 0
2
2
  :MINOR: 3
3
- :PATCH: 1
3
+ :PATCH: 2
@@ -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
@@ -393,11 +393,10 @@ class Otto
393
393
  opts = {
394
394
  :value => value,
395
395
  :path => '/',
396
- :expires => (Time.now + ttl + 10).utc,
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.1
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: 2012-12-17 00:00:00.000000000 Z
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: &70311787119140 !ruby/object:Gem::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: *70311787119140
24
+ version_requirements: *70115756593820
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: addressable
27
- requirement: &70311787118660 !ruby/object:Gem::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: *70311787118660
35
+ version_requirements: *70115756593340
36
36
  description: Auto-define your rack-apps in plaintext.
37
37
  email: delano@solutious.com
38
38
  executables: []