hobo 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/bin/hobo +21 -22
  2. data/hobo_files/plugin/CHANGES.txt +429 -4
  3. data/hobo_files/plugin/Rakefile +2 -2
  4. data/hobo_files/plugin/generators/hobo_front_controller/templates/index.dryml +6 -5
  5. data/hobo_files/plugin/generators/hobo_front_controller/templates/search.dryml +2 -2
  6. data/hobo_files/plugin/generators/hobo_migration/hobo_migration_generator.rb +20 -15
  7. data/hobo_files/plugin/generators/hobo_model/templates/model.rb +1 -0
  8. data/hobo_files/plugin/generators/hobo_model_controller/templates/controller.rb +2 -0
  9. data/hobo_files/plugin/generators/hobo_rapid/templates/hobo_base.css +1 -2
  10. data/hobo_files/plugin/generators/hobo_rapid/templates/hobo_rapid.css +4 -3
  11. data/hobo_files/plugin/generators/hobo_rapid/templates/hobo_rapid.js +94 -12
  12. data/hobo_files/plugin/generators/hobo_rapid/templates/lowpro.js +5 -183
  13. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/stylesheets/application.css +1 -1
  14. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/views/application.dryml +23 -1
  15. data/hobo_files/plugin/generators/hobo_user_controller/templates/controller.rb +2 -0
  16. data/hobo_files/plugin/generators/hobo_user_model/templates/model.rb +3 -1
  17. data/hobo_files/plugin/init.rb +18 -7
  18. data/hobo_files/plugin/lib/active_record/has_many_association.rb +2 -2
  19. data/hobo_files/plugin/lib/extensions.rb +56 -12
  20. data/hobo_files/plugin/lib/hobo.rb +25 -88
  21. data/hobo_files/plugin/lib/hobo/composite_model.rb +2 -0
  22. data/hobo_files/plugin/lib/hobo/controller.rb +40 -20
  23. data/hobo_files/plugin/lib/hobo/dryml.rb +122 -106
  24. data/hobo_files/plugin/lib/hobo/dryml/dryml_builder.rb +2 -1
  25. data/hobo_files/plugin/lib/hobo/dryml/part_context.rb +3 -2
  26. data/hobo_files/plugin/lib/hobo/dryml/taglib.rb +19 -3
  27. data/hobo_files/plugin/lib/hobo/dryml/template.rb +40 -25
  28. data/hobo_files/plugin/lib/hobo/dryml/template_environment.rb +41 -20
  29. data/hobo_files/plugin/lib/hobo/email_address.rb +4 -1
  30. data/hobo_files/plugin/lib/hobo/enum_string.rb +50 -0
  31. data/hobo_files/plugin/lib/hobo/field_declaration_dsl.rb +36 -0
  32. data/hobo_files/plugin/lib/hobo/field_spec.rb +4 -7
  33. data/hobo_files/plugin/lib/hobo/hobo_helper.rb +47 -44
  34. data/hobo_files/plugin/lib/hobo/html_string.rb +2 -0
  35. data/hobo_files/plugin/lib/hobo/markdown_string.rb +2 -0
  36. data/hobo_files/plugin/lib/hobo/model.rb +158 -89
  37. data/hobo_files/plugin/lib/hobo/model_controller.rb +422 -376
  38. data/hobo_files/plugin/lib/hobo/model_queries.rb +1 -1
  39. data/hobo_files/plugin/lib/hobo/model_router.rb +174 -0
  40. data/hobo_files/plugin/lib/hobo/password_string.rb +2 -0
  41. data/hobo_files/plugin/lib/hobo/percentage.rb +14 -0
  42. data/hobo_files/plugin/lib/hobo/plugins.rb +4 -4
  43. data/hobo_files/plugin/lib/hobo/rapid_helper.rb +10 -2
  44. data/hobo_files/plugin/lib/hobo/text.rb +3 -3
  45. data/hobo_files/plugin/lib/hobo/textile_string.rb +2 -0
  46. data/hobo_files/plugin/lib/hobo/undefined.rb +3 -2
  47. data/hobo_files/plugin/lib/hobo/{authenticated_user.rb → user.rb} +10 -3
  48. data/hobo_files/plugin/lib/hobo/user_controller.rb +27 -23
  49. data/hobo_files/plugin/tags/core.dryml +8 -2
  50. data/hobo_files/plugin/tags/rapid.dryml +52 -40
  51. data/hobo_files/plugin/tags/rapid_document_tags.dryml +15 -11
  52. data/hobo_files/plugin/tags/rapid_editing.dryml +41 -9
  53. data/hobo_files/plugin/tags/rapid_forms.dryml +136 -36
  54. data/hobo_files/plugin/tags/rapid_navigation.dryml +2 -2
  55. data/hobo_files/plugin/tags/rapid_pages.dryml +204 -221
  56. data/hobo_files/plugin/tags/rapid_plus.dryml +8 -6
  57. data/hobo_files/plugin/tags/rapid_support.dryml +2 -3
  58. metadata +44 -42
  59. data/hobo_files/plugin/lib/hobo/define_tags.rb +0 -56
  60. data/hobo_files/plugin/lib/hobo/http_parameters.rb +0 -225
data/bin/hobo CHANGED
@@ -3,9 +3,9 @@
3
3
  require 'fileutils'
4
4
  Signal.trap("INT") { puts; exit }
5
5
 
6
- SRC_FILES = File.join(File.dirname(__FILE__), "../hobo_files")
6
+ hobo_src = File.join(File.dirname(__FILE__), "../hobo_files/plugin")
7
7
 
8
- USAGE = "USAGE: hobo <app-path> [ --user-model <model-name-or-false> ] [ --svn ]"
8
+ USAGE = "USAGE: hobo [ --user-model <model-name-or-false> ] [ --svn ] [--db] [--hobo-src <path to hobo src>] <app-path>"
9
9
 
10
10
  HOBO_REPO = "svn://hobocentral.net/hobo/trunk/hobo"
11
11
 
@@ -22,8 +22,8 @@ end
22
22
  ### end nasty stuff ###
23
23
 
24
24
 
25
- def command(s)
26
- ok = system(s)
25
+ def command(*s)
26
+ ok = system(s.join(' '))
27
27
  exit(1) unless ok
28
28
  end
29
29
 
@@ -32,10 +32,10 @@ if ARGV.length == 0 || ARGV.include?("--help")
32
32
  exit 1
33
33
  end
34
34
 
35
- app_path = ARGV.shift
35
+ app_path = ARGV.pop
36
36
 
37
37
  user_model = "user"
38
- hobo_svn = false
38
+ hobo_svn = create_db = false
39
39
 
40
40
  until ARGV.empty?
41
41
  case ARGV.shift
@@ -44,42 +44,36 @@ until ARGV.empty?
44
44
  user_model = arg == "false" ? nil : arg
45
45
  when "--svn"
46
46
  hobo_svn = true
47
+ when "--db"
48
+ create_db = true
49
+ when "--hobo-src"
50
+ hobo_src = "../" + ARGV.shift
47
51
  else
48
52
  puts USAGE
49
53
  exit 1
50
54
  end
51
55
  end
52
56
 
53
- FileUtils.mkdir_p(app_path) unless File.exists?(app_path)
54
- (puts "App directory is not a directory!"; exit 1) unless File.directory?(app_path)
57
+ puts "\nGenerating Rails app...\n"
58
+ system("rails #{app_path}")
55
59
 
56
60
  Dir.chdir(app_path) do
57
61
  gen = "ruby #{File.join('script', 'generate')}"
58
62
  plugin = "ruby #{File.join('script', 'plugin')}"
59
63
 
60
- puts "\nChecking out Edge Rails...\n"
61
- system("svn co http://dev.rubyonrails.org/svn/rails/trunk vendor/rails") or
62
- begin
63
- puts "Could not check out Edge Rails - maybe svn is not installed?"
64
- exit 1
65
- end
66
-
67
- puts "\nGenerating Edge Rails application...\n"
68
- command("ruby #{File.join('vendor', 'rails', 'railties', 'bin', 'rails')} .")
69
-
70
64
  puts "\nInstalling classic_pagination\n"
71
- command("#{plugin} install svn://errtheblog.com/svn/plugins/classic_pagination")
65
+ command(plugin, "install svn://errtheblog.com/svn/plugins/classic_pagination")
72
66
 
73
67
  if hobo_svn
74
68
  puts "\nInstalling Hobo plugin via svn checkout...\n"
75
69
  command("svn co #{HOBO_REPO} vendor/plugins/hobo")
76
70
  else
77
- puts "\nInstalling Hobo plugin from gem...\n"
78
- FileUtils.cp_r File.join(SRC_FILES, "plugin"), "vendor/plugins/hobo"
71
+ puts "\nInstalling Hobo plugin...\n"
72
+ FileUtils.cp_r hobo_src, "vendor/plugins/hobo"
79
73
  end
80
74
 
81
75
  puts "\nInitialising Hobo...\n"
82
- command("#{gen} hobo --add-routes")
76
+ command(gen, "hobo --add-routes")
83
77
 
84
78
  puts "\nInstalling Hobo Rapid and default theme...\n"
85
79
  command("#{gen} hobo_rapid --import-tags")
@@ -92,4 +86,9 @@ Dir.chdir(app_path) do
92
86
 
93
87
  puts "\nCreating standard pages...\n"
94
88
  command("#{gen} hobo_front_controller front --delete-index --add-routes")
89
+
90
+ if create_db
91
+ puts "\nCreating databases"
92
+ command("rake db:create:all")
93
+ end
95
94
  end
@@ -1,3 +1,430 @@
1
+ === Release 0.6.3 ===
2
+
3
+ New feature: subsites, i.e. namespaced routes, plus support in the
4
+ controller and view layers. Subsites are created automatically for any
5
+ directories found in app/controllers. Links default to the current
6
+ subsite unless you give a subite="..." attribute. The taglib
7
+ app/views/<subsite>/<subsite-name>.dryml is automatically included in
8
+ every page in the subsite.
9
+
10
+ The out-of-box app is not in great shape in this release, mostly due
11
+ to problems with the theme. We haven't fixed it because the theme
12
+ system going to change radically in Hobo 0.7
13
+
14
+ New version of lowpro, compatible with Prototype 1.6 (rev 267)
15
+
16
+ Change to hobo command:
17
+
18
+ hobo [...options...] app-name
19
+
20
+ instead of
21
+
22
+ hobo app-name [...options...]
23
+
24
+
25
+ Migration generator
26
+
27
+ Automatically ignores non-Hobo models (and associated tables)
28
+
29
+ Hobo::Migrations.ignore_models is now deprecated.
30
+
31
+ Use Hobo::Migrations.ignore to list models that should be
32
+ ignored. The associated tables are ignored too (rarely needed, as
33
+ these are probably not Hobo models anyway)
34
+
35
+ Hobo::Migrations.ignore_tables is still supported
36
+
37
+ Fix: problems with going back to a nil default from a non-nil
38
+ default.
39
+
40
+
41
+ Hobo model generator
42
+
43
+ In line with Rails 2.0, the timestamps declaration is now included
44
+ by default (it's generally something every model should have).
45
+
46
+
47
+ hobo_base.css
48
+
49
+ Removed over-zealous styling of too many elements.
50
+
51
+
52
+ hobo_rapid.css
53
+
54
+ Change of class names for validation errors.
55
+
56
+
57
+ hobo_rapid.js
58
+
59
+ Now silently ignores update to non-existent part. This is convenient
60
+ when parts are being added dynamically, but may prove to be a
61
+ mistake :-)
62
+
63
+ Global variable controllerNames is gone. Now use calls to
64
+ Hobo.pluralise. (Gee I guess we should really standardise on
65
+ American spellings)
66
+
67
+ The 'fade' parameter to removeButton is now an option. Confirmation
68
+ is now optional too.
69
+
70
+ Hobo.partFor returns the part containing a given element. Used in
71
+ the new update="self" feature.
72
+
73
+ LowPro behaviour HasManyThroughInput. This is badly named and will
74
+ change.
75
+
76
+
77
+ Core extensions
78
+
79
+ alias_tag_chain is like alias_method_chain but for DRYML tags
80
+
81
+ SafeNil
82
+
83
+ Now more efficient (thanks to "steve d" --
84
+ http://coderrr.wordpress.com)
85
+
86
+ Fix when used with DelegateClass
87
+
88
+ New method #implies on booleans. Borrowed from Eiffel. Useful in
89
+ permission methods.
90
+
91
+ true.implies false #=> false
92
+ true.implies true #=> true
93
+ false.implies x #=> true
94
+
95
+ Hash#map_hash. The block is passed only the value if the arity is 1.
96
+
97
+
98
+ DRYML
99
+
100
+ The ability to define tags in Ruby is now removed
101
+
102
+ Tag extension: <def tag="Page" extend_with="navigation">
103
+
104
+ This encapsulates the alias_method_chain pattern. The tag can make
105
+ a call to <PageWithoutNavigation> to get the old behaviour.
106
+
107
+ alias_current_as is gone -- replaced by extend_with
108
+
109
+ Fix: some DRYML attributes were leaking through to the output HTML
110
+
111
+ part_locals can now be passed instance variable names,
112
+ e.g. part_locals="@user". Note that inside the part this creates a
113
+ local variable "user". Don't user @user inside the part. It's just a
114
+ convenience to avoid the need to do <set user="&@user"/>
115
+
116
+ Fix: failure to accumulate CSS class names when merging attributes.
117
+
118
+ DRYML now gives the type returned by #field_type (when available)
119
+ over this.class
120
+
121
+ Fix: when overriding a parameter, the <default_tagbody/> of the new
122
+ parameter would incorrectly provide the old tagbody which should
123
+ have been overridden.
124
+
125
+ hoboParts variable is now set by <hobo_rapid_javascripts> rather
126
+ than being hard wired in the output from the DRYML compiler.
127
+
128
+ Fix: caching problems with tags imported by the include_tablib
129
+ directive.
130
+
131
+
132
+ AJAX Parts
133
+
134
+ Calls to parts, along with the part-state variables are now logged.
135
+
136
+ Can now say part="self" when a tag wants to update the part it is
137
+ contained in (useful for re-usable tags).
138
+
139
+
140
+ Rich data types
141
+
142
+ All rich data types now register themselves with Hobo, e.g.
143
+
144
+ class Hobo::EmailAddress < String
145
+ COLUMN_TYPE = :string
146
+ ...
147
+ end
148
+
149
+ Hobo.field_types[:email_address] = Hobo::EmailAddress
150
+
151
+ New type builder - enum_string. e.g.
152
+
153
+ fields do
154
+ gender enum_string(:male, :female)
155
+ end
156
+
157
+ You can then do, e.g. if current_user.gender.male?
158
+
159
+ (You also automatically get select menu's in your views)
160
+
161
+
162
+ Hobo models
163
+
164
+ In fields declaration:
165
+
166
+ Got rid of weird thing where providing :length meant the type
167
+ defaulted to :string
168
+
169
+ Can now give classes as well as symbolic names for column types.
170
+
171
+ Mass attribute assignment extended to support some features that
172
+ were in the model controller. e.g. Dates can be represented as
173
+ Hashes of month, day etc. Chronic will be used to parse dates if
174
+ available. Object references (e.g. belongs_to relationships) can be
175
+ set with "@<typed-id>" as before.
176
+
177
+ "fields do" can optionally be used with a parameter if you don't
178
+ like the instance_eval hackery:
179
+
180
+ fields do |f|
181
+ f.name :string
182
+ end
183
+
184
+ belongs_to can be given :null => false, which is passed through to
185
+ the migration generator.
186
+
187
+ New method #column returns the meta-data for the named column.
188
+
189
+ #find now returns arrays with a #member_class method
190
+
191
+ def_scope
192
+
193
+ Chained scopes on a class didn't work at all -- now fixed,
194
+ e.g. Posts.recent.by_author.find(:all)
195
+
196
+ Fix: def_scope with sql parameter interpolation was broken.
197
+
198
+
199
+ #changed_fields, which was next to useless, replaced with
200
+ #only_changed_fields, which is used to assert that only the given
201
+ fields have changed.
202
+
203
+
204
+ Hobo user model
205
+
206
+ The module is renamed from Hobo::AuthenticatedUser to just
207
+ Hobo::User
208
+
209
+ It is no longer possible to set the login attribute by passing a
210
+ symbol to hobo_user_model. Go back to using set_login_attr. Didn't
211
+ work out. It happens sometimes.
212
+
213
+
214
+ Helpers
215
+
216
+ #subsite returns the name of the current subsite.
217
+
218
+ #object_url can now be passed the siubsite, e.g. :subsite => "admin"
219
+
220
+ #object_url can only be passed a single hash of options now (could
221
+ be passed any ammount before)
222
+
223
+ #dom_id now returns "" when a dom_id cannot be generated (used to
224
+ raise an error)
225
+
226
+ #map_this now works with ranges (used by DRYML's repeat)
227
+
228
+ #current_page_url returns request.request_uri without the query string
229
+
230
+ #query_params now returns a HashWithIndifferentAccess
231
+
232
+ Hobo.dom_id now works better with non-hobo models
233
+
234
+
235
+ Permission System
236
+
237
+ Fix: view permission was causing errors with non-hobo models. Now
238
+ defaults to viewable.
239
+
240
+
241
+ Hobo Controller
242
+
243
+ include_tablib accepts symbols as well as strings
244
+
245
+ #redirect_to now forwards all params to object_url when not given a
246
+ String, Symbol or Hash
247
+
248
+ #hobo_ajax_response no longer need be passed a dryml this
249
+
250
+
251
+ Model controller
252
+
253
+ Multiple model creates / updates are gone from the controller
254
+ layer. Hobo now uses good ol' Rails mass attribute
255
+ assignment. Coping with multiple object updates should be handled in
256
+ the model layer. Some features from the model controller have been
257
+ moved to the model layer, and more will be added in the future.
258
+
259
+ Attempts to automatically re-render the correct page after a
260
+ validation error on create / update using a form parameter
261
+ "page_path", which the <form> tag provides in a hidden
262
+ field. Previously assumed the form came from the new / edit action.
263
+
264
+ Automatic pagination is now only applied to appropriate
265
+ mime-types. Add mime-types to Hobo::ModelController.PAGINATE_FORMATS
266
+ to have them paginated.
267
+
268
+ New declaration 'auto_actions' allows you to select which actions
269
+ Hobo provides for you automatically.
270
+
271
+ # White list
272
+ auto_actions :show, :index
273
+
274
+ or
275
+
276
+ # Black list
277
+ auto_action :all, :except => [ :new_comment ]
278
+
279
+ You can use :collections to add/remove all collection actions in
280
+ either the black or white list.
281
+
282
+ New declaration 'index_action' declares a new index-like action
283
+ (similar to show_action)
284
+
285
+ index_action, show_action and web_method can now all be given
286
+ blocks, rather than defining a method of the same name:
287
+
288
+ show_action :summary do
289
+ hobo_show Post.find(params[:id], :include => :comments)
290
+ end
291
+
292
+ Web methods now automatically respond with hobo_ajax_response if the
293
+ method does not respond.
294
+
295
+ #search
296
+
297
+ Now less magic (i.e. doesn't operate by side-effecting). It now
298
+ returns a condition string suitable to be passed to :conditions.
299
+
300
+ Can be given a model as the first argument to search on a
301
+ different model (e.g. for show-collection actions).
302
+
303
+ Fix: :paginate => false was broken
304
+
305
+ #create, #update and #destroy now set flash messages by default
306
+ (only on "wants.html" requests)
307
+
308
+ <PermissionDeniedPage> used as the default permission denied
309
+ response.
310
+
311
+ <NotFoundPage> used as the default 404 response.
312
+
313
+
314
+ User controller
315
+
316
+ Added various customisation options to login and signup
317
+
318
+ On login, redirect to #home_page -- you can override this on your
319
+ controllers.
320
+
321
+ The actual name of the login attribute (e.g. "email", "username") is
322
+ now used in flash messages.
323
+
324
+ hobo_logout can now be given a block to customise the response.
325
+
326
+ Fixes for validation errors on signup.
327
+
328
+
329
+ Routing
330
+
331
+ Routes for non-existent actions are not generated.
332
+
333
+
334
+ Tag library: Core tags
335
+
336
+ <wrap> will wrap its content in ther tag specified by tag="..." if
337
+ when="..." is true.
338
+
339
+ Fix: <unless> -- was behaving like <if>
340
+
341
+
342
+ Tag library: Rapid
343
+
344
+ <FieldList> now has params <label> and <view> that wrap every label
345
+ and view. Also <foo_tag> where "foo" is a field-name, is the actual
346
+ tag that renders the field (e.g. <view> or <edit>)
347
+
348
+ <nil_view> can be overridden to customise the way Hobo renders nil
349
+ values.
350
+
351
+ <Table> new attribute 'empty' -- when given the table is rendered
352
+ even when there are items in the collection.
353
+
354
+ <name> now respects view permission properly
355
+
356
+ <view> now does a #strip to the output
357
+
358
+ <count> -- new attribute if_any - set to true to output nothing if
359
+ the count is zero.
360
+
361
+
362
+ Tag library: Rapid documents
363
+
364
+ The 'document' tags like <section>, <aside> output nothing when the
365
+ content is blank. Now they can ge given the 'empty' attribute
366
+ causing the tag to be output even if the content is blank.
367
+
368
+ New tag <sub_heading>
369
+
370
+
371
+ Tag library: Rapid forms
372
+
373
+ <hidden_fields> will now not output hidden fields for attributes
374
+ on new records that are in their default state.
375
+
376
+ <form> now has a default ajax message for creating new objects.
377
+
378
+ <form> now supports forgery protection
379
+
380
+ <input> -- better handling of the 'field with errors' wrapper
381
+
382
+ <input> for passwords now accepts extra html attributes
383
+
384
+ New <input> for enum-strings - a select menu.
385
+
386
+ New <input> for big decimals
387
+
388
+ <remote_method_button> now supports non ajax remote method calls
389
+ (when no update="..." is given)
390
+
391
+ css classes on buttons renamed from "button_input" to "button"
392
+
393
+ <update_button> now supports confirm="&false"
394
+
395
+ <belongs_to_menu_input>
396
+
397
+ none_message attribute renamed to blank_message
398
+
399
+ Conditions on belongs_to are now observed (only eligible records
400
+ are in the menu)
401
+
402
+ New <ErrorMessages> template tag - like the error_messages_for
403
+ helper with added Hobo goodness.
404
+
405
+
406
+ Tag library: Rapid navigation
407
+
408
+ <page_nav> now hides without errors if there is no @pages object
409
+
410
+ <nav_item> now ignores nested tags when selecting the current nav
411
+ item.
412
+
413
+
414
+ Tag library: Rapid pages
415
+
416
+ Significant re-factoring of all page tags -- see source :-)
417
+
418
+ <javascript name="a, b, c"> tag - like helper javascript_include_tag
419
+
420
+ New pages <NotFoundPage> and <PermissionDeinedPage>
421
+
422
+
423
+ Tag library: Rapid support
424
+
425
+ <TablePlus> various new params
426
+
427
+
1
428
  === Release 0.6.2 ===
2
429
 
3
430
  Specs
@@ -24,7 +451,7 @@ Migration generator
24
451
  Now prompts for the name of the generated migration after the
25
452
  generated code is displayed.
26
453
 
27
- Better error message for invlaid field types declared in models.
454
+ Better error message for invalid field types declared in models.
28
455
 
29
456
 
30
457
  Tabla theme
@@ -257,9 +684,7 @@ Hobo Rapid
257
684
 
258
685
  <image> tag removed from default ajax progress.
259
686
 
260
-
261
-
262
-
687
+
263
688
 
264
689
  Dryml
265
690