hobo 2.1.2 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/VERSION +1 -1
- data/app/helpers/hobo_route_helper.rb +5 -1
- data/lib/generators/hobo/controller.rb +0 -4
- data/lib/generators/hobo/routes/router.rb +4 -4
- data/lib/generators/hobo/setup_wizard/setup_wizard_generator.rb +0 -22
- data/lib/generators/hobo/subsite.rb +0 -4
- data/lib/generators/hobo/user_mailer/user_mailer_generator.rb +0 -4
- data/lib/generators/hobo/user_model/templates/model_injection.rb.erb +4 -4
- data/lib/hobo/controller/model.rb +4 -4
- data/lib/hobo/model.rb +2 -2
- data/lib/hobo/model/accessible_associations.rb +2 -2
- data/lib/hobo/model/find_for.rb +3 -3
- data/lib/hobo/model/include_in_save.rb +1 -1
- data/lib/hobo/model/lifecycles/actions.rb +1 -1
- data/lib/hobo/model/lifecycles/creator.rb +1 -1
- data/lib/hobo/model/lifecycles/transition.rb +1 -1
- data/lib/hobo/model/permissions.rb +7 -7
- data/lib/hobo/model/scopes/automatic_scopes.rb +1 -1
- data/lib/hobo/rapid/generators/rapid/cards.dryml.erb +1 -1
- data/lib/hobo/rapid/generators/rapid/pages.dryml.erb +7 -7
- metadata +7 -11
- data/lib/generators/hobo/test_framework/USAGE +0 -2
- data/lib/generators/hobo/test_framework/test_framework_generator.rb +0 -72
- data/lib/generators/hobo/test_options.rb +0 -19
- data/test/irt/generators/test_framework.irt +0 -59
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a47131d7bc70b7def777c284c85589c4157315ae
|
4
|
+
data.tar.gz: 7c36ca7f61f274d6cdf1b3e50eab85d32344d3c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91991f1e78d2bd243125fbaddb4d43622aad3f176b07a4e8e5f3e33e8ff7f8a5d86f9a6f3f8135ae97525de3b591bdb4a01f793c995ec3ccc648812d4ca52a25
|
7
|
+
data.tar.gz: 64a86d4866dbe794894f078300b869c5518b3746aa57e334d7d63061be94a4bb77b54b114c0824a001f6f3fe8d87f14ccc22687dd75dd2619bf2ce4b1b53cccb
|
data/Gemfile
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
3
|
gem 'rubydoctest', :git => 'git://github.com/bryanlarsen/rubydoctest.git'
|
4
|
-
gem 'rails', '4.
|
4
|
+
gem 'rails', '4.2.4'
|
5
|
+
gem 'responders', '~> 2.0'
|
5
6
|
gem 'protected_attributes'
|
6
7
|
gemspec :path => "../dryml"
|
7
8
|
gemspec :path => "../hobo_support"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.2.0
|
@@ -56,7 +56,8 @@ module HoboRouteHelper
|
|
56
56
|
owner_name = refl.name.to_s
|
57
57
|
owner_name = owner_name.singularize if refl.macro == :has_many
|
58
58
|
poly = [owner_name, obj.member_class]
|
59
|
-
params[:"#{owner_name}_id"] = obj.origin
|
59
|
+
params[:"#{owner_name}_id"] = obj.origin.id
|
60
|
+
params = params.symbolize_keys
|
60
61
|
action = "#{action}_for_#{owner_name}"
|
61
62
|
else
|
62
63
|
poly = [obj.member_class]
|
@@ -85,6 +86,9 @@ module HoboRouteHelper
|
|
85
86
|
rescue ActionController::RoutingError => e # raised if recognize_path fails
|
86
87
|
logger.info("recognize_path has failed: #{e.message}")
|
87
88
|
nil
|
89
|
+
rescue ActionController::UrlGenerationError => e # error that inherits from ActionController::RoutingError
|
90
|
+
logger.info("UrlGenerationError: #{e.message}")
|
91
|
+
nil
|
88
92
|
end
|
89
93
|
|
90
94
|
end
|
@@ -102,8 +102,8 @@ module Generators
|
|
102
102
|
raise ::Hobo::Error, "Hob routing error -- can't find reverse association for #{model}##{owner} " +
|
103
103
|
"(e.g. the :has_many that corresponds to a :belongs_to)" if collection_refl.nil?
|
104
104
|
collection = collection_refl.name
|
105
|
-
owner_class = model.reflections[owner].klass.name.underscore
|
106
|
-
owner = owner.to_s.singularize if model.reflections[owner].macro == :has_many
|
105
|
+
owner_class = model.reflections[owner.to_s].klass.name.underscore
|
106
|
+
owner = owner.to_s.singularize if model.reflections[owner.to_s].macro == :has_many
|
107
107
|
collection_path = "#{owner_class.pluralize}/:#{owner}_id/#{collection}"
|
108
108
|
|
109
109
|
routes = []
|
@@ -167,8 +167,8 @@ module Generators
|
|
167
167
|
raise ::Hobo::Error, "Hob routing error -- can't find reverse association for #{model}##{owner} " +
|
168
168
|
"(e.g. the :has_many that corresponds to a :belongs_to)" if collection_refl.nil?
|
169
169
|
collection = collection_refl.name
|
170
|
-
owner_class = model.reflections[owner].klass.name.underscore
|
171
|
-
owner = owner.to_s.singularize if model.reflections[owner].macro == :has_many
|
170
|
+
owner_class = model.reflections[owner.to_s].klass.name.underscore
|
171
|
+
owner = owner.to_s.singularize if model.reflections[owner.to_s].macro == :has_many
|
172
172
|
collection_path = "#{owner_class.pluralize}/:#{owner}_id/#{collection}"
|
173
173
|
|
174
174
|
actions.each do |action|
|
@@ -150,28 +150,6 @@ EOI
|
|
150
150
|
gem_with_comments('hobo_will_paginate', :comments => "\n# Hobo's version of will_paginate is required.")
|
151
151
|
end
|
152
152
|
|
153
|
-
def choose_test_framework
|
154
|
-
if wizard?
|
155
|
-
say_title 'Test Framework'
|
156
|
-
return unless yes_no? "Do you want to customize the test_framework?"
|
157
|
-
require 'generators/hobo/test_framework/test_framework_generator'
|
158
|
-
f = Hobo::TestFrameworkGenerator::FRAMEWORKS * '|'
|
159
|
-
test_framework = choose("Choose your preferred test framework: [<enter>=#{f}]:", /^(#{f})$/, 'test_unit')
|
160
|
-
fixtures = yes_no?("Do you want the test framework to generate the fixtures?")
|
161
|
-
fixture_replacement = ask("Type your preferred fixture replacement or <enter> for no replacement:")
|
162
|
-
else
|
163
|
-
# return if it is all default so no invoke is needed
|
164
|
-
return if (options[:test_framework].to_s == 'test_unit' && options[:fixtures] && options[:fixture_replacement].blank?)
|
165
|
-
test_framework = options[:test_framework]
|
166
|
-
fixtures = options[:fixtures]
|
167
|
-
fixture_replacement = options[:fixture_replacement]
|
168
|
-
end
|
169
|
-
invoke 'hobo:test_framework', [test_framework],
|
170
|
-
:fixture_replacement => fixture_replacement,
|
171
|
-
:fixtures => fixtures,
|
172
|
-
:update => true
|
173
|
-
end
|
174
|
-
|
175
153
|
def front_controller
|
176
154
|
if wizard?
|
177
155
|
say_title 'Front Controller'
|
@@ -31,10 +31,6 @@ module Generators
|
|
31
31
|
application "# Hobo: the #{file_name} subsite loads #{file_name}.css & #{file_name}.js"
|
32
32
|
end
|
33
33
|
|
34
|
-
hook_for :test_framework, :as => :controller do | instance, controller_test |
|
35
|
-
instance.invoke controller_test, ["#{instance.name}_site"]
|
36
|
-
end
|
37
|
-
|
38
34
|
private
|
39
35
|
|
40
36
|
def subsite_name
|
@@ -25,9 +25,5 @@ module Hobo
|
|
25
25
|
template( 'activation.erb', File.join(mailer_dir, "activation.erb")) if options[:activation_email]
|
26
26
|
end
|
27
27
|
|
28
|
-
hook_for :test_framework, :as => :mailer do | instance, mailer |
|
29
|
-
instance.invoke mailer, ["#{instance.name}_mailer"]
|
30
|
-
end
|
31
|
-
|
32
28
|
end
|
33
29
|
end
|
@@ -44,7 +44,7 @@
|
|
44
44
|
:params => [:name, :email_address],
|
45
45
|
:new_key => true,
|
46
46
|
:become => :invited do
|
47
|
-
<%= class_name %>Mailer.invite(self, lifecycle.key).
|
47
|
+
<%= class_name %>Mailer.invite(self, lifecycle.key).deliver_now
|
48
48
|
end
|
49
49
|
|
50
50
|
transition :accept_invitation, { :invited => :active }, :available_to => :key_holder,
|
@@ -57,13 +57,13 @@
|
|
57
57
|
create :signup, :available_to => "Guest",
|
58
58
|
:params => [:name, :email_address, :password, :password_confirmation],
|
59
59
|
:become => :inactive, :new_key => true do
|
60
|
-
<%= class_name %>Mailer.activation(self, lifecycle.key).
|
60
|
+
<%= class_name %>Mailer.activation(self, lifecycle.key).deliver_now
|
61
61
|
end
|
62
62
|
|
63
63
|
transition :activate, { :inactive => :active }, :available_to => :key_holder
|
64
64
|
|
65
65
|
transition :request_password_reset, { :inactive => :inactive }, :new_key => true do
|
66
|
-
<%= class_name %>Mailer.activation(self, lifecycle.key).
|
66
|
+
<%= class_name %>Mailer.activation(self, lifecycle.key).deliver_now
|
67
67
|
end
|
68
68
|
|
69
69
|
<% else -%>
|
@@ -75,7 +75,7 @@
|
|
75
75
|
|
76
76
|
<% end -%>
|
77
77
|
transition :request_password_reset, { :active => :active }, :new_key => true do
|
78
|
-
<%= class_name %>Mailer.forgot_password(self, lifecycle.key).
|
78
|
+
<%= class_name %>Mailer.forgot_password(self, lifecycle.key).deliver_now
|
79
79
|
end
|
80
80
|
|
81
81
|
transition :reset_password, { :active => :active }, :available_to => :key_holder,
|
@@ -269,7 +269,7 @@ module Hobo
|
|
269
269
|
|
270
270
|
|
271
271
|
def auto_actions_for(owner, actions)
|
272
|
-
name = model.reflections[owner].macro == :has_many ? owner.to_s.singularize : owner
|
272
|
+
name = model.reflections[owner.to_s].macro == :has_many ? owner.to_s.singularize : owner
|
273
273
|
|
274
274
|
owner_actions[owner] ||= []
|
275
275
|
Array(actions).each do |action|
|
@@ -358,7 +358,7 @@ module Hobo
|
|
358
358
|
|
359
359
|
|
360
360
|
def find_instance(options={})
|
361
|
-
model.user_find(current_user, params[:id]
|
361
|
+
model.user_find(current_user, params[:id]) do |record|
|
362
362
|
yield record if block_given?
|
363
363
|
end
|
364
364
|
end
|
@@ -466,7 +466,7 @@ module Hobo
|
|
466
466
|
|
467
467
|
def find_owner_and_association(owner_association)
|
468
468
|
owner_name = name_of_auto_action_for(owner_association)
|
469
|
-
refl = model.reflections[owner_association]
|
469
|
+
refl = model.reflections[owner_association.to_s]
|
470
470
|
id = params["#{owner_name}_id"]
|
471
471
|
owner = refl.klass.find(id)
|
472
472
|
instance_variable_set("@#{owner_association}", owner)
|
@@ -474,7 +474,7 @@ module Hobo
|
|
474
474
|
end
|
475
475
|
|
476
476
|
def name_of_auto_action_for(owner_association)
|
477
|
-
model.reflections[owner_association].macro == :has_many ? owner_association.to_s.singularize : owner_association
|
477
|
+
model.reflections[owner_association.to_s].macro == :has_many ? owner_association.to_s.singularize : owner_association
|
478
478
|
end
|
479
479
|
|
480
480
|
# --- Action implementations --- #
|
data/lib/hobo/model.rb
CHANGED
@@ -155,7 +155,7 @@ module Hobo
|
|
155
155
|
options = args[1]
|
156
156
|
end
|
157
157
|
belongs_to_without_test_methods(name, *args, &block)
|
158
|
-
refl = reflections[name]
|
158
|
+
refl = reflections[name.to_s]
|
159
159
|
id_method = refl.options[:primary_key] || refl.klass.primary_key
|
160
160
|
if options[:polymorphic]
|
161
161
|
# TODO: the class lookup in _is? below is incomplete; a polymorphic association to an STI base class
|
@@ -259,7 +259,7 @@ module Hobo
|
|
259
259
|
|
260
260
|
|
261
261
|
def reverse_reflection(association_name)
|
262
|
-
refl = reflections[association_name.
|
262
|
+
refl = reflections[association_name.to_s] or raise "No reverse reflection for #{name}.#{association_name}"
|
263
263
|
return nil if refl.options[:conditions] || refl.options[:polymorphic]
|
264
264
|
|
265
265
|
if refl.macro == :has_many && (self_to_join = refl.through_reflection)
|
@@ -54,7 +54,7 @@ module Hobo
|
|
54
54
|
record.send(method, owner) if record.respond_to? method
|
55
55
|
end
|
56
56
|
else
|
57
|
-
owner.include_in_save(association_name, record) unless owner.class.reflections[association_name].options[:through]
|
57
|
+
owner.include_in_save(association_name, record) unless owner.class.reflections[association_name.to_s].options[:through]
|
58
58
|
end
|
59
59
|
else
|
60
60
|
# It's already a record
|
@@ -90,7 +90,7 @@ module Hobo
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def finder_for_belongs_to(record, name)
|
93
|
-
refl = record.class.reflections[name]
|
93
|
+
refl = record.class.reflections[name.to_s]
|
94
94
|
#conditions = ActiveRecord::Associations::BelongsToAssociation.new(record, refl).reflection.send(:conditions)
|
95
95
|
conditions = [[]]
|
96
96
|
conditions == [[]] || conditions == [[],[]] ? refl.klass : refl.klass.scoped(:conditions => conditions)
|
data/lib/hobo/model/find_for.rb
CHANGED
@@ -13,10 +13,10 @@ module Hobo
|
|
13
13
|
|
14
14
|
collection_name = $1.to_sym
|
15
15
|
anchor_association_name = $2.to_sym
|
16
|
-
if (refl = self.class.reflections[collection_name]) && refl.macro == :has_many
|
16
|
+
if (refl = self.class.reflections[collection_name.to_s]) && refl.macro == :has_many
|
17
17
|
# the association name matches (e.g. comment_for_...)
|
18
18
|
|
19
|
-
if (anchor_refl = refl.klass.reflections[anchor_association_name]) && anchor_refl.macro == :belongs_to
|
19
|
+
if (anchor_refl = refl.klass.reflections[anchor_association_name.to_s]) && anchor_refl.macro == :belongs_to
|
20
20
|
# the whole thing matches (e.g. comment_for_user)
|
21
21
|
|
22
22
|
|
@@ -52,7 +52,7 @@ module Hobo
|
|
52
52
|
|
53
53
|
def initialize(owner, name, collection, anchor_association)
|
54
54
|
@association = owner.send(collection)
|
55
|
-
@anchor_reflection = @association.member_class.reflections[anchor_association]
|
55
|
+
@anchor_reflection = @association.member_class.reflections[anchor_association.to_s]
|
56
56
|
@name = name
|
57
57
|
end
|
58
58
|
|
@@ -16,7 +16,7 @@ module Hobo
|
|
16
16
|
def validate_included_in_save
|
17
17
|
if included_in_save
|
18
18
|
included_in_save._?.each_pair do |association, records|
|
19
|
-
next if self.class.reflections[association].options[:validate]==false
|
19
|
+
next if self.class.reflections[association.to_s].options[:validate]==false
|
20
20
|
added = false
|
21
21
|
records.each do |record|
|
22
22
|
# we want to call valid? on each one, but only add the error to self once
|
@@ -31,7 +31,7 @@ module Hobo
|
|
31
31
|
who.detect { |w| publishable_by(user, w, record) }
|
32
32
|
|
33
33
|
else
|
34
|
-
refl = record.class.reflections[who]
|
34
|
+
refl = record.class.reflections[who.to_s]
|
35
35
|
if refl && refl.macro == :has_many
|
36
36
|
record.send(who).include?(user)
|
37
37
|
elsif refl && refl.macro == :belongs_to
|
@@ -31,7 +31,7 @@ module Hobo
|
|
31
31
|
params = options.fetch(:params, [])
|
32
32
|
allowed = params.dup
|
33
33
|
params.each do |p|
|
34
|
-
if (refl = model.reflections[p]) && refl.macro == :belongs_to
|
34
|
+
if (refl = model.reflections[p.to_s]) && refl.macro == :belongs_to
|
35
35
|
allowed << refl.foreign_key.to_s
|
36
36
|
allowed << refl.options[:foreign_type] if refl.options[:polymorphic]
|
37
37
|
end
|
@@ -24,7 +24,7 @@ module Hobo
|
|
24
24
|
params = options.fetch(:params, [])
|
25
25
|
allowed = params.dup
|
26
26
|
params.each do |p|
|
27
|
-
if (refl = model.reflections[p]) && refl.macro == :belongs_to
|
27
|
+
if (refl = model.reflections[p.to_s]) && refl.macro == :belongs_to
|
28
28
|
allowed << refl.foreign_key.to_s
|
29
29
|
allowed << refl.options[:foreign_type] if refl.options[:polymorphic]
|
30
30
|
end
|
@@ -81,7 +81,7 @@ module Hobo
|
|
81
81
|
|
82
82
|
def has_many_with_hobo_permission_check(association_id, *args, &extension)
|
83
83
|
has_many_without_hobo_permission_check(association_id, *args, &extension)
|
84
|
-
reflection = reflections[association_id]
|
84
|
+
reflection = reflections[association_id.to_s]
|
85
85
|
if reflection.options[:dependent]==:destroy
|
86
86
|
#overriding dynamic method created in ActiveRecord::Associations#configure_dependency_for_has_many
|
87
87
|
method_name = "has_many_dependent_destroy_for_#{reflection.name}".to_sym
|
@@ -93,7 +93,7 @@ module Hobo
|
|
93
93
|
|
94
94
|
def has_one_with_hobo_permission_check(association_id, *args, &extension)
|
95
95
|
has_one_without_hobo_permission_check(association_id, *args, &extension)
|
96
|
-
reflection = reflections[association_id]
|
96
|
+
reflection = reflections[association_id.to_s]
|
97
97
|
if reflection.options[:dependent]==:destroy
|
98
98
|
#overriding dynamic method created in ActiveRecord::Associations#configure_dependency_for_has_one
|
99
99
|
method_name = "has_one_dependent_destroy_for_#{reflection.name}".to_sym
|
@@ -108,7 +108,7 @@ module Hobo
|
|
108
108
|
|
109
109
|
def belongs_to_with_hobo_permission_check(association_id, *args, &extension)
|
110
110
|
belongs_to_without_hobo_permission_check(association_id, *args, &extension)
|
111
|
-
reflection = reflections[association_id]
|
111
|
+
reflection = reflections[association_id.to_s]
|
112
112
|
if reflection.options[:dependent]==:destroy
|
113
113
|
#overriding dynamic method created in ActiveRecord::Associations#configure_dependency_for_belongs_to
|
114
114
|
method_name = "belongs_to_dependent_destroy_for_#{reflection.name}".to_sym
|
@@ -244,7 +244,7 @@ module Hobo
|
|
244
244
|
# No setter = no edit permission
|
245
245
|
return false if !respond_to?("#{attribute}=")
|
246
246
|
|
247
|
-
refl = self.class.reflections[attribute.
|
247
|
+
refl = self.class.reflections[attribute.to_s]
|
248
248
|
if refl && refl.macro != :belongs_to # a belongs_to is handled the same as a regular attribute
|
249
249
|
return association_editable_by?(user, refl)
|
250
250
|
end
|
@@ -338,7 +338,7 @@ module Hobo
|
|
338
338
|
end
|
339
339
|
|
340
340
|
def with_attribute_or_belongs_to_keys(attribute)
|
341
|
-
if (refl = self.class.reflections[attribute.
|
341
|
+
if (refl = self.class.reflections[attribute.to_s]) && refl.macro == :belongs_to
|
342
342
|
if refl.options[:polymorphic]
|
343
343
|
yield refl.foreign_key, refl.options[:foreign_type]
|
344
344
|
else
|
@@ -386,7 +386,7 @@ module Hobo
|
|
386
386
|
end
|
387
387
|
end
|
388
388
|
|
389
|
-
if (refl = self.class.reflections[attr.
|
389
|
+
if (refl = self.class.reflections[attr.to_s]) && refl.macro == :belongs_to
|
390
390
|
# A belongs_to -- also unknownify the underlying fields
|
391
391
|
unknownify_attribute refl.foreign_key
|
392
392
|
unknownify_attribute refl.options[:foreign_type] if refl.options[:polymorphic]
|
@@ -429,7 +429,7 @@ module Hobo
|
|
429
429
|
|
430
430
|
metaclass.send :remove_method, attr
|
431
431
|
|
432
|
-
if (refl = self.class.reflections[attr]) && refl.macro == :belongs_to
|
432
|
+
if (refl = self.class.reflections[attr.to_s]) && refl.macro == :belongs_to
|
433
433
|
# A belongs_to -- restore the underlying fields
|
434
434
|
deunknownify_attribute refl.foreign_key
|
435
435
|
deunknownify_attribute(refl.options[:foreign_type], false) if refl.options[:polymorphic]
|
@@ -14,7 +14,7 @@ creator_attribute = model.creator_attribute
|
|
14
14
|
primary_collection = model.view_hints.primary_children
|
15
15
|
|
16
16
|
if creator_attribute
|
17
|
-
creator_refl = model.reflections[creator_attribute]
|
17
|
+
creator_refl = model.reflections[creator_attribute.to_s]
|
18
18
|
creator_link = creator_refl && linkable?(creator_refl.klass, :show)
|
19
19
|
end
|
20
20
|
|
@@ -105,11 +105,11 @@ model_key = model.to_s.underscore
|
|
105
105
|
|
106
106
|
<%
|
107
107
|
back_link = model.view_hints.parent
|
108
|
-
back_link_human_name = model.reflections[back_link] && model.reflections[back_link].klass unless back_link.blank?
|
108
|
+
back_link_human_name = model.reflections[back_link.to_s] && model.reflections[back_link.to_s].klass unless back_link.blank?
|
109
109
|
back_link_human_name = back_link_human_name && back_link_human_name.model_name.human
|
110
110
|
boolean_fields = model.table_exists? ? (model.columns.select { |c| c.type == :boolean }.*.name - model.view_hints.inline_booleans) : []
|
111
111
|
creator = model.creator_attribute
|
112
|
-
creator_link = creator && model.reflections[creator] && linkable?(model.reflections[creator].klass, :show)
|
112
|
+
creator_link = creator && model.reflections[creator.to_s] && linkable?(model.reflections[creator.to_s].klass, :show)
|
113
113
|
edit_link = linkable?(model, :edit)
|
114
114
|
main_content = model.primary_content_attribute
|
115
115
|
show_fields = standard_fields(:belongs_to).*.to_s - [model.name_attribute, main_content, creator, back_link, *boolean_fields].*.to_s
|
@@ -118,7 +118,7 @@ is_user_model = model < Hobo::Model::UserBase
|
|
118
118
|
|
119
119
|
collection = model.view_hints.primary_children
|
120
120
|
if collection
|
121
|
-
collection_class = model.reflections[collection].klass
|
121
|
+
collection_class = model.reflections[collection.to_s].klass
|
122
122
|
owner = model.reverse_reflection(collection)._?.name
|
123
123
|
if owner
|
124
124
|
add_link = collection && linkable?(collection_class, :"new_for_#{owner}")
|
@@ -127,7 +127,7 @@ if collection
|
|
127
127
|
end
|
128
128
|
|
129
129
|
unless model.view_hints.secondary_children.empty?
|
130
|
-
aside_collections = model.view_hints.secondary_children.map { |c| [model.reflections[c], model.reverse_reflection(c)] }
|
130
|
+
aside_collections = model.view_hints.secondary_children.map { |c| [model.reflections[c.to_s], model.reverse_reflection(c)] }
|
131
131
|
end
|
132
132
|
-%>
|
133
133
|
<def tag="show-page" for="<%= model.name %>">
|
@@ -261,14 +261,14 @@ name_attribute = model.name_attribute
|
|
261
261
|
|
262
262
|
<% controller.owner_actions.each_pair do |owner, actions| -%>
|
263
263
|
<%
|
264
|
-
collection_name = model.reverse_reflection(owner).name.to_s
|
265
|
-
owner_model = model.reflections[owner].klass
|
264
|
+
collection_name = model.reverse_reflection(owner.to_s).name.to_s
|
265
|
+
owner_model = model.reflections[owner.to_s].klass
|
266
266
|
linkable_owner = linkable?(owner_model, :show)
|
267
267
|
owner_tag = linkable_owner ? "a" : "name"
|
268
268
|
|
269
269
|
owner_is_user = owner_model < Hobo::Model::UserBase
|
270
270
|
|
271
|
-
owner = model.reflections[owner].macro == :has_many ? owner.to_s.singularize : owner.to_s
|
271
|
+
owner = model.reflections[owner.to_s].macro == :has_many ? owner.to_s.singularize : owner.to_s
|
272
272
|
-%>
|
273
273
|
<% if :index.in? actions -%>
|
274
274
|
<%
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hobo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Locke
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.2.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: hobo_fields
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.
|
33
|
+
version: 2.2.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.
|
40
|
+
version: 2.2.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: dryml
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.
|
47
|
+
version: 2.2.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 2.
|
54
|
+
version: 2.2.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: hobo_will_paginate
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -231,9 +231,6 @@ files:
|
|
231
231
|
- lib/generators/hobo/subsite_taglib/subsite_taglib_generator.rb
|
232
232
|
- lib/generators/hobo/subsite_taglib/templates/taglib.dryml.erb
|
233
233
|
- lib/generators/hobo/taglib.rb
|
234
|
-
- lib/generators/hobo/test_framework/USAGE
|
235
|
-
- lib/generators/hobo/test_framework/test_framework_generator.rb
|
236
|
-
- lib/generators/hobo/test_options.rb
|
237
234
|
- lib/generators/hobo/user_controller/USAGE
|
238
235
|
- lib/generators/hobo/user_controller/templates/accept_invitation.dryml
|
239
236
|
- lib/generators/hobo/user_controller/templates/controller.rb.erb
|
@@ -322,7 +319,6 @@ files:
|
|
322
319
|
- test/irt/generators/resource.irt
|
323
320
|
- test/irt/generators/subsite.irt
|
324
321
|
- test/irt/generators/subsite_taglib.irt
|
325
|
-
- test/irt/generators/test_framework.irt
|
326
322
|
- test/irt/generators/user_controller.irt
|
327
323
|
- test/irt/generators/user_mailer.irt
|
328
324
|
- test/irt/generators/user_model.irt
|
@@ -1,72 +0,0 @@
|
|
1
|
-
require 'bundler/cli'
|
2
|
-
module Hobo
|
3
|
-
class TestFrameworkGenerator < Rails::Generators::NamedBase
|
4
|
-
|
5
|
-
include Generators::Hobo::TestOptions
|
6
|
-
|
7
|
-
FRAMEWORKS = %w[test_unit rspec shoulda rspec_with_shoulda]
|
8
|
-
|
9
|
-
def self.banner
|
10
|
-
"rails generate hobo:test_framework NAME [options]"
|
11
|
-
end
|
12
|
-
|
13
|
-
def initialize(*)
|
14
|
-
super
|
15
|
-
@finalize_hooks = []
|
16
|
-
end
|
17
|
-
|
18
|
-
def setup_framework
|
19
|
-
if FRAMEWORKS.include?(name)
|
20
|
-
eval 'setup_' + name
|
21
|
-
else
|
22
|
-
say "'#{name}' is not supported. You should configure it manually."
|
23
|
-
exit 1
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def fixture_replacement_installation
|
28
|
-
return if options[:fixture_replacement].blank?
|
29
|
-
gem options[:fixture_replacement], :group => :test
|
30
|
-
end
|
31
|
-
|
32
|
-
def finalize_installation
|
33
|
-
# add the block only if it's not the default
|
34
|
-
add_generators_block unless (name == 'test_unit' && options[:fixtures] && options[:fixture_replacement].blank?)
|
35
|
-
invoke(Bundler::CLI, :update, [], {}) if options[:update] && @should_update
|
36
|
-
@finalize_hooks.each {|h| h.call }
|
37
|
-
end
|
38
|
-
|
39
|
-
private
|
40
|
-
|
41
|
-
def setup_test_unit
|
42
|
-
end
|
43
|
-
|
44
|
-
def setup_rspec
|
45
|
-
gem 'rspec-rails', '>= 2.5.0', :group => [:test, :development]
|
46
|
-
@should_update = true
|
47
|
-
return unless options[:update]
|
48
|
-
@finalize_hooks << lambda {say "Finalizing rspec installation..."; system 'rails g rspec:install'}
|
49
|
-
end
|
50
|
-
|
51
|
-
def setup_shoulda
|
52
|
-
gem 'shoulda', :group => :test
|
53
|
-
@should_update = true
|
54
|
-
end
|
55
|
-
|
56
|
-
def setup_rspec_with_shoulda
|
57
|
-
setup_rspec
|
58
|
-
setup_shoulda
|
59
|
-
end
|
60
|
-
|
61
|
-
def add_generators_block
|
62
|
-
n = name == 'rspec_with_shoulda' ? 'rspec' : name
|
63
|
-
block = "\n config.generators do |g|"
|
64
|
-
block << "\n g.test_framework :#{n}, :fixtures => #{options[:fixtures].inspect}" if !options[:fixtures] || name != 'test_unit'
|
65
|
-
block << "\n g.fallbacks[:#{n}] = :test_unit" unless name == 'test_unit'
|
66
|
-
block << "\n g.fixture_replacement = :#{options[:fixture_replacement]}" unless options[:fixture_replacement].blank?
|
67
|
-
block << "\n end\n"
|
68
|
-
environment block
|
69
|
-
end
|
70
|
-
|
71
|
-
end
|
72
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Generators
|
2
|
-
module Hobo
|
3
|
-
TestOptions = classy_module do
|
4
|
-
|
5
|
-
class_option :test_framework, :type => :string,
|
6
|
-
:desc => "Use a specific test framework"
|
7
|
-
|
8
|
-
class_option :fixtures, :type => :boolean,
|
9
|
-
:desc => "Add the fixture option to the test framework", :default => true
|
10
|
-
|
11
|
-
class_option :fixture_replacement, :type => :string,
|
12
|
-
:desc => "Use a specific fixture replacement"
|
13
|
-
|
14
|
-
class_option :update, :type => :boolean,
|
15
|
-
:desc => "Run bundle update to install the missing gems"
|
16
|
-
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
desc "test_unit: default no-changes'"
|
2
|
-
invoke 'hobo:test_framework', %w(test_unit)
|
3
|
-
file_exclude? 'config/application.rb',
|
4
|
-
'config.generators do' ,
|
5
|
-
'test_framework :test_unit'
|
6
|
-
test_value_eql? true
|
7
|
-
|
8
|
-
git_reset_app
|
9
|
-
|
10
|
-
desc "test_unit: don't generate fixtures'"
|
11
|
-
invoke 'hobo:test_framework', %w(test_unit --no-fixtures)
|
12
|
-
file_include? 'config/application.rb',
|
13
|
-
'config.generators do' ,
|
14
|
-
'test_framework :test_unit, :fixtures => false'
|
15
|
-
test_value_eql? true
|
16
|
-
|
17
|
-
git_reset_app
|
18
|
-
|
19
|
-
desc "shoulda application.rb injection"
|
20
|
-
invoke 'hobo:test_framework', %w(shoulda --no-update -q)
|
21
|
-
file_include? 'config/application.rb',
|
22
|
-
'config.generators do' ,
|
23
|
-
'test_framework :shoulda, :fixtures => true'
|
24
|
-
test_value_eql? true
|
25
|
-
|
26
|
-
desc "shoulda Gemfile injection"
|
27
|
-
file_include? 'Gemfile', %(gem "shoulda", group: :test)
|
28
|
-
test_value_eql? true
|
29
|
-
|
30
|
-
git_reset_app
|
31
|
-
|
32
|
-
desc "rspec application.rb injection"
|
33
|
-
invoke 'hobo:test_framework', %w(rspec --no-update -q)
|
34
|
-
file_include? 'config/application.rb',
|
35
|
-
'config.generators do' ,
|
36
|
-
'test_framework :rspec, :fixtures => true',
|
37
|
-
'fallbacks[:rspec] = :test_unit'
|
38
|
-
test_value_eql? true
|
39
|
-
|
40
|
-
desc "rspec Gemfile injection"
|
41
|
-
file_include? 'Gemfile', %(gem "rspec-rails", ">= 2.5.0", group: [:test, :development])
|
42
|
-
test_value_eql? true
|
43
|
-
|
44
|
-
git_reset_app
|
45
|
-
|
46
|
-
desc "rspec_with_shoulda application.rb injection"
|
47
|
-
invoke 'hobo:test_framework', %w(rspec_with_shoulda --no-update -q)
|
48
|
-
file_include? 'config/application.rb',
|
49
|
-
'config.generators do' ,
|
50
|
-
'test_framework :rspec, :fixtures => true',
|
51
|
-
'fallbacks[:rspec] = :test_unit'
|
52
|
-
test_value_eql? true
|
53
|
-
|
54
|
-
desc "rspec_with_shoulda Gemfile injection"
|
55
|
-
file_include? 'Gemfile', %(gem "rspec-rails", ">= 2.5.0", group: [:test, :development]),
|
56
|
-
%(gem "shoulda", group: :test)
|
57
|
-
test_value_eql? true
|
58
|
-
|
59
|
-
|