watts 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/Rakefile +1 -1
  2. data/lib/watts.rb +16 -6
  3. metadata +11 -4
data/Rakefile CHANGED
@@ -22,7 +22,7 @@ spec = Gem::Specification.new { |s|
22
22
  "Another Rack-based web framework. Yes, another one. Sorry, guys."
23
23
  s.homepage = "http://debu.gs/#{s.name}"
24
24
  %w(metaid).each &s.method(:add_dependency)
25
- s.version = '0.0.1'
25
+ s.version = '0.0.2'
26
26
  }
27
27
 
28
28
  Rake::RDocTask.new(:doc) { |t|
data/lib/watts.rb CHANGED
@@ -45,9 +45,9 @@ module Watts
45
45
  class App
46
46
  Errors = {
47
47
  400 =>
48
- [400, {'Content-Type' => 'text/plain'}, "400 Bad Request.\n"],
48
+ [400, {'Content-Type' => 'text/plain'}, ["400 Bad Request.\n"]],
49
49
  404 =>
50
- [404, {'Content-Type' => 'text/plain'}, "404 Not Found\n"],
50
+ [404, {'Content-Type' => 'text/plain'}, ["404 Not Found\n"]],
51
51
  }
52
52
 
53
53
  class << self
@@ -192,11 +192,18 @@ module Watts
192
192
  # TODO: Problems.
193
193
  case resp
194
194
  when nil
195
- [response.status, response.headers, response.body]
195
+ [response.status, response.headers, [response.body]]
196
196
  when Array
197
197
  resp
198
198
  else
199
- [200, {'Content-Type' => 'text/plain'}, resp.to_s]
199
+ resp = resp.to_s
200
+ [
201
+ 200,
202
+ {'Content-Type' => 'text/plain',
203
+ 'Content-Length' => resp.length,
204
+ },
205
+ [resp]
206
+ ]
200
207
  end
201
208
  }
202
209
  }
@@ -263,8 +270,11 @@ module Watts
263
270
  to_instance :view_class, :view_method
264
271
 
265
272
  def get *args
266
- [200, {'Content-Type' => 'text/html'},
267
- view_class.new.send(view_method, *args)]
273
+ body = view_class.new.send(view_method, *args)
274
+ [200,
275
+ {'Content-Type' => 'text/html',
276
+ 'Content-Length' => body.length.to_s},
277
+ [body]]
268
278
  end
269
279
  end
270
280
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watts
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 27
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 0
8
- - 1
9
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - Pete Elmore
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-06-01 00:00:00 -07:00
18
+ date: 2010-06-02 00:00:00 -07:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: metaid
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 3
27
30
  segments:
28
31
  - 0
29
32
  version: "0"
@@ -59,23 +62,27 @@ rdoc_options: []
59
62
  require_paths:
60
63
  - lib
61
64
  required_ruby_version: !ruby/object:Gem::Requirement
65
+ none: false
62
66
  requirements:
63
67
  - - ">="
64
68
  - !ruby/object:Gem::Version
69
+ hash: 3
65
70
  segments:
66
71
  - 0
67
72
  version: "0"
68
73
  required_rubygems_version: !ruby/object:Gem::Requirement
74
+ none: false
69
75
  requirements:
70
76
  - - ">="
71
77
  - !ruby/object:Gem::Version
78
+ hash: 3
72
79
  segments:
73
80
  - 0
74
81
  version: "0"
75
82
  requirements: []
76
83
 
77
84
  rubyforge_project:
78
- rubygems_version: 1.3.6
85
+ rubygems_version: 1.3.7
79
86
  signing_key:
80
87
  specification_version: 3
81
88
  summary: Another Rack-based web framework. Yes, another one. Sorry, guys.