waves 0.6.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/app/Rakefile +4 -0
  2. data/app/configurations/default.rb.erb +8 -0
  3. data/app/configurations/development.rb.erb +22 -0
  4. data/app/configurations/mapping.rb.erb +49 -0
  5. data/app/configurations/production.rb.erb +25 -0
  6. data/app/controllers/default.rb.erb +39 -0
  7. data/app/doc/EMTPY +0 -0
  8. data/app/helpers/default.rb.erb +13 -0
  9. data/app/lib/application.rb.erb +52 -0
  10. data/app/lib/startup.rb.erb +2 -0
  11. data/app/lib/tasks/cluster.rb +26 -0
  12. data/app/lib/tasks/schema.rb +28 -0
  13. data/app/models/default.rb.erb +13 -0
  14. data/app/schema/migration/templates/empty.rb.erb +9 -0
  15. data/app/templates/errors/not_found.mab +2 -0
  16. data/app/templates/errors/server_error.mab +2 -0
  17. data/app/templates/layouts/default.mab +14 -0
  18. data/app/views/default.rb.erb +13 -0
  19. data/bin/waves +32 -0
  20. data/bin/waves-console +8 -0
  21. data/bin/waves-server +45 -0
  22. data/lib/controllers/mixin.rb +62 -0
  23. data/lib/dispatchers/base.rb +41 -0
  24. data/lib/dispatchers/default.rb +33 -0
  25. data/lib/helpers/common.rb +22 -0
  26. data/lib/helpers/form.rb +22 -0
  27. data/lib/helpers/formatting.rb +22 -0
  28. data/lib/helpers/model.rb +15 -0
  29. data/lib/helpers/view.rb +14 -0
  30. data/lib/renderers/erubis.rb +38 -0
  31. data/lib/renderers/markaby.rb +31 -0
  32. data/lib/renderers/mixin.rb +41 -0
  33. data/lib/runtime/application.rb +43 -0
  34. data/lib/runtime/configuration.rb +47 -0
  35. data/lib/runtime/console.rb +21 -0
  36. data/lib/runtime/logger.rb +28 -0
  37. data/lib/runtime/mapping.rb +82 -0
  38. data/lib/runtime/mime_types.rb +18 -0
  39. data/lib/runtime/request.rb +43 -0
  40. data/lib/runtime/response.rb +26 -0
  41. data/lib/runtime/response_mixin.rb +53 -0
  42. data/lib/runtime/response_proxy.rb +29 -0
  43. data/lib/runtime/server.rb +58 -0
  44. data/lib/runtime/session.rb +43 -0
  45. data/lib/utilities/integer.rb +8 -0
  46. data/lib/utilities/kernel.rb +8 -0
  47. data/lib/utilities/module.rb +7 -0
  48. data/lib/utilities/object.rb +13 -0
  49. data/lib/utilities/string.rb +36 -0
  50. data/lib/utilities/symbol.rb +5 -0
  51. data/lib/views/mixin.rb +54 -0
  52. data/lib/waves.rb +50 -0
  53. metadata +189 -0
@@ -0,0 +1,13 @@
1
+ class Object
2
+ # this code from mauricio fernandez via ruby-talk
3
+ def instance_exec(*args, &block)
4
+ mname = "__instance_exec_#{Thread.current.object_id.abs}"
5
+ class << self; self end.class_eval{ define_method(mname, &block) }
6
+ begin
7
+ ret = send(mname, *args)
8
+ ensure
9
+ class << self; self end.class_eval{ undef_method(mname) } rescue nil
10
+ end
11
+ ret
12
+ end
13
+ end
@@ -0,0 +1,36 @@
1
+ class String
2
+
3
+ # I unfortunately don't recall where i first saw this ... see
4
+ # Symbol extension as well, allowing for :files / 'afilename.txt'
5
+
6
+ def / ( string )
7
+ File.join(self,string.to_s)
8
+ end
9
+
10
+ # inspired by the inflector code in rails ...
11
+
12
+ def singular
13
+ gsub(/ies$/,'y').gsub(/es$/,'').gsub(/s$/,'')
14
+ end
15
+
16
+ def plural
17
+ gsub(/(s|sh|ch)$/,'\1es').gsub(/(i|y)$/,'ies').gsub(/([^s])$/,'\1s')
18
+ end
19
+
20
+ def camel_case
21
+ gsub(/(_)(\w)/) { $2.upcase }.gsub(/^([a-z])/) { $1.upcase }
22
+ end
23
+
24
+ def snake_case
25
+ gsub(/([a-z\d])([A-Z])/){ "#{$1}_#{$2}"}.tr("-", "_").downcase
26
+ end
27
+
28
+ def title_case
29
+ gsub(/(^|\s)\s*([a-z])/) { $1 + $2.upcase }
30
+ end
31
+
32
+ def text
33
+ gsub(/[\_\-\.\:]/,' ')
34
+ end
35
+
36
+ end
@@ -0,0 +1,5 @@
1
+ class Symbol
2
+ def / ( string )
3
+ self.to_s / string
4
+ end
5
+ end
@@ -0,0 +1,54 @@
1
+ module Waves
2
+
3
+ module Views
4
+
5
+ class NoTemplateError < Exception ; end
6
+
7
+ def Views.renderers
8
+ return [] if Renderers.constants.nil?
9
+ Renderers.constants.inject([]) do |rx,cname|
10
+ ( Module === (c=Renderers.const_get(cname)) &&
11
+ c < Renderers::Mixin ) ? ( rx << c ) : rx
12
+ end
13
+ end
14
+
15
+
16
+ module Mixin
17
+
18
+ attr_reader :request
19
+
20
+ include Waves::ResponseMixin
21
+
22
+ def self.included( c )
23
+ def c.process( request, *args, &block )
24
+ self.new( request ).instance_exec( *args, &block )
25
+ end
26
+ end
27
+
28
+ def initialize( request )
29
+ @request = request
30
+ @layout = :default
31
+ end
32
+
33
+ def renderer(path)
34
+ Views.renderers.find do |renderer|
35
+ File.exists?( renderer.filename( path ) )
36
+ end
37
+ end
38
+
39
+ def render( path, context = {} )
40
+ context.merge!( :request => request )
41
+ template = renderer( path ) || renderer( :generic / File.basename(path) )
42
+ raise NoTemplateError.new( path ) if template.nil?
43
+ template.render( path, context )
44
+ end
45
+
46
+ def method_missing(name,*args)
47
+ render( "/#{self.class.basename.snake_case}/#{name}", *args )
48
+ end
49
+
50
+ end
51
+
52
+ end
53
+
54
+ end
data/lib/waves.rb ADDED
@@ -0,0 +1,50 @@
1
+ # External Dependencies
2
+ require 'rubygems'
3
+
4
+ # the underlying web server
5
+ require 'mongrel'
6
+ require 'rack'
7
+ require 'live_console'
8
+ require 'autocode'
9
+
10
+ # a bunch of handy stuff
11
+ require 'extensions/all'
12
+ require 'fileutils'
13
+ require 'metaid'
14
+ require 'forwardable'
15
+ require 'date'
16
+ require 'benchmark'
17
+ # require 'memcache'
18
+ require 'base64'
19
+
20
+ # selected project-specific extensions
21
+ require 'utilities/module'
22
+ require 'utilities/string'
23
+ require 'utilities/symbol'
24
+ require 'utilities/kernel'
25
+ require 'utilities/object'
26
+ require 'utilities/integer'
27
+
28
+ # waves Runtime
29
+ require 'dispatchers/base'
30
+ require 'dispatchers/default'
31
+ require 'runtime/logger'
32
+ require 'runtime/mime_types'
33
+ require 'runtime/application'
34
+ require 'runtime/console'
35
+ require 'runtime/server'
36
+ require 'runtime/request'
37
+ require 'runtime/response'
38
+ require 'runtime/response_mixin'
39
+ require 'runtime/response_proxy'
40
+ require 'runtime/session'
41
+ require 'runtime/configuration'
42
+ require 'runtime/mapping'
43
+
44
+ # waves mvc support
45
+ require 'controllers/mixin'
46
+ require 'views/mixin'
47
+ require 'renderers/mixin'
48
+ require 'renderers/markaby'
49
+ require 'renderers/erubis'
50
+ # require 'helpers/form.rb'
metadata ADDED
@@ -0,0 +1,189 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.0
3
+ specification_version: 1
4
+ name: waves
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.6.7
7
+ date: 2008-01-26 00:00:00 -08:00
8
+ summary: Open-source framework for building Ruby-based Web applications.
9
+ require_paths:
10
+ - lib
11
+ email: dan@zeraweb.com
12
+ homepage: http://dev.zeraweb.com/waves
13
+ rubyforge_project:
14
+ description:
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.8.6
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - Dan Yoder
31
+ files:
32
+ - lib/controllers/mixin.rb
33
+ - lib/dispatchers/base.rb
34
+ - lib/dispatchers/default.rb
35
+ - lib/helpers/common.rb
36
+ - lib/helpers/form.rb
37
+ - lib/helpers/formatting.rb
38
+ - lib/helpers/model.rb
39
+ - lib/helpers/view.rb
40
+ - lib/renderers/erubis.rb
41
+ - lib/renderers/markaby.rb
42
+ - lib/renderers/mixin.rb
43
+ - lib/runtime/application.rb
44
+ - lib/runtime/configuration.rb
45
+ - lib/runtime/console.rb
46
+ - lib/runtime/logger.rb
47
+ - lib/runtime/mapping.rb
48
+ - lib/runtime/mime_types.rb
49
+ - lib/runtime/request.rb
50
+ - lib/runtime/response.rb
51
+ - lib/runtime/response_mixin.rb
52
+ - lib/runtime/response_proxy.rb
53
+ - lib/runtime/server.rb
54
+ - lib/runtime/session.rb
55
+ - lib/utilities/integer.rb
56
+ - lib/utilities/kernel.rb
57
+ - lib/utilities/module.rb
58
+ - lib/utilities/object.rb
59
+ - lib/utilities/string.rb
60
+ - lib/utilities/symbol.rb
61
+ - lib/views/mixin.rb
62
+ - lib/waves.rb
63
+ - app/configurations
64
+ - app/configurations/default.rb.erb
65
+ - app/configurations/development.rb.erb
66
+ - app/configurations/mapping.rb.erb
67
+ - app/configurations/production.rb.erb
68
+ - app/controllers
69
+ - app/controllers/default.rb.erb
70
+ - app/doc
71
+ - app/doc/EMTPY
72
+ - app/helpers
73
+ - app/helpers/default.rb.erb
74
+ - app/lib
75
+ - app/lib/application.rb.erb
76
+ - app/lib/startup.rb.erb
77
+ - app/lib/tasks
78
+ - app/lib/tasks/cluster.rb
79
+ - app/lib/tasks/schema.rb
80
+ - app/log
81
+ - app/models
82
+ - app/models/default.rb.erb
83
+ - app/public
84
+ - app/public/css
85
+ - app/public/flash
86
+ - app/public/images
87
+ - app/public/javascript
88
+ - app/Rakefile
89
+ - app/schema
90
+ - app/schema/migration
91
+ - app/schema/migration/templates
92
+ - app/schema/migration/templates/empty.rb.erb
93
+ - app/templates
94
+ - app/templates/errors
95
+ - app/templates/errors/not_found.mab
96
+ - app/templates/errors/server_error.mab
97
+ - app/templates/layouts
98
+ - app/templates/layouts/default.mab
99
+ - app/tmp
100
+ - app/tmp/sessions
101
+ - app/views
102
+ - app/views/default.rb.erb
103
+ test_files: []
104
+
105
+ rdoc_options: []
106
+
107
+ extra_rdoc_files: []
108
+
109
+ executables:
110
+ - waves
111
+ - waves-server
112
+ - waves-console
113
+ extensions: []
114
+
115
+ requirements: []
116
+
117
+ dependencies:
118
+ - !ruby/object:Gem::Dependency
119
+ name: mongrel
120
+ version_requirement:
121
+ version_requirements: !ruby/object:Gem::Version::Requirement
122
+ requirements:
123
+ - - ">"
124
+ - !ruby/object:Gem::Version
125
+ version: 0.0.0
126
+ version:
127
+ - !ruby/object:Gem::Dependency
128
+ name: rack
129
+ version_requirement:
130
+ version_requirements: !ruby/object:Gem::Version::Requirement
131
+ requirements:
132
+ - - ">"
133
+ - !ruby/object:Gem::Version
134
+ version: 0.0.0
135
+ version:
136
+ - !ruby/object:Gem::Dependency
137
+ name: markaby
138
+ version_requirement:
139
+ version_requirements: !ruby/object:Gem::Version::Requirement
140
+ requirements:
141
+ - - ">"
142
+ - !ruby/object:Gem::Version
143
+ version: 0.0.0
144
+ version:
145
+ - !ruby/object:Gem::Dependency
146
+ name: erubis
147
+ version_requirement:
148
+ version_requirements: !ruby/object:Gem::Version::Requirement
149
+ requirements:
150
+ - - ">"
151
+ - !ruby/object:Gem::Version
152
+ version: 0.0.0
153
+ version:
154
+ - !ruby/object:Gem::Dependency
155
+ name: autocode
156
+ version_requirement:
157
+ version_requirements: !ruby/object:Gem::Version::Requirement
158
+ requirements:
159
+ - - ">"
160
+ - !ruby/object:Gem::Version
161
+ version: 0.0.0
162
+ version:
163
+ - !ruby/object:Gem::Dependency
164
+ name: sequel
165
+ version_requirement:
166
+ version_requirements: !ruby/object:Gem::Version::Requirement
167
+ requirements:
168
+ - - ">"
169
+ - !ruby/object:Gem::Version
170
+ version: 0.0.0
171
+ version:
172
+ - !ruby/object:Gem::Dependency
173
+ name: extensions
174
+ version_requirement:
175
+ version_requirements: !ruby/object:Gem::Version::Requirement
176
+ requirements:
177
+ - - ">"
178
+ - !ruby/object:Gem::Version
179
+ version: 0.0.0
180
+ version:
181
+ - !ruby/object:Gem::Dependency
182
+ name: live_console
183
+ version_requirement:
184
+ version_requirements: !ruby/object:Gem::Version::Requirement
185
+ requirements:
186
+ - - ">"
187
+ - !ruby/object:Gem::Version
188
+ version: 0.0.0
189
+ version: