GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Rubygem
Description: Resource-oriented open source Ruby framework for Web apps.
Homepage: http://rubywaves.com/
Clone URL: git://github.com/dyoder/waves.git
fixed problem with overriding host / port in the handler
dyoder (author)
Mon Sep 29 15:34:44 -0700 2008
commit  d94cbdcac9e1b0335045e7cbb5c48823e26a32e9
tree    a9c7cbbd14c45ca42ab641c35fe797ae2b8e5f08
parent  0d5b9edbf2d8380409dee7d8b644361159d79ee3
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
 
 
 
 
 
 
 
 
 
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
30
31
32
33
34
 
35
36
37
...
 
1
2
3
4
 
 
 
 
 
 
 
 
 
5
6
7
8
9
10
11
12
13
14
 
 
 
 
 
 
 
 
 
 
 
 
 
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 
 
 
 
 
34
35
36
37
0
@@ -1,37 +1,37 @@
0
-require 'autocode'
0
 module Waves
0
   module Foundations
0
     module Compact
0
       def self.included( app )
0
- app.const_set( :Resources, Module.new {
0
- include AutoCode
0
- auto_load true
0
- const_set( :Map, Class.new {
0
- include Waves::Resources::Mixin
0
- handler( Waves::Dispatchers::NotFoundError ) do
0
- response.status = 404; response.content_type = 'text/html'
0
- Waves::Views::Errors.process( request ) { not_found_404 }
0
- end
0
+ app.module_eval {
0
+ const_set( :Resources, Module.new {
0
+ const_set( :Map, Class.new {
0
+ include Waves::Resources::Mixin
0
+ handler( Waves::Dispatchers::NotFoundError ) {
0
+ response.status = 404; response.content_type = 'text/html'
0
+ Waves::Views::Errors.process( request ) { not_found_404 }
0
+ }
0
+ })
0
           })
0
- })
0
- app.const_set( :Configurations, Module.new {
0
- const_set( :Development, Class.new( Waves::Configurations::Default ) {
0
- reloadable [ app::Resources ]
0
- log :level => :debug
0
- host '127.0.0.1'
0
- port 3000
0
- handler ::Rack::Handler::Mongrel, :Host => host, :Port => port
0
- application do
0
- use ::Rack::ShowExceptions
0
- run ::Waves::Dispatchers::Default.new
0
- end
0
- resource app::Resources::Map
0
+ const_set( :Configurations, Module.new {
0
+ const_set( :Development, Class.new( Waves::Configurations::Default ) {
0
+ log :level => :debug
0
+ host '127.0.0.1'
0
+ port 3000
0
+ handler ::Rack::Handler::Mongrel
0
+ application {
0
+ use ::Rack::ShowExceptions
0
+ run ::Waves::Dispatchers::Default.new
0
+ }
0
+ resource app::Resources::Map
0
+ })
0
+ const_set( :Production, Class.new( self::Development ) {
0
+ log :level => :error, :output => ( "log.#{$$}" ), :rotation => :weekly
0
+ port 80
0
+ host '0.0.0.0'
0
+ handler ::Rack::Handler::Mongrel
0
+ })
0
           })
0
- const_set( :Production, Class.new( self::Development ) {
0
- log :level => :error, :output => ( "log.#{$$}" ), :rotation => :weekly
0
- port '0.0.0.0'
0
- })
0
- })
0
+ }
0
         Waves << app
0
       end
0
     end
...
11
12
13
14
 
15
16
17
...
11
12
13
 
14
15
16
17
0
@@ -11,7 +11,7 @@ module Waves
0
           include ResponseMixin, Functor::Method
0
           extend ClassMethods
0
           before {} ; after {} ; always {}
0
- %w( post get put delete ).each do | method |
0
+ %w( post get put delete head ).each do | method |
0
             on( method ) { not_found }
0
           end
0
         end
...
143
144
145
146
 
147
148
149
150
151
152
153
 
154
155
 
156
157
158
...
172
173
174
175
176
177
178
...
143
144
145
 
146
147
148
149
150
151
152
 
153
154
 
155
156
157
158
...
172
173
174
 
175
176
177
0
@@ -143,16 +143,16 @@ module Waves
0
     class Default < Base
0
 
0
       %w( host port ports log reloadable resource database session pid
0
- debug root synchronize? dependencies cache ).each { |name| attribute(name) }
0
+ debug root dependencies cache ).each { |name| attribute(name) }
0
 
0
       # Set the Rack handler, along with any specific options
0
       # that need to be passed to the handler's #run method.
0
       #
0
       # When accessing the value
0
       # (calling with no arguments), returns an array of the handler and options.
0
- def self.handler(*args)
0
+ def self.handler( *args )
0
         return self['handler'] if args.empty?
0
- self['handler'] = args
0
+ self['handler'] = args.first
0
       end
0
 
0
       # Provides access to the Waves::MimeTypes class via the configuration. You
0
@@ -172,7 +172,6 @@ module Waves
0
       end
0
       
0
       debug true
0
- synchronize? true
0
       session :duration => 30.minutes, :path => '/tmp/sessions'
0
       log :level => :info, :output => $stderr
0
       reloadable []
...
49
50
51
52
53
 
54
55
56
...
49
50
51
 
 
52
53
54
55
0
@@ -49,8 +49,7 @@ module Waves
0
       start_debugger if options[:debugger]
0
       log.info "Waves Runtime #{Waves.version}"
0
       log.info "Waves starting on #{host}:#{port}"
0
- handler, options = config.handler
0
- handler.run( config.application.to_app, options ) do |server|
0
+ config.handler.run( config.application.to_app, { :Host => host, :Port => port } ) do |server|
0
         @server = server
0
         self.trap('INT') { puts; stop } if @server.respond_to? :stop
0
       end

Comments

    No one has commented yet.