waves 0.6.7 → 0.6.9
Sign up to get free protection for your applications and to get access to all the features.
- data/app/Rakefile +1 -1
- data/app/configurations/default.rb.erb +1 -1
- data/app/configurations/mapping.rb.erb +6 -37
- data/app/controllers/default.rb.erb +10 -20
- data/app/lib/tasks/cluster.rb +8 -10
- data/app/lib/tasks/generate.rb +15 -0
- data/app/lib/tasks/schema.rb +6 -5
- data/app/schema/{migration → migrations}/templates/empty.rb.erb +0 -0
- data/app/templates/errors/{not_found.mab → not_found_404.mab} +0 -0
- data/app/templates/errors/{server_error.mab → server_error_500.mab} +0 -0
- data/app/templates/layouts/default.mab +1 -1
- data/bin/waves +1 -1
- data/bin/waves-console +21 -4
- data/lib/controllers/mixin.rb +85 -16
- data/lib/dispatchers/base.rb +26 -15
- data/lib/dispatchers/default.rb +25 -4
- data/lib/helpers/common.rb +50 -10
- data/lib/helpers/form.rb +18 -1
- data/lib/helpers/formatting.rb +17 -9
- data/lib/helpers/model.rb +20 -2
- data/lib/helpers/view.rb +12 -2
- data/lib/mapping/mapping.rb +187 -0
- data/lib/mapping/pretty_urls.rb +95 -0
- data/lib/renderers/erubis.rb +3 -1
- data/lib/renderers/markaby.rb +6 -4
- data/lib/renderers/mixin.rb +12 -0
- data/lib/runtime/application.rb +33 -23
- data/lib/runtime/configuration.rb +131 -9
- data/lib/runtime/console.rb +2 -2
- data/lib/runtime/logger.rb +42 -18
- data/lib/runtime/mime_types.rb +8 -4
- data/lib/runtime/request.rb +14 -5
- data/lib/runtime/response.rb +15 -1
- data/lib/runtime/response_mixin.rb +29 -47
- data/lib/runtime/server.rb +60 -35
- data/lib/runtime/session.rb +14 -1
- data/lib/utilities/integer.rb +7 -1
- data/lib/utilities/kernel.rb +28 -2
- data/lib/utilities/module.rb +3 -0
- data/lib/utilities/object.rb +5 -1
- data/lib/utilities/string.rb +7 -2
- data/lib/utilities/symbol.rb +2 -0
- data/lib/views/mixin.rb +55 -1
- data/lib/waves.rb +9 -2
- metadata +10 -8
- data/lib/runtime/mapping.rb +0 -82
data/lib/waves.rb
CHANGED
@@ -39,7 +39,10 @@ require 'runtime/response_mixin'
|
|
39
39
|
require 'runtime/response_proxy'
|
40
40
|
require 'runtime/session'
|
41
41
|
require 'runtime/configuration'
|
42
|
-
|
42
|
+
|
43
|
+
# waves URI mapping
|
44
|
+
require 'mapping/mapping'
|
45
|
+
require 'mapping/pretty_urls'
|
43
46
|
|
44
47
|
# waves mvc support
|
45
48
|
require 'controllers/mixin'
|
@@ -47,4 +50,8 @@ require 'views/mixin'
|
|
47
50
|
require 'renderers/mixin'
|
48
51
|
require 'renderers/markaby'
|
49
52
|
require 'renderers/erubis'
|
50
|
-
|
53
|
+
require 'helpers/common.rb'
|
54
|
+
require 'helpers/form.rb'
|
55
|
+
require 'helpers/formatting.rb'
|
56
|
+
require 'helpers/model.rb'
|
57
|
+
require 'helpers/view.rb'
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: waves
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.6.
|
7
|
-
date: 2008-01-
|
6
|
+
version: 0.6.9
|
7
|
+
date: 2008-01-31 00:00:00 -08:00
|
8
8
|
summary: Open-source framework for building Ruby-based Web applications.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -37,6 +37,8 @@ files:
|
|
37
37
|
- lib/helpers/formatting.rb
|
38
38
|
- lib/helpers/model.rb
|
39
39
|
- lib/helpers/view.rb
|
40
|
+
- lib/mapping/mapping.rb
|
41
|
+
- lib/mapping/pretty_urls.rb
|
40
42
|
- lib/renderers/erubis.rb
|
41
43
|
- lib/renderers/markaby.rb
|
42
44
|
- lib/renderers/mixin.rb
|
@@ -44,7 +46,6 @@ files:
|
|
44
46
|
- lib/runtime/configuration.rb
|
45
47
|
- lib/runtime/console.rb
|
46
48
|
- lib/runtime/logger.rb
|
47
|
-
- lib/runtime/mapping.rb
|
48
49
|
- lib/runtime/mime_types.rb
|
49
50
|
- lib/runtime/request.rb
|
50
51
|
- lib/runtime/response.rb
|
@@ -76,6 +77,7 @@ files:
|
|
76
77
|
- app/lib/startup.rb.erb
|
77
78
|
- app/lib/tasks
|
78
79
|
- app/lib/tasks/cluster.rb
|
80
|
+
- app/lib/tasks/generate.rb
|
79
81
|
- app/lib/tasks/schema.rb
|
80
82
|
- app/log
|
81
83
|
- app/models
|
@@ -87,13 +89,13 @@ files:
|
|
87
89
|
- app/public/javascript
|
88
90
|
- app/Rakefile
|
89
91
|
- app/schema
|
90
|
-
- app/schema/
|
91
|
-
- app/schema/
|
92
|
-
- app/schema/
|
92
|
+
- app/schema/migrations
|
93
|
+
- app/schema/migrations/templates
|
94
|
+
- app/schema/migrations/templates/empty.rb.erb
|
93
95
|
- app/templates
|
94
96
|
- app/templates/errors
|
95
|
-
- app/templates/errors/
|
96
|
-
- app/templates/errors/
|
97
|
+
- app/templates/errors/not_found_404.mab
|
98
|
+
- app/templates/errors/server_error_500.mab
|
97
99
|
- app/templates/layouts
|
98
100
|
- app/templates/layouts/default.mab
|
99
101
|
- app/tmp
|
data/lib/runtime/mapping.rb
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
module Waves
|
2
|
-
|
3
|
-
module Mapping
|
4
|
-
|
5
|
-
def before( pattern, options=nil, &block )
|
6
|
-
filters[:before] << [ pattern, options, block ]
|
7
|
-
end
|
8
|
-
|
9
|
-
def after( pattern, options=nil, &block )
|
10
|
-
filters[:after] << [ pattern, options, block ]
|
11
|
-
end
|
12
|
-
|
13
|
-
def wrap( pattern, options=nil, &block )
|
14
|
-
filters[:before] << [ pattern, options, block ]
|
15
|
-
filters[:after] << [ pattern, options, block ]
|
16
|
-
end
|
17
|
-
|
18
|
-
def map( options, &block )
|
19
|
-
pattern = options[:path] || options[:url]
|
20
|
-
mapping << [ pattern, options, block ]
|
21
|
-
end
|
22
|
-
|
23
|
-
def path( pat, options = {}, &block )
|
24
|
-
options[:path] = pat; map( options, &block )
|
25
|
-
end
|
26
|
-
|
27
|
-
def url( pat, options = {}, &block )
|
28
|
-
options[:url] = pat; map( options, block )
|
29
|
-
end
|
30
|
-
|
31
|
-
def []( request )
|
32
|
-
|
33
|
-
rx = { :before => [], :after => [], :action => nil }
|
34
|
-
|
35
|
-
( filters[:before] + filters[:wrap] ).each do | pattern, options, function |
|
36
|
-
matches = pattern.match(request.path)
|
37
|
-
rx[:before] << [ function, matches[1..-1] ] if matches &&
|
38
|
-
( ! options || satisfy( request, options ))
|
39
|
-
end
|
40
|
-
|
41
|
-
mapping.find do |pattern, options, function|
|
42
|
-
matches = pattern.match(request.path)
|
43
|
-
rx[:action] = [ function, matches[1..-1] ] if matches &&
|
44
|
-
( ! options || satisfy( request, options ) )
|
45
|
-
end
|
46
|
-
|
47
|
-
( filters[:after] + filters[:wrap] ).each do | pattern, options, function |
|
48
|
-
matches = pattern.match(request.path)
|
49
|
-
rx[:after] << [ function, matches[1..-1] ] if matches &&
|
50
|
-
( ! options || satisfy( request, options ))
|
51
|
-
end
|
52
|
-
|
53
|
-
not_found(request) unless rx[:action]
|
54
|
-
|
55
|
-
return rx
|
56
|
-
|
57
|
-
end
|
58
|
-
|
59
|
-
private
|
60
|
-
|
61
|
-
def mapping; @mapping ||= []; end
|
62
|
-
|
63
|
-
def filters; @filters ||= { :before => [], :after => [], :wrap => [] }; end
|
64
|
-
|
65
|
-
def not_found(request)
|
66
|
-
raise Waves::Dispatchers::NotFoundError.new( request.url + ' not found.')
|
67
|
-
end
|
68
|
-
|
69
|
-
def satisfy( request, options )
|
70
|
-
options.each do |method, param|
|
71
|
-
return false unless self.send( method, param, request )
|
72
|
-
end
|
73
|
-
return true
|
74
|
-
end
|
75
|
-
|
76
|
-
def method( method, request )
|
77
|
-
request.method == method
|
78
|
-
end
|
79
|
-
|
80
|
-
end
|
81
|
-
|
82
|
-
end
|