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
Initial version of the method-based dispatch.
dyoder (author)
Sat Aug 30 21:15:35 -0700 2008
commit  24fbf10c169d2a341328efcc8617afac5319cc6a
tree    56223ff3e3315d8b7706dd1c375847963b1b2d8d
parent  a37e5cab061895c49149f39137df214e665d5ec6
...
10
11
12
13
 
14
15
16
17
18
19
20
21
22
23
24
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
27
28
...
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
38
39
0
@@ -10,19 +10,30 @@ module Waves
0
       
0
       def self.included( target )
0
         parent = target.superclass
0
- base = parent.respond_to?( :paths ) ? parent.paths : Waves::Mapping::Paths
0
+ base = parent.respond_to?( :paths ) ? parent.paths : Waves::Resources::Paths
0
         target.module_eval do
0
           const_set( :Paths, Class.new( base ) )
0
           def self.paths ; @object ||= self::Paths.new( self ) ; end
0
           def self.singular ; basename.downcase ; end
0
           def self.plural ; basename.downcase.plural ; end
0
-
0
- #def self.define_action(name, &block)
0
- # define_method( name, &block )
0
- #end
0
         end
0
       end
0
       
0
+ include Functor::Method
0
+
0
+ def self.on( method, path, options = {}, &block )
0
+ options[ :path ] = ( path.is_a? Hash and path.values.first ) or path
0
+ functor( method, Matchers::ContentType.new( options[ :content_type ] ), Matchers::Accepts.new( options ),
0
+ Matchers::URI.new( options ), Matchers::Query.new( options[:query] ), &block )
0
+ self::Paths.define_path( path.keys.first, options[ :path ] ) if path.is_a? Hash
0
+ end
0
+
0
+ def self.before( method = true, &block ); functors[ method ].before( &block ); end
0
+ def self.after( method = true, &block ); functors[ method ].after( &block ); end
0
+ def self.wrap( method = true, &block ); functors[ method ].wrap( &block ); end
0
+ def self.handler( exception, &block ) ; functor( :handler, exception, &block ) ; end
0
+ def self.always( &block ) ; define_method( :always, &block ) ; end
0
+
0
       # Resources are initialized with a Waves::Request
0
       def initialize(request); @request = request ; end
0
       def singular ; self.class.singular ; end
...
25
26
27
28
 
 
29
30
31
...
25
26
27
 
28
29
30
31
32
0
@@ -25,7 +25,8 @@ module Waves
0
 
0
       # Returns the object being used for output by the logger.
0
       def output
0
- @output ||= ( config[:output] ? File.expand_path( config[:output] ) : $stderr )
0
+ @output ||= ( config[:output] ? ( config[:output].kind_of? String and
0
+ File.expand_path( config[:output] ) or config[:output] ) : $stderr )
0
       end
0
       
0
       # Returns the active configuration for the logger.
...
66
67
68
 
69
70
71
...
66
67
68
69
70
71
72
0
@@ -66,6 +66,7 @@ module Waves
0
 
0
     def destructure( hash )
0
       destructured = {}
0
+ debugger
0
       hash.keys.map { |key| key.split('.') }.each do |keys|
0
         destructure_with_array_keys(hash, '', keys, destructured)
0
       end
...
17
18
19
20
 
21
22
23
...
31
32
33
34
35
36
37
38
39
40
41
42
43
 
 
 
 
 
 
 
 
 
 
 
 
44
45
46
...
57
58
59
60
61
62
63
64
65
66
 
 
 
 
 
 
67
68
 
69
70
71
...
17
18
19
 
20
21
22
23
...
31
32
33
 
 
 
 
 
 
 
 
 
 
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
...
59
60
61
 
 
 
 
 
 
 
62
63
64
65
66
67
68
 
69
70
71
72
0
@@ -17,7 +17,7 @@ require 'mongrel'
0
 
0
 # a bunch of handy stuff
0
 require 'extensions/io'
0
-require 'extensions/symbol'
0
+require 'extensions/symbol' unless Symbol.instance_methods.include? 'to_proc'
0
 require 'fileutils'
0
 require 'metaid'
0
 require 'forwardable'
0
@@ -31,16 +31,18 @@ require 'filebase'
0
 require 'filebase/model'
0
 
0
 # selected project-specific extensions
0
-require 'utilities/module'
0
-require 'utilities/string'
0
-require 'utilities/symbol'
0
-require 'utilities/object'
0
-require 'utilities/integer'
0
-require 'utilities/inflect'
0
-require 'utilities/proc'
0
-require 'utilities/hash'
0
-require 'utilities/tempfile'
0
-require 'utilities/kernel'
0
+require 'ext/module'
0
+require 'ext/string'
0
+require 'ext/symbol'
0
+require 'ext/object'
0
+require 'ext/integer'
0
+require 'ext/inflect'
0
+require 'ext/proc'
0
+require 'ext/hash'
0
+require 'ext/tempfile'
0
+require 'ext/kernel'
0
+require 'ext/functor'
0
+
0
 # waves Runtime
0
 require 'dispatchers/base'
0
 require 'dispatchers/default'
0
@@ -57,15 +59,14 @@ require 'runtime/blackboard'
0
 require 'runtime/configuration'
0
 
0
 # waves URI mapping
0
-require 'mapping/mapping'
0
-require 'mapping/action'
0
-require 'mapping/handler'
0
-require 'mapping/pattern'
0
-require 'mapping/constraints'
0
-require 'mapping/descriptors'
0
-require 'mapping/paths'
0
+require 'matchers/base'
0
+require 'matchers/accepts'
0
+require 'matchers/content_type'
0
+require 'matchers/path'
0
+require 'matchers/query'
0
+require 'matchers/uri'
0
 require 'resources/mixin'
0
-require 'resources/proxy'
0
+require 'resources/path'
0
 
0
 # waves mvc support
0
 require 'controllers/mixin'

Comments

    No one has commented yet.