waves 0.7.3 → 0.7.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. data/app/Rakefile +11 -19
  2. data/app/bin/waves-console +3 -5
  3. data/app/bin/waves-server +3 -5
  4. data/app/configurations/development.rb.erb +19 -11
  5. data/app/configurations/mapping.rb.erb +4 -5
  6. data/app/configurations/production.rb.erb +18 -13
  7. data/app/{doc/EMTPY → controllers/.gitignore} +0 -0
  8. data/app/{public/css/EMPTY → doc/.gitignore} +0 -0
  9. data/app/{public/flash/EMPTY → helpers/.gitignore} +0 -0
  10. data/app/lib/application.rb.erb +4 -51
  11. data/app/{public/images/EMPTY → lib/tasks/.gitignore} +0 -0
  12. data/app/{public/javascript/EMPTY → log/.gitignore} +0 -0
  13. data/app/{tmp/sessions/EMPTY → models/.gitignore} +0 -0
  14. data/app/public/css/.gitignore +0 -0
  15. data/app/public/flash/.gitignore +0 -0
  16. data/app/public/images/.gitignore +0 -0
  17. data/app/public/javascript/.gitignore +0 -0
  18. data/app/schema/migrations/.gitignore +0 -0
  19. data/app/startup.rb +5 -0
  20. data/app/templates/layouts/default.mab +2 -2
  21. data/app/tmp/sessions/.gitignore +0 -0
  22. data/app/views/.gitignore +0 -0
  23. data/bin/waves +38 -27
  24. data/bin/waves-console +3 -25
  25. data/bin/waves-server +4 -45
  26. data/lib/commands/waves-console.rb +21 -0
  27. data/lib/commands/waves-server.rb +55 -0
  28. data/lib/controllers/base.rb +11 -0
  29. data/lib/controllers/mixin.rb +130 -102
  30. data/lib/dispatchers/base.rb +65 -50
  31. data/lib/dispatchers/default.rb +79 -52
  32. data/lib/foundations/default.rb +26 -0
  33. data/lib/foundations/simple.rb +30 -0
  34. data/lib/helpers/common.rb +60 -56
  35. data/lib/helpers/default.rb +13 -0
  36. data/lib/helpers/form.rb +39 -38
  37. data/lib/helpers/formatting.rb +11 -11
  38. data/lib/helpers/model.rb +12 -12
  39. data/lib/helpers/view.rb +13 -13
  40. data/lib/layers/default_errors.rb +29 -0
  41. data/lib/layers/mvc.rb +58 -0
  42. data/lib/layers/orm/active_record.rb +41 -0
  43. data/lib/layers/orm/active_record/migrations/empty.rb.erb +9 -0
  44. data/lib/layers/orm/active_record/tasks/schema.rb +30 -0
  45. data/lib/layers/orm/data_mapper.rb +42 -0
  46. data/lib/layers/orm/filebase.rb +22 -0
  47. data/lib/layers/orm/migration.rb +70 -0
  48. data/lib/layers/orm/sequel.rb +82 -0
  49. data/lib/layers/orm/sequel/migrations/empty.rb.erb +9 -0
  50. data/lib/layers/orm/sequel/tasks/schema.rb +24 -0
  51. data/lib/layers/simple.rb +39 -0
  52. data/lib/layers/simple_errors.rb +26 -0
  53. data/lib/mapping/mapping.rb +222 -120
  54. data/lib/mapping/pretty_urls.rb +42 -41
  55. data/lib/renderers/erubis.rb +54 -31
  56. data/lib/renderers/markaby.rb +28 -28
  57. data/lib/renderers/mixin.rb +49 -52
  58. data/lib/runtime/application.rb +66 -48
  59. data/lib/runtime/blackboard.rb +57 -0
  60. data/lib/runtime/configuration.rb +117 -101
  61. data/lib/runtime/console.rb +19 -20
  62. data/lib/runtime/debugger.rb +9 -0
  63. data/lib/runtime/logger.rb +43 -37
  64. data/lib/runtime/mime_types.rb +19 -19
  65. data/lib/runtime/request.rb +72 -46
  66. data/lib/runtime/response.rb +37 -37
  67. data/lib/runtime/response_mixin.rb +26 -23
  68. data/lib/runtime/response_proxy.rb +25 -24
  69. data/lib/runtime/server.rb +99 -80
  70. data/lib/runtime/session.rb +63 -53
  71. data/lib/tasks/cluster.rb +26 -0
  72. data/lib/tasks/gem.rb +31 -0
  73. data/lib/tasks/generate.rb +80 -0
  74. data/lib/utilities/hash.rb +22 -0
  75. data/lib/utilities/inflect.rb +194 -0
  76. data/lib/utilities/integer.rb +15 -12
  77. data/lib/utilities/kernel.rb +32 -32
  78. data/lib/utilities/module.rb +11 -4
  79. data/lib/utilities/object.rb +5 -5
  80. data/lib/utilities/proc.rb +10 -0
  81. data/lib/utilities/string.rb +44 -38
  82. data/lib/utilities/symbol.rb +4 -4
  83. data/lib/views/base.rb +9 -0
  84. data/lib/views/mixin.rb +91 -89
  85. data/lib/waves.rb +29 -9
  86. metadata +52 -26
  87. data/app/configurations/default.rb.erb +0 -8
  88. data/app/controllers/default.rb.erb +0 -29
  89. data/app/helpers/default.rb.erb +0 -13
  90. data/app/lib/startup.rb.erb +0 -3
  91. data/app/lib/tasks/cluster.rb +0 -24
  92. data/app/lib/tasks/generate.rb +0 -15
  93. data/app/lib/tasks/schema.rb +0 -29
  94. data/app/models/default.rb.erb +0 -13
  95. data/app/schema/migrations/templates/empty.rb.erb +0 -9
  96. data/app/views/default.rb.erb +0 -13
data/lib/waves.rb CHANGED
@@ -1,13 +1,17 @@
1
1
  # External Dependencies
2
2
  require 'rubygems'
3
3
 
4
- # the underlying web server
5
- require 'mongrel'
4
+ # Some scripts need to be able to locate items relative to waves source.
5
+ WAVES = "#{File.dirname(__FILE__)}/.." unless defined?(WAVES)
6
+
6
7
  require 'rack'
7
8
  require 'daemons'
8
9
  require 'live_console'
9
10
  require 'autocode'
10
11
 
12
+ # for mimetypes only or when using as default handler
13
+ require 'mongrel'
14
+
11
15
  # a bunch of handy stuff
12
16
  require 'extensions/all'
13
17
  require 'fileutils'
@@ -25,7 +29,9 @@ require 'utilities/symbol'
25
29
  require 'utilities/kernel'
26
30
  require 'utilities/object'
27
31
  require 'utilities/integer'
28
-
32
+ require 'utilities/inflect'
33
+ require 'utilities/proc'
34
+ require 'utilities/hash'
29
35
  # waves Runtime
30
36
  require 'dispatchers/base'
31
37
  require 'dispatchers/default'
@@ -33,12 +39,14 @@ require 'runtime/logger'
33
39
  require 'runtime/mime_types'
34
40
  require 'runtime/application'
35
41
  require 'runtime/console'
42
+ require 'runtime/debugger'
36
43
  require 'runtime/server'
37
44
  require 'runtime/request'
38
45
  require 'runtime/response'
39
46
  require 'runtime/response_mixin'
40
47
  require 'runtime/response_proxy'
41
48
  require 'runtime/session'
49
+ require 'runtime/blackboard'
42
50
  require 'runtime/configuration'
43
51
 
44
52
  # waves URI mapping
@@ -47,12 +55,24 @@ require 'mapping/pretty_urls'
47
55
 
48
56
  # waves mvc support
49
57
  require 'controllers/mixin'
58
+ require 'controllers/base'
50
59
  require 'views/mixin'
60
+ require 'views/base'
61
+ require 'helpers/common'
62
+ require 'helpers/form'
63
+ require 'helpers/formatting'
64
+ require 'helpers/model'
65
+ require 'helpers/view'
66
+ require 'helpers/default'
51
67
  require 'renderers/mixin'
52
- require 'renderers/markaby'
53
68
  require 'renderers/erubis'
54
- require 'helpers/common.rb'
55
- require 'helpers/form.rb'
56
- require 'helpers/formatting.rb'
57
- require 'helpers/model.rb'
58
- require 'helpers/view.rb'
69
+ require 'renderers/markaby'
70
+
71
+
72
+ # waves foundations / layers
73
+ require 'layers/simple'
74
+ require 'layers/simple_errors'
75
+ require 'foundations/simple'
76
+ require 'layers/mvc'
77
+ require 'layers/default_errors'
78
+ require 'foundations/default'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: waves
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Yoder
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-06-09 00:00:00 -05:00
12
+ date: 2008-06-19 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -58,7 +58,7 @@ dependencies:
58
58
  version: "0"
59
59
  version:
60
60
  - !ruby/object:Gem::Dependency
61
- name: sequel
61
+ name: autocode
62
62
  version_requirement:
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
@@ -103,22 +103,22 @@ dependencies:
103
103
  version: "0"
104
104
  version:
105
105
  - !ruby/object:Gem::Dependency
106
- name: sequel
106
+ name: rakegen
107
107
  version_requirement:
108
108
  version_requirements: !ruby/object:Gem::Requirement
109
109
  requirements:
110
110
  - - ">="
111
111
  - !ruby/object:Gem::Version
112
- version: 2.0.0
112
+ version: "0"
113
113
  version:
114
114
  - !ruby/object:Gem::Dependency
115
- name: autocode
115
+ name: sequel
116
116
  version_requirement:
117
117
  version_requirements: !ruby/object:Gem::Requirement
118
118
  requirements:
119
- - - "="
119
+ - - ">="
120
120
  - !ruby/object:Gem::Version
121
- version: 0.9.2
121
+ version: 2.0.0
122
122
  version:
123
123
  description:
124
124
  email: dan@zeraweb.com
@@ -131,22 +131,41 @@ extensions: []
131
131
  extra_rdoc_files: []
132
132
 
133
133
  files:
134
+ - lib/commands/waves-console.rb
135
+ - lib/commands/waves-server.rb
136
+ - lib/controllers/base.rb
134
137
  - lib/controllers/mixin.rb
135
138
  - lib/dispatchers/base.rb
136
139
  - lib/dispatchers/default.rb
140
+ - lib/foundations/default.rb
141
+ - lib/foundations/simple.rb
137
142
  - lib/helpers/common.rb
143
+ - lib/helpers/default.rb
138
144
  - lib/helpers/form.rb
139
145
  - lib/helpers/formatting.rb
140
146
  - lib/helpers/model.rb
141
147
  - lib/helpers/view.rb
148
+ - lib/layers/default_errors.rb
149
+ - lib/layers/mvc.rb
150
+ - lib/layers/orm/active_record/tasks/schema.rb
151
+ - lib/layers/orm/active_record.rb
152
+ - lib/layers/orm/data_mapper.rb
153
+ - lib/layers/orm/filebase.rb
154
+ - lib/layers/orm/migration.rb
155
+ - lib/layers/orm/sequel/tasks/schema.rb
156
+ - lib/layers/orm/sequel.rb
157
+ - lib/layers/simple.rb
158
+ - lib/layers/simple_errors.rb
142
159
  - lib/mapping/mapping.rb
143
160
  - lib/mapping/pretty_urls.rb
144
161
  - lib/renderers/erubis.rb
145
162
  - lib/renderers/markaby.rb
146
163
  - lib/renderers/mixin.rb
147
164
  - lib/runtime/application.rb
165
+ - lib/runtime/blackboard.rb
148
166
  - lib/runtime/configuration.rb
149
167
  - lib/runtime/console.rb
168
+ - lib/runtime/debugger.rb
150
169
  - lib/runtime/logger.rb
151
170
  - lib/runtime/mime_types.rb
152
171
  - lib/runtime/request.rb
@@ -155,51 +174,47 @@ files:
155
174
  - lib/runtime/response_proxy.rb
156
175
  - lib/runtime/server.rb
157
176
  - lib/runtime/session.rb
177
+ - lib/tasks/cluster.rb
178
+ - lib/tasks/gem.rb
179
+ - lib/tasks/generate.rb
180
+ - lib/utilities/hash.rb
181
+ - lib/utilities/inflect.rb
158
182
  - lib/utilities/integer.rb
159
183
  - lib/utilities/kernel.rb
160
184
  - lib/utilities/module.rb
161
185
  - lib/utilities/object.rb
186
+ - lib/utilities/proc.rb
162
187
  - lib/utilities/string.rb
163
188
  - lib/utilities/symbol.rb
189
+ - lib/views/base.rb
164
190
  - lib/views/mixin.rb
165
191
  - lib/waves.rb
192
+ - lib/layers/orm/active_record/migrations/empty.rb.erb
193
+ - lib/layers/orm/sequel/migrations/empty.rb.erb
166
194
  - app/bin
167
195
  - app/bin/waves-console
168
196
  - app/bin/waves-server
169
197
  - app/configurations
170
- - app/configurations/default.rb.erb
171
198
  - app/configurations/development.rb.erb
172
199
  - app/configurations/mapping.rb.erb
173
200
  - app/configurations/production.rb.erb
174
201
  - app/controllers
175
- - app/controllers/default.rb.erb
176
202
  - app/doc
177
- - app/doc/EMTPY
178
203
  - app/helpers
179
- - app/helpers/default.rb.erb
180
204
  - app/lib
181
205
  - app/lib/application.rb.erb
182
- - app/lib/startup.rb.erb
183
206
  - app/lib/tasks
184
- - app/lib/tasks/cluster.rb
185
- - app/lib/tasks/generate.rb
186
- - app/lib/tasks/schema.rb
207
+ - app/log
187
208
  - app/models
188
- - app/models/default.rb.erb
189
209
  - app/public
190
210
  - app/public/css
191
- - app/public/css/EMPTY
192
211
  - app/public/flash
193
- - app/public/flash/EMPTY
194
212
  - app/public/images
195
- - app/public/images/EMPTY
196
213
  - app/public/javascript
197
- - app/public/javascript/EMPTY
198
214
  - app/Rakefile
199
215
  - app/schema
200
216
  - app/schema/migrations
201
- - app/schema/migrations/templates
202
- - app/schema/migrations/templates/empty.rb.erb
217
+ - app/startup.rb
203
218
  - app/templates
204
219
  - app/templates/errors
205
220
  - app/templates/errors/not_found_404.mab
@@ -208,11 +223,22 @@ files:
208
223
  - app/templates/layouts/default.mab
209
224
  - app/tmp
210
225
  - app/tmp/sessions
211
- - app/tmp/sessions/EMPTY
212
226
  - app/views
213
- - app/views/default.rb.erb
227
+ - app/controllers/.gitignore
228
+ - app/doc/.gitignore
229
+ - app/helpers/.gitignore
230
+ - app/lib/tasks/.gitignore
231
+ - app/log/.gitignore
232
+ - app/models/.gitignore
233
+ - app/public/css/.gitignore
234
+ - app/public/flash/.gitignore
235
+ - app/public/images/.gitignore
236
+ - app/public/javascript/.gitignore
237
+ - app/schema/migrations/.gitignore
238
+ - app/tmp/sessions/.gitignore
239
+ - app/views/.gitignore
214
240
  has_rdoc: true
215
- homepage: http://dev.zeraweb.com/waves
241
+ homepage: http://rubywaves.com
216
242
  post_install_message:
217
243
  rdoc_options: []
218
244
 
@@ -1,8 +0,0 @@
1
- module <%= name %>
2
- module Configurations
3
- class Default < Waves::Configurations::Default
4
- database :host => host, :adapter => 'mysql', :database => '<%= name.downcase %>',
5
- :user => 'root', :password => ''
6
- end
7
- end
8
- end
@@ -1,29 +0,0 @@
1
- module <%= name %>
2
-
3
- module Controllers
4
-
5
- class Default
6
-
7
- include Waves::Controllers::Mixin
8
-
9
- def attributes; params[model_name.singular.intern]; end
10
-
11
- def all; model.all; end
12
-
13
- def find( name ); model[ :name => name ] or not_found; end
14
-
15
- def create; model.create( attributes ); end
16
-
17
- def update( name )
18
- instance = find( name )
19
- instance.update_with_params( attributes )
20
- instance
21
- end
22
-
23
- def delete( name ); find( name ).destroy; end
24
-
25
- end
26
-
27
- end
28
-
29
- end
@@ -1,13 +0,0 @@
1
- module <%= name %>
2
- module Helpers
3
- module Default
4
- attr_reader :request, :content
5
- include Waves::ResponseMixin
6
- include Waves::Helpers::Common
7
- include Waves::Helpers::Formatting
8
- include Waves::Helpers::Model
9
- include Waves::Helpers::View
10
- include Waves::Helpers::Form
11
- end
12
- end
13
- end
@@ -1,3 +0,0 @@
1
- require 'lib/<%= name.downcase %>'
2
- Waves << <%= name %>
3
- Application = <%= name %>
@@ -1,24 +0,0 @@
1
- namespace :cluster do
2
-
3
- desc 'Start a cluster of waves applications.'
4
- task :start do |task|
5
- ( Waves::Console.config.ports || [ Waves::Console.config.port ] ).each do |port|
6
- cmd = "waves-server -p #{port} -c #{ENV['mode']||'development'} -d"
7
- puts cmd ; `#{cmd}`
8
- end
9
- end
10
-
11
- desc 'Stop a cluster of waves applications.'
12
- task :stop do |task|
13
- Dir[ :log / '*.pid' ].each do |path|
14
- pid = File.basename(path,'.pid').to_i
15
- puts "Stopping process #{pid} ..."
16
- Process.kill( 'INT', pid ) rescue nil
17
- end
18
- end
19
-
20
- desc 'Restart a cluster of waves applications.'
21
- task :restart => [ :stop, :start ] do |task|
22
- end
23
-
24
- end
@@ -1,15 +0,0 @@
1
- namespace :generate do
2
- desc 'Generate a new model'
3
- task :model do |task|
4
- template = File.read :models / 'default.rb'
5
- File.write( :models / ENV['name'] + '.rb',
6
- template.gsub('class Default < Sequel::Model',
7
- "class #{ENV['name'].camel_case} < Sequel::Model(:#{ENV['name'].plural})") )
8
- end
9
- desc 'Generate a new controller'
10
- task :controller do |task|
11
- template = File.read :controllers / 'default.rb'
12
- File.write( :controllers / ENV['name'] + '.rb',
13
- template.gsub('class Default',"class #{ENV['name'].camel_case}") )
14
- end
15
- end
@@ -1,29 +0,0 @@
1
- require 'sequel'
2
- namespace :schema do
3
-
4
- desc 'Create a new Sequel Migration using name.'
5
- task :migration do |task|
6
-
7
- version = ( ENV['version'].nil? ?
8
- Sequel::Migrator.get_current_migration_version( Application.database ) :
9
- ENV['version'].to_i ) + 1
10
-
11
- name = ENV['name'] || 'migration'
12
- class_name = name.camel_case
13
-
14
- template = ( ENV['template'] || 'empty' ) + '.rb.erb'
15
- source = :schema / :migrations / :templates / template
16
- destination = :schema / :migrations / "#{'%03d' % version}_#{name}.rb"
17
- code = Erubis::Eruby.new( File.read( source ) ).result( binding )
18
- File.write( destination, code )
19
-
20
- end
21
-
22
- desc 'Performs migration from version, to version.'
23
- task :migrate do |task|
24
- version = ENV['version']; version = version.to_i unless version.nil?
25
- Sequel::Migrator.apply( Waves.application.database, :schema / :migrations , version )
26
- end
27
-
28
- end
29
-
@@ -1,13 +0,0 @@
1
- module <%= name %>
2
-
3
- module Models
4
-
5
- class Default < Sequel::Model
6
- before_save do
7
- set(:updated_on => Time.now) if columns.include? :updated_on
8
- end
9
- end
10
-
11
- end
12
-
13
- end
@@ -1,9 +0,0 @@
1
- class <%= class_name %> < Sequel::Migration
2
-
3
- def up
4
- end
5
-
6
- def down
7
- end
8
-
9
- end
@@ -1,13 +0,0 @@
1
- module <%= name %>
2
-
3
- module Views
4
-
5
- class Default
6
-
7
- include Waves::Views::Mixin
8
-
9
- end
10
-
11
- end
12
-
13
- end