hobo 0.8 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES.txt CHANGED
@@ -1,3 +1,59 @@
1
+ === Hobo 0.8.1 ===
2
+
3
+ Fixes to generating and loading subsite controllers
4
+
5
+ Add Rails routing monkey-patch to hobo generator
6
+
7
+ Fixed deprecated use of ActiveSupport Dependencies module
8
+
9
+ Migration generator -- fix to mysql limit problem in Rails 2.1.1
10
+
11
+ Migration generator -- fixed bug with validation of filename input by user
12
+
13
+ New lifecycle semantics.
14
+
15
+ Lifecycle create and transition actions (blocks) now run *after* the create or transition, and not at all
16
+ if there are validation errors.
17
+
18
+ To create a key, you can no longer call lifecycle.generate_key in the action, as the key timestamp will not
19
+ be saved (record has already been saved)
20
+
21
+ Instead pass :new_key => true as an option to the create or transition, and access it in the block using
22
+ lifecycle.key
23
+
24
+ Fix usage of 'skip' on hidden-fields tag; wasn't comma-splitting input. Correctly skip search field in
25
+ table-plus search form.
26
+
27
+ Fix to viewable_by? helper
28
+
29
+ Partial fix #251 - add requirement that :id not be empty to resource routes
30
+
31
+ Fix for #256, generating user model not named 'User'
32
+
33
+ Maade request and app_name available by default
34
+
35
+ New user model method account_active? Default implementation is state == 'active' but this method is intended
36
+ as a hook that can be overridden as required.
37
+
38
+ On signup, the user is only logged in if user has #account_active?
39
+
40
+ Rapid generators -- fixes for form cancel links
41
+
42
+ Rapid generators -- added parameter to show-page
43
+
44
+ Fixes to in-place-editors
45
+
46
+ Allow more advanced default ordering options like 'lower(users.last_name), lower(users.first_name)'
47
+
48
+ Fixed typo in dryml-generator lifecycle pages
49
+
50
+ show-page generator -- fix to test for create permission
51
+
52
+ Rapid generators -- fix for show-page generator, when the 'owner' association that goes with the page's
53
+ collection cannot be found
54
+
55
+
56
+
1
57
  === Hobo 0.8 ===
2
58
 
3
59
  (There's a million changes in this release -- most of the fixes are *not* mentioned)
data/Manifest CHANGED
@@ -69,6 +69,7 @@ rails_generators/hobo/templates/application.dryml
69
69
  rails_generators/hobo/templates/dryml-support.js
70
70
  rails_generators/hobo/templates/guest.rb
71
71
  rails_generators/hobo/templates/initializer.rb
72
+ rails_generators/hobo/templates/patch_routing.rb
72
73
  rails_generators/hobo_front_controller/hobo_front_controller_generator.rb
73
74
  rails_generators/hobo_front_controller/templates/controller.rb
74
75
  rails_generators/hobo_front_controller/templates/functional_test.rb
@@ -121,6 +122,7 @@ rails_generators/hobo_user_model/templates/mailer.rb
121
122
  rails_generators/hobo_user_model/templates/model.rb
122
123
  rails_generators/hobo_user_model/templates/unit_test.rb
123
124
  rails_generators/hobo_user_model/USAGE
125
+ Rakefile
124
126
  README
125
127
  script/destroy
126
128
  script/generate
data/Rakefile ADDED
@@ -0,0 +1,116 @@
1
+ require 'rake'
2
+ require 'rake/rdoctask'
3
+ require 'rake/testtask'
4
+
5
+ load "tasks/generate_tag_reference.rb"
6
+
7
+ desc 'Default: run specs.'
8
+ task :default => :spec
9
+
10
+ desc 'Generate documentation for the Hobo plugin.'
11
+ Rake::RDocTask.new(:rdoc) do |rdoc|
12
+ rdoc.rdoc_dir = 'rdoc'
13
+ rdoc.title = 'Hobo'
14
+ rdoc.options << '--line-numbers' << '--inline-source'
15
+ rdoc.rdoc_files.include('README')
16
+ rdoc.rdoc_files.include('lib/**/*.rb')
17
+ end
18
+
19
+ require 'echoe'
20
+
21
+ Echoe.new('hobo') do |p|
22
+ p.author = "Tom Locke"
23
+ p.email = "tom@tomlocke.com"
24
+ p.summary = "The web app builder for Rails"
25
+ p.url = "http://hobocentral.net/"
26
+ p.project = "hobo"
27
+
28
+ p.changelog = "CHANGES.txt"
29
+ p.version = "0.8.1"
30
+
31
+ p.dependencies = [
32
+ 'hobosupport >=0.8.1',
33
+ 'hobofields >=0.8.1',
34
+ 'rails =2.1',
35
+ 'mislav-will_paginate >=2.2.1']
36
+ end
37
+
38
+
39
+
40
+
41
+ # --- RSpec --- #
42
+
43
+ # In rails 1.2, plugins aren't available in the path until they're loaded.
44
+ # Check to see if the rspec plugin is installed first and require
45
+ # it if it is. If not, use the gem version.
46
+ PLUGIN_DIR = File.dirname(__FILE__)
47
+
48
+ rspec_base = File.expand_path(PLUGIN_DIR + '/spec/rails_root/vendor/plugins/rspec/lib')
49
+ $LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base)
50
+ require '../hobo_spec/rails_root/vendor/plugins/rspec/lib/spec/rake/spectask'
51
+ require '../hobo_spec/rails_root/vendor/plugins/rspec/lib/spec/translator'
52
+
53
+ spec_prereq = :noop # File.exist?(File.join(PLUGIN_DIR, 'config', 'database.yml')) ? "db:test:prepare" : :noop
54
+ task :noop do
55
+ end
56
+
57
+ task :stats => "spec:statsetup"
58
+
59
+ SPEC_HOME = "#{PLUGIN_DIR}/../hobo_spec"
60
+
61
+ desc "Run all specs in spec directory (excluding plugin specs)"
62
+ Spec::Rake::SpecTask.new(:spec => spec_prereq) do |t|
63
+ t.spec_opts = ['--options', "\"#{SPEC_HOME}/spec.opts\""]
64
+ t.spec_files = FileList["#{SPEC_HOME}/unit/**/*_spec.rb"]
65
+ end
66
+
67
+ namespace :spec do
68
+ desc "Run all specs in spec directory with RCov (excluding plugin specs)"
69
+ Spec::Rake::SpecTask.new(:rcov) do |t|
70
+ t.spec_opts = ['--options', "\"#{SPEC_HOME}/spec.opts\""]
71
+ t.spec_files = FileList["#{SPEC_HOME}/unit/**/*_spec.rb"]
72
+ t.rcov = true
73
+ t.rcov_opts = ['--exclude', 'spec', '--rails']
74
+ end
75
+
76
+ desc "Print Specdoc for all specs (excluding plugin specs)"
77
+ Spec::Rake::SpecTask.new(:doc) do |t|
78
+ t.spec_opts = ["--format", "specdoc", "--dry-run"]
79
+ t.spec_files = FileList["#{SPEC_HOME}/unit/**/*_spec.rb"]
80
+ end
81
+
82
+ [:models, :controllers, :views, :helpers].each do |sub|
83
+ desc "Run the specs under spec/#{sub}"
84
+ Spec::Rake::SpecTask.new(sub => spec_prereq) do |t|
85
+ t.spec_opts = ['--options', "\"#{SPEC_HOME}/spec.opts\""]
86
+ t.spec_files = FileList["#{SPEC_HOME}/#{sub}/**/*_spec.rb"]
87
+ end
88
+ end
89
+
90
+ # Setup specs for stats
91
+ task :statsetup do
92
+ require 'code_statistics'
93
+ ::STATS_DIRECTORIES << %w(Model\ specs spec/models)
94
+ ::STATS_DIRECTORIES << %w(View\ specs spec/views)
95
+ ::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers)
96
+ ::STATS_DIRECTORIES << %w(Helper\ specs spec/views)
97
+ ::CodeStatistics::TEST_TYPES << "Model specs"
98
+ ::CodeStatistics::TEST_TYPES << "View specs"
99
+ ::CodeStatistics::TEST_TYPES << "Controller specs"
100
+ ::CodeStatistics::TEST_TYPES << "Helper specs"
101
+ ::STATS_DIRECTORIES.delete_if {|a| a[0] =~ /test/}
102
+ end
103
+
104
+ namespace :db do
105
+ namespace :fixtures do
106
+ desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y"
107
+ task :load => :environment do
108
+ require 'active_record/fixtures'
109
+ ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym)
110
+ (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(SPEC_HOME, 'fixtures', '*.{yml,csv}'))).each do |fixture_file|
111
+ Fixtures.create_fixtures("#{SPEC_HOME}/fixtures", File.basename(fixture_file, '.*'))
112
+ end
113
+ end
114
+ end
115
+ end
116
+ end
@@ -1,14 +1,16 @@
1
1
  <% each_controller do -%>
2
2
  <%
3
3
  form_fields = standard_fields :belongs_to, :has_many
4
+
5
+ cancel_to_show_page = linkable?(:show)
6
+ cancel_to_index_page = !cancel_to_index_page && linkable?(:index)
4
7
  -%>
5
8
  <def tag="form" for="<%= model.name %>">
6
9
  <form merge param="default">
7
10
  <error-messages/>
8
11
  <field-list fields="<%= form_fields * ', ' %>" param/>
9
12
  <div param="actions">
10
- <submit label="Save" param/>
11
- <do param="cancel">or <a param="cancel-link">Cancel</a></do>
13
+ <submit label="Save" param/><or-cancel param="cancel"/>
12
14
  </div>
13
15
  </form>
14
16
  </def>
@@ -20,7 +22,7 @@ form_fields = standard_fields :belongs_to, :has_many
20
22
  <form lifecycle="<%= creator.name %>">
21
23
  <field-list fields="<%= creator.parameters * ', ' %>" param/>
22
24
  <div param="actions">
23
- <submit label="<%= creator.name.titleize %>" param/><do param="back-link"> or <a>Cancel</a></do>
25
+ <submit label="<%= creator.name.titleize %>" param/><or-cancel param="cancel"/>
24
26
  </div>
25
27
  </form>
26
28
  </def>
@@ -33,7 +35,7 @@ form_fields = standard_fields :belongs_to, :has_many
33
35
  <input type="hidden" name="key" value="&this.lifecycle.provided_key" if="&this.lifecycle.provided_key"/>
34
36
  <field-list fields="<%= transition.parameters * ', ' %>" param/>
35
37
  <div param="actions">
36
- <submit label="<%= transition.name.titleize %>" param/><do param="back-link"> or <a>Cancel</a></do>
38
+ <submit label="<%= transition.name.titleize %>" param/><or-cancel param="cancel"/>
37
39
  </div>
38
40
  </form>
39
41
  </def>
@@ -75,9 +75,11 @@ show_fields = standard_fields(:belongs_to).*.to_s - [model.name_attribute, ma
75
75
  collection = model.dependent_collections.sort_by(&:to_s).first
76
76
  if collection
77
77
  collection_class = model.reflections[collection].klass
78
- owner = model.reverse_reflection(collection).name
79
- add_link = collection &&linkable?(collection_class, :"new_for_#{owner}")
80
- add_form = !add_link && linkable?(collection_class, :"create_for_#{owner}", :method => :post)
78
+ owner = model.reverse_reflection(collection)._?.name
79
+ if owner
80
+ add_link = collection &&linkable?(collection_class, :"new_for_#{owner}")
81
+ add_form = !add_link && linkable?(collection_class, :"create_for_#{owner}", :method => :post)
82
+ end
81
83
  end
82
84
  -%>
83
85
  <def tag="show-page" for="<%= model.name %>">
@@ -110,7 +112,7 @@ end
110
112
 
111
113
  <section param="content-body">
112
114
  <% if main_content -%>
113
- <view:<%= main_content %>/>
115
+ <view:<%= main_content %> param="primary-content"/>
114
116
  <% end -%>
115
117
  <% if show_fields.any? -%>
116
118
  <field-list fields="<%= show_fields * ', ' %>" param/>
@@ -126,12 +128,12 @@ end
126
128
  <% end -%>
127
129
  <% if add_link -%>
128
130
 
129
- <a:<%= collection %> action="new" if="&can_create?" param="new-link">New <%= collection.to_s.singularize.titleize %></a>
131
+ <a:<%= collection %> action="new" if="&can_create?(@<%= model_name.underscore %>.<%= collection %>)" param="new-link">New <%= collection.to_s.singularize.titleize %></a>
130
132
  <% elsif add_form -%>
131
133
 
132
134
  <section param="add-to-collection" if="&can_create?(@<%= model_name.underscore %>.<%= collection %>)">
133
135
  <h3 param="add-form-heading">Add <%= a_or_an collection.to_s.singularize.titleize %></h3>
134
- <form with="&@<%= collection_class.name.underscore %> || @<%= model_name.underscore %>.<%= collection %>.new" owner="<%= owner %>" method="post" without-or-cancel param>
136
+ <form with="&@<%= collection_class.name.underscore %> || @<%= model_name.underscore %>.<%= collection %>.new" owner="<%= owner %>" method="post" without-cancel param>
135
137
  <field-list: skip="<%= owner %>"/>
136
138
  <submit: label="Add"/>
137
139
  </form>
@@ -263,7 +265,7 @@ new_link = :new.in?(actions)
263
265
  <def tag="<%= transition.dasherize %>-page" for="<%= model.name %>">
264
266
  <page title="<%= transition.titleize %>" merge>
265
267
 
266
- <body: class="lifecycle-transition-page #{transition.dasherize}-page" param/>
268
+ <body: class="lifecycle-transition-page <%= transition.dasherize -%>-page" param/>
267
269
 
268
270
  <content:>
269
271
  <header param="content-header">