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
Pulled out everything from core, got rid of simple layer, renamed default 
to classic.
dyoder (author)
Fri Sep 26 21:57:10 -0700 2008
commit  7ee7988662aa6f3b1b901f4f6898780e7fdada0e
tree    4ff81ea5845dae3b108510db4e55011d5e2a71f0
parent  0c8a399ad739f7125dedfe79d903360810ad8cc7
...
14
15
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
18
19
...
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
0
@@ -14,6 +14,48 @@ module Waves
0
             include Waves::Layers::Inflect::English::StringMethods
0
           end
0
           
0
+ Waves::Resources::Mixin.class_eval do
0
+ def singular ; self.class.singular ; end
0
+ def plural ; self.class.plural ; end
0
+ end
0
+
0
+ Waves::Resources::Paths.class_eval do
0
+ def resource ; self.class.resource.singular ; end
0
+ def resources ; self.class.resource.plural ; end
0
+
0
+ # TODO: be nice to DRY this up ... basically the same code
0
+ # as the mixin except with the singular / plural stuff
0
+ # mixed in ...
0
+ def generate( template, args )
0
+ return "/#{ args * '/' }" unless template.is_a?( Array ) and not template.empty?
0
+ path = []
0
+ ( "/#{ path * '/' }" ) if template.all? do | want |
0
+ case want
0
+ when true then path += args
0
+ when String then path << want
0
+ when Symbol
0
+ case want
0
+ when :resource then path << resource
0
+ when :resources then path << resources
0
+ else path << args.shift
0
+ end
0
+ when Regexp then path << args.shift
0
+ when Hash
0
+ key, value = want.to_a.first
0
+ case key
0
+ when :resource then path << resource
0
+ when :resources then path << resources
0
+ else
0
+ case value
0
+ when true then path += args
0
+ when String, Symbol, RegExp then path << args.unshift
0
+ end
0
+ end
0
+ end
0
+ end
0
+ end
0
+ end
0
+
0
         end
0
         
0
       end
...
22
23
24
25
 
 
26
27
28
...
22
23
24
 
25
26
27
28
29
0
@@ -22,7 +22,8 @@ module Waves
0
       end
0
       
0
       class Scope
0
- include Waves::Helpers::Common
0
+ include Waves::Helpers::DocType
0
+ include Waves::Helpers::Layouts
0
         include Waves::Helpers::Model
0
         include Waves::Helpers::View
0
 
...
24
25
26
27
28
29
30
31
...
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
...
24
25
26
 
 
27
28
29
...
68
69
70
 
 
 
 
 
71
72
73
74
75
 
 
76
77
78
0
@@ -24,8 +24,6 @@ module Waves
0
               @paths
0
             end
0
           end
0
- def self.singular ; basename.downcase ; end
0
- def self.plural ; basename.downcase.plural ; end
0
           def self.with( options ) ; @options = options ; yield ; @options = nil ; end
0
           def self.on( method, path = true, options = nil, &block )
0
             if path.is_a? Hash
0
@@ -70,18 +68,11 @@ module Waves
0
             on( method ) { not_found }
0
           end
0
           
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
-
0
         end
0
       end
0
       
0
       # Resources are initialized with a Waves::Request
0
       def initialize( request ); @request = request ; end
0
- def singular ; self.class.singular ; end
0
- def plural ; self.class.plural ; end
0
       def to( resource )
0
         resource = case resource
0
         when Base
...
10
11
12
13
14
15
16
17
18
19
20
...
22
23
24
25
26
27
28
29
30
 
31
32
33
...
10
11
12
 
 
 
 
 
13
14
15
...
17
18
19
 
 
 
 
 
 
20
21
22
23
0
@@ -10,11 +10,6 @@ module Waves
0
       
0
       def initialize( request ) ; @request = request ; end
0
       
0
- # TODO: this is an anonymous class ... need to get the resource name
0
- # from the creation step for the class ...
0
- def resource ; self.class.resource.singular ; end
0
- def resources ; self.class.resource.plural ; end
0
-
0
       def generate( template, args )
0
         return "/#{ args * '/' }" unless template.is_a?( Array ) and not template.empty?
0
         path = []
0
@@ -22,12 +17,7 @@ module Waves
0
           case want
0
           when true then path += args
0
           when String then path << want
0
- when Symbol
0
- case want
0
- when :resource then path << resource
0
- when :resources then path << resources
0
- else path << args.shift
0
- end
0
+ when Symbol then path << args.shift
0
           when Regexp then path << args.shift
0
           when Hash
0
             key, value = want.to_a.first
...
7
8
9
10
 
11
12
13
14
15
16
...
47
48
49
50
51
 
52
53
54
...
60
61
62
63
 
64
65
66
...
7
8
9
 
10
11
 
 
12
13
14
...
45
46
47
 
48
49
50
51
52
...
58
59
60
 
61
62
63
64
0
@@ -7,10 +7,8 @@ module Waves
0
     def []( name ) ; self.find { |app| app.name == name.to_s.camel_case } ; end
0
   end
0
   
0
- def self.config; Waves.main::Configurations[ mode ]; end
0
+ def self.config; instance.config ; end
0
   
0
- def self.mode; instance.mode ; end
0
-
0
   # The list of all loaded applications
0
   def self.applications ; @applications ||= Applications.new ; end
0
 
0
@@ -47,8 +45,8 @@ module Waves
0
     def initialize( options={} )
0
       @options = options
0
       Dir.chdir options[:directory] if options[:directory]
0
- Runtime.instance = self
0
       Kernel.load( options[:startup] || 'startup.rb' )
0
+ Runtime.instance = self
0
     end
0
 
0
     def synchronize( &block ) ; Waves.synchronize( &block ) ; end
0
@@ -60,7 +58,7 @@ module Waves
0
     def debug? ; config.debug ; end
0
 
0
     # Returns the current configuration.
0
- def config ; Waves.config ; end
0
+ def config ; Waves.main::Configurations[ mode ] ; end
0
 
0
     # Reload the modules specified in the current configuration.
0
     def reload ; config.reloadable.each { |mod| mod.reload } ; end
...
 
1
2
3
4
5
 
6
7
8
...
1
2
3
4
5
 
6
7
8
9
0
@@ -1,8 +1,9 @@
0
+require 'helpers/doc_type'
0
 module Waves
0
   module Views
0
     class Errors < Waves::Views::Base
0
       
0
- include Waves::Helpers::BuiltIn
0
+ include Waves::Helpers::DocType
0
       
0
       def header( title )
0
         <<-HTML
...
18
19
20
21
22
23
24
...
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
 
94
...
18
19
20
 
21
22
23
...
64
65
66
 
 
 
 
 
 
 
 
 
 
 
 
 
67
68
 
 
 
 
 
 
 
 
 
 
 
69
70
0
@@ -18,7 +18,6 @@ require 'date'
0
 require 'benchmark'
0
 require 'base64'
0
 
0
-require 'autocode'
0
 gem 'dyoder-functor', '>= 0.5.0'
0
 require 'functor'
0
 gem 'dyoder-filebase', '>= 0.3.4'
0
@@ -65,29 +64,6 @@ require 'matchers/resource'
0
 require 'resources/paths'
0
 require 'resources/mixin'
0
 
0
-
0
-# TODO: if these are truly layers, they should not be included here
0
-# this includes the MVC support, the helpers, and the renderers
0
-# ... the inflector stuff should probably be in core, since the resources
0
-# actually depends on it ... otherwise the singular / plural stuff
0
-# should be removed and made a part of the inflector layer
0
-
0
-require 'helpers/common'
0
-require 'helpers/form'
0
-require 'helpers/formatting'
0
-require 'helpers/model'
0
-require 'helpers/view'
0
-require 'helpers/built_in'
0
 require 'views/mixin'
0
 require 'views/errors'
0
-
0
-require 'renderers/mixin'
0
-
0
-require 'foundations/default'
0
-require 'foundations/simple'
0
-
0
-require 'layers/inflect/english'
0
-require 'layers/renderers/markaby'
0
-require 'layers/renderers/erubis'
0
-require 'layers/renderers/haml'
0
-
0
+require 'renderers/mixin'
0
\ No newline at end of file

Comments

    No one has commented yet.