hobo 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,6 +14,23 @@ likely to cause conflicts, so it is highly recommended that you have
14
14
  your code backed up and in a change control system such as git or
15
15
  subversion.
16
16
 
17
+ === Hobo 1.0.2 ===
18
+
19
+ This release is almost identical to 1.0.1 except that it updates the
20
+ version requirements to exclude Rails3. Hobo does not currently work
21
+ with Rails3, although we are working on it.
22
+
23
+ This release silences some warnings produced when running with Rails
24
+ 2.3.10.
25
+
26
+ This release contains preliminary support for Ruby 1.9.2, although you
27
+ may encounter problems if you use Single Type Inheritance (STI)
28
+ models.
29
+
30
+ A few very minor bug fixes have also been included. See the [github
31
+ log](https://github.com/tablatom/hobo/compare/v1.0.1...v1.0.2) for
32
+ more details.
33
+
17
34
  === Hobo 1.0.1 ===
18
35
 
19
36
  This version contains two speedups: one fix that reduces the number of
data/Rakefile CHANGED
@@ -59,8 +59,8 @@ Jeweler::Tasks.new do |gemspec|
59
59
  gemspec.executables = ['hobo']
60
60
  gemspec.default_executable = 'hobo'
61
61
  gemspec.rubyforge_project = "hobo"
62
- gemspec.add_dependency("rails", [">= 2.2.2"])
63
- gemspec.add_dependency("will_paginate", [">= 2.3.11"])
62
+ gemspec.add_dependency("rails", [">= 2.2.2", "< 3.0.0"])
63
+ gemspec.add_dependency("will_paginate", [">= 2.3.11", "~> 2"])
64
64
  gemspec.add_dependency("hobosupport", ["= #{Hobo::VERSION}"])
65
65
  gemspec.add_dependency("hobofields", ["= #{Hobo::VERSION}"])
66
66
  gemspec.files.include %w(tasks/environments.rake tasks/hobo_tasks.rake)
@@ -34,6 +34,7 @@ Contents
34
34
  >> $:.unshift File.join(File.expand_path(File.dirname(__FILE__)), '../../hobofields/lib')
35
35
  >> $:.unshift File.join(File.expand_path(File.dirname(__FILE__)), '../../hobosupport/lib')
36
36
  >> $:.unshift File.join(File.expand_path(File.dirname(__FILE__)), '../../hobo/lib')
37
+ >> gem 'will_paginate', '~> 2'
37
38
  >> require 'will_paginate'
38
39
  >> require 'will_paginate/finder'
39
40
  >> require 'hobosupport'
@@ -31,6 +31,7 @@ Contents
31
31
  >> $:.unshift File.join(File.expand_path(File.dirname(__FILE__)), '../../hobofields/lib')
32
32
  >> $:.unshift File.join(File.expand_path(File.dirname(__FILE__)), '../../hobosupport/lib')
33
33
  >> $:.unshift File.join(File.expand_path(File.dirname(__FILE__)), '../../hobo/lib')
34
+ >> gem 'will_paginate', '~> 2'
34
35
  >> require 'will_paginate'
35
36
  >> require 'will_paginate/finder'
36
37
  >> require 'hobosupport'
@@ -74,6 +74,7 @@ Some load path manipulation:
74
74
  And we'll require hobo:
75
75
  {.hidden}
76
76
 
77
+ >> gem 'will_paginate', '~> 2'
77
78
  >> require 'will_paginate'
78
79
  >> require 'will_paginate/finder'
79
80
  >> require 'hobosupport'
@@ -2,12 +2,17 @@
2
2
  require 'hobosupport'
3
3
  require 'hobofields'
4
4
  begin
5
+ gem 'will_paginate', '~> 2'
5
6
  require 'will_paginate'
6
7
  rescue MissingSourceFile
7
8
  # OK, Hobo won't do pagination then
8
9
  end
9
10
 
10
- ActiveSupport::Dependencies.load_paths |= [ File.dirname(__FILE__)]
11
+ if ActiveSupport::Dependencies.respond_to?(:autoload_paths)
12
+ ActiveSupport::Dependencies.autoload_paths |= [ File.dirname(__FILE__)]
13
+ else
14
+ ActiveSupport::Dependencies.load_paths |= [ File.dirname(__FILE__)]
15
+ end
11
16
 
12
17
  # Hobo can be installed in /vendor/hobo, /vendor/plugins/hobo, vendor/plugins/hobo/hobo, etc.
13
18
  ::HOBO_ROOT = File.expand_path(File.dirname(__FILE__) + "/..")
@@ -16,7 +21,7 @@ class HoboError < RuntimeError; end
16
21
 
17
22
  module Hobo
18
23
 
19
- VERSION = "1.0.1"
24
+ VERSION = "1.0.2"
20
25
 
21
26
  class PermissionDeniedError < RuntimeError; end
22
27
 
@@ -161,7 +166,11 @@ module Hobo
161
166
 
162
167
  HoboFields.never_wrap(Hobo::Undefined) if defined? HoboFields
163
168
 
164
- ActiveSupport::Dependencies.load_paths |= [ "#{RAILS_ROOT}/app/viewhints" ]
169
+ if ActiveSupport::Dependencies.respond_to?(:autoload_paths)
170
+ ActiveSupport::Dependencies.autoload_paths |= [ "#{RAILS_ROOT}/app/viewhints" ]
171
+ else
172
+ ActiveSupport::Dependencies.load_paths |= [ "#{RAILS_ROOT}/app/viewhints" ]
173
+ end
165
174
  end
166
175
 
167
176
  end
@@ -9,7 +9,11 @@ module Hobo
9
9
 
10
10
  array = params_hash_to_array(array_or_hash)
11
11
  array.map! do |record_hash_or_string|
12
- finder = association.member_class.scoped :conditions => association.conditions
12
+ if association.conditions.nil?
13
+ finder = association.member_class
14
+ else
15
+ finder = association.member_class.scoped :conditions => association.conditions
16
+ end
13
17
  find_or_create_and_update(owner, association_name, finder, record_hash_or_string) do |id|
14
18
  # The block is required to either locate find an existing record in the collection, or build a new one
15
19
  if id
@@ -117,7 +117,7 @@ module Hobo
117
117
 
118
118
 
119
119
  def digest(s)
120
- OpenSSL::Digest::Digest.digest('sha1', s)
120
+ OpenSSL::Digest::SHA1.hexdigest(s)
121
121
  end
122
122
 
123
123
 
@@ -24,45 +24,36 @@ module Hobo
24
24
 
25
25
  def self.def_state(name, on_enter)
26
26
  name = name.to_sym
27
- returning(Lifecycles::State.new(name, on_enter)) do |s|
28
- states[name] = s
29
- class_eval "def #{name}_state?; state_name == :#{name} end"
30
- end
27
+ class_eval "def #{name}_state?; state_name == :#{name} end"
28
+ states[name] = Lifecycles::State.new(name, on_enter)
31
29
  end
32
30
 
33
31
 
34
32
  def self.def_creator(name, on_create, options)
35
- name = name.to_sym
36
- returning(Creator.new(self, name, on_create, options)) do |creator|
37
-
38
- class_eval %{
39
- def self.#{name}(user, attributes=nil)
40
- create(:#{name}, user, attributes)
41
- end
42
- def self.can_#{name}?(user, attributes=nil)
43
- can_create?(:#{name}, user)
44
- end
45
- }
46
-
47
- end
33
+ class_eval %{
34
+ def self.#{name}(user, attributes=nil)
35
+ create(:#{name}, user, attributes)
36
+ end
37
+ def self.can_#{name}?(user, attributes=nil)
38
+ can_create?(:#{name}, user)
39
+ end
40
+ }
41
+ Creator.new(self, name.to_s, on_create, options)
48
42
  end
49
43
 
50
44
  def self.def_transition(name, start_state, end_states, on_transition, options)
51
- returning(Transition.new(self, name.to_s, start_state, end_states, on_transition, options)) do |t|
52
-
53
- class_eval %{
54
- def #{name}!(user, attributes=nil)
55
- transition(:#{name}, user, attributes)
56
- end
57
- def can_#{name}?(user, attributes=nil)
58
- can_transition?(:#{name}, user)
59
- end
60
- def valid_for_#{name}?
61
- valid_for_transition?(:#{name})
62
- end
63
- }
64
-
65
- end
45
+ class_eval %{
46
+ def #{name}!(user, attributes=nil)
47
+ transition(:#{name}, user, attributes)
48
+ end
49
+ def can_#{name}?(user, attributes=nil)
50
+ can_transition?(:#{name}, user)
51
+ end
52
+ def valid_for_#{name}?
53
+ valid_for_transition?(:#{name})
54
+ end
55
+ }
56
+ Transition.new(self, name.to_s, start_state, end_states, on_transition, options)
66
57
  end
67
58
 
68
59
  def self.state_names
@@ -57,7 +57,6 @@ module Hobo
57
57
 
58
58
  WillPaginate::Finder::ClassMethods.class_eval do
59
59
  def paginate_with_hobo_metadata(*args, &block)
60
- # using 'returning' here triggers a full load
61
60
  collection = paginate_without_hobo_metadata(*args, &block)
62
61
  collection.member_class = self
63
62
  collection.origin = try.proxy_owner
@@ -564,7 +564,7 @@ module Hobo
564
564
 
565
565
 
566
566
  def create_response(new_action, options={}, &b)
567
- flash_notice (ht( :"#{@this.class.name.pluralize.underscore}.messages.create.success", :default=>["The #{@this.class.name.titleize.downcase} was created successfully"])) if valid?
567
+ flash_notice (ht( :"#{@this.class.name.pluralize.underscore}.messages.create.success", :default=>["The #{@this.class.view_hints.model_name.downcase} was created successfully"])) if valid?
568
568
 
569
569
  response_block(&b) or
570
570
  if valid?
@@ -602,7 +602,7 @@ module Hobo
602
602
 
603
603
  def update_response(in_place_edit_field=nil, options={}, &b)
604
604
 
605
- flash_notice (ht(:"#{@this.class.name.pluralize.underscore}.messages.update.success", :default=>["Changes to the #{@this.class.name.titleize.downcase} were saved"])) if valid?
605
+ flash_notice (ht(:"#{@this.class.name.pluralize.underscore}.messages.update.success", :default=>["Changes to the #{@this.class.view_hints.model_name.downcase} were saved"])) if valid?
606
606
 
607
607
  response_block(&b) or
608
608
  if valid?
@@ -255,7 +255,7 @@ module Hobo
255
255
  type = klass.attr_type(field)
256
256
  if type.nil? #a virtual attribute from an SQL alias, e.g., 'total' from 'COUNT(*) AS total'
257
257
  colspec = "#{field}" # don't prepend the table name
258
- elsif type.respond_to?(:table_name) && (name = type.name_attribute)
258
+ elsif type.respond_to?(:name_attribute) && (name = type.name_attribute)
259
259
  include = field
260
260
  colspec = "#{type.table_name}.#{name}"
261
261
  else
@@ -13,7 +13,7 @@ module ActiveRecord
13
13
  private
14
14
 
15
15
  def method_missing(method, *args, &block)
16
- if respond_to?(method) && scopes.include?(method)
16
+ if scopes.include?(method)
17
17
  scopes[method].call(self, *args)
18
18
  else
19
19
  with_scope :find => proxy_options do
@@ -3,7 +3,11 @@ module Hobo
3
3
  class ViewHints
4
4
 
5
5
  def self.enable
6
- ActiveSupport::Dependencies.load_paths |= ["#{RAILS_ROOT}/app/viewhints"]
6
+ if ActiveSupport::Dependencies.respond_to?(:autoload_paths)
7
+ ActiveSupport::Dependencies.autoload_paths |= [ "#{RAILS_ROOT}/app/viewhints" ]
8
+ else
9
+ ActiveSupport::Dependencies.load_paths |= [ "#{RAILS_ROOT}/app/viewhints" ]
10
+ end
7
11
  end
8
12
 
9
13
  def self.setter(name, default=nil, &block)
@@ -102,8 +102,6 @@ AJAX based submission can be enabled by simply adding an `update` attribute. e.g
102
102
  <div part="comments"><collection:comments/></div>
103
103
  <form with="&Comment.new" update="comments"/>
104
104
 
105
- `<form>` support all of the standard ajax attributes.
106
-
107
105
  ### Additional Notes
108
106
 
109
107
  - Hobo automatically inserts an `auth_token` hidden field if forgery protection is enabled
@@ -112,6 +110,19 @@ AJAX based submission can be enabled by simply adding an `update` attribute. e.g
112
110
  validation error occurs.
113
111
 
114
112
  - `<form>` supports all of the standrd ajax attributes - (see the main taglib docs for Rapid Forms)
113
+
114
+ - `<form>` resets `last_if` if it does not have permission to display the form. The `<else>` clause may be used to display alternate content. For example:
115
+
116
+ <form>...</form>
117
+ <else>You do not have permission to edit this form</else>
118
+
119
+ or on a standard generated page using a default form:
120
+
121
+ <some-page>
122
+ <after-form:>
123
+ <else>You do not have permission to edit this form</else>
124
+ </after-form:>
125
+ </some-page>
115
126
 
116
127
  ### Attributes
117
128
 
@@ -992,8 +1003,8 @@ end
992
1003
  <input type="hidden" class="empty-input" id="#{param_name_for_this}" name="#{param_name_for_this}" value="" disabled="&(!this.empty? || minimum>0)" />
993
1004
  <fake-field-context fake-field="-1" context="&template">
994
1005
  <div param="empty-message">
995
- <ht key="#{this.class.class_name.tableize}.collection.empty_message">
996
- No <%= this.class.class_name.titleize.downcase.pluralize %>.
1006
+ <ht key="#{this.class.name.tableize}.collection.empty_message">
1007
+ No <%= this.class.name.titleize.downcase.pluralize %>.
997
1008
  </ht>
998
1009
  </div>
999
1010
  <div class="buttons">
@@ -36,7 +36,26 @@ Then in your pages you can call the tag like this
36
36
  </def>
37
37
 
38
38
 
39
- <!-- Renders a single item in a `<navigation>` menu. See [`<navigation`>](/api_tag_defs/navigation). -->
39
+ <!-- Renders a single item in a [`<navigation>`](/api_tag_defs/navigation).
40
+
41
+ `<nav-item>` is basically an [`<a>`](/api_tag_defs/a) tag wrapped in an `<li>` tag. The attributes for [`<a>`](/api_tag_defs/a) may all be used on this tag, and work the same way.
42
+
43
+ Example 1: explicit links. Note that we're using explicit routes for clarity. Named routes are better.
44
+
45
+ <navigation current="home">
46
+ <nav-item href="/">Home</nav-item>
47
+ <nav-item href="/logout">Logout</nav-item>
48
+ </navigation>
49
+
50
+ Example 2: navigation based on a collection of items. Each item will be transformed into a link as described in [`<a>`](/api_tag_defs/a).
51
+
52
+ <navigation with="&links">
53
+ <repeat>
54
+ <nav-item/>
55
+ </repeat>
56
+ </navigation>
57
+
58
+ -->
40
59
  <def tag="nav-item" attrs="name">
41
60
  <% body = parameters.default
42
61
  body = h(this.to_s) if body.blank?
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hobo
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 19
4
5
  prerelease: false
5
6
  segments:
6
7
  - 1
7
8
  - 0
8
- - 1
9
- version: 1.0.1
9
+ - 2
10
+ version: 1.0.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - Tom Locke
@@ -14,63 +15,85 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-06-01 00:00:00 +01:00
18
+ date: 2010-11-12 00:00:00 -05:00
18
19
  default_executable: hobo
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: rails
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 3
27
30
  segments:
28
31
  - 2
29
32
  - 2
30
33
  - 2
31
34
  version: 2.2.2
35
+ - - <
36
+ - !ruby/object:Gem::Version
37
+ hash: 7
38
+ segments:
39
+ - 3
40
+ - 0
41
+ - 0
42
+ version: 3.0.0
32
43
  type: :runtime
33
44
  version_requirements: *id001
34
45
  - !ruby/object:Gem::Dependency
35
46
  name: will_paginate
36
47
  prerelease: false
37
48
  requirement: &id002 !ruby/object:Gem::Requirement
49
+ none: false
38
50
  requirements:
39
51
  - - ">="
40
52
  - !ruby/object:Gem::Version
53
+ hash: 21
41
54
  segments:
42
55
  - 2
43
56
  - 3
44
57
  - 11
45
58
  version: 2.3.11
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ hash: 7
62
+ segments:
63
+ - 2
64
+ version: "2"
46
65
  type: :runtime
47
66
  version_requirements: *id002
48
67
  - !ruby/object:Gem::Dependency
49
68
  name: hobosupport
50
69
  prerelease: false
51
70
  requirement: &id003 !ruby/object:Gem::Requirement
71
+ none: false
52
72
  requirements:
53
73
  - - "="
54
74
  - !ruby/object:Gem::Version
75
+ hash: 19
55
76
  segments:
56
77
  - 1
57
78
  - 0
58
- - 1
59
- version: 1.0.1
79
+ - 2
80
+ version: 1.0.2
60
81
  type: :runtime
61
82
  version_requirements: *id003
62
83
  - !ruby/object:Gem::Dependency
63
84
  name: hobofields
64
85
  prerelease: false
65
86
  requirement: &id004 !ruby/object:Gem::Requirement
87
+ none: false
66
88
  requirements:
67
89
  - - "="
68
90
  - !ruby/object:Gem::Version
91
+ hash: 19
69
92
  segments:
70
93
  - 1
71
94
  - 0
72
- - 1
73
- version: 1.0.1
95
+ - 2
96
+ version: 1.0.2
74
97
  type: :runtime
75
98
  version_requirements: *id004
76
99
  description:
@@ -79,9 +102,8 @@ executables:
79
102
  - hobo
80
103
  extensions: []
81
104
 
82
- extra_rdoc_files:
83
- - LICENSE.txt
84
- - README
105
+ extra_rdoc_files: []
106
+
85
107
  files:
86
108
  - CHANGES.txt
87
109
  - LICENSE.txt
@@ -270,23 +292,27 @@ rdoc_options:
270
292
  require_paths:
271
293
  - lib
272
294
  required_ruby_version: !ruby/object:Gem::Requirement
295
+ none: false
273
296
  requirements:
274
297
  - - ">="
275
298
  - !ruby/object:Gem::Version
299
+ hash: 3
276
300
  segments:
277
301
  - 0
278
302
  version: "0"
279
303
  required_rubygems_version: !ruby/object:Gem::Requirement
304
+ none: false
280
305
  requirements:
281
306
  - - ">="
282
307
  - !ruby/object:Gem::Version
308
+ hash: 3
283
309
  segments:
284
310
  - 0
285
311
  version: "0"
286
312
  requirements: []
287
313
 
288
314
  rubyforge_project: hobo
289
- rubygems_version: 1.3.6
315
+ rubygems_version: 1.3.7
290
316
  signing_key:
291
317
  specification_version: 3
292
318
  summary: The web app builder for Rails