Permalink
Browse files

Error out neatly when referenced constant could not be found for cust…

…om_user generator
  • Loading branch information...
1 parent 22c8f6e commit 6fce5194574e0775d4c943242334a41044ef0fcb @radar radar committed Jun 11, 2012
Showing with 9 additions and 0 deletions.
  1. +9 −0 core/lib/generators/spree/custom_user/custom_user_generator.rb
@@ -10,6 +10,15 @@ def self.source_paths
paths.flatten
end
+ def check_for_constant
+ begin
+ klass
+ rescue NameError
+ @shell.say "Couldn't find #{class_name}. Are you sure that this class exists within your application and is loaded?", :red
+ exit(1)
+ end
+ end
+
def generate
template 'migration.rb.tt', "db/migrate/#{Time.now.strftime("%Y%m%d%H%m%S")}_add_spree_fields_to_custom_user_table.rb"
template 'authentication_helpers.rb.tt', "lib/spree/authentication_helpers.rb"

0 comments on commit 6fce519

Please sign in to comment.