Skip to content

Commit

Permalink
Fixes refinery#1897 by defining generator_command in all generators.
Browse files Browse the repository at this point in the history
  • Loading branch information
parndt committed Aug 26, 2012
1 parent 25b6213 commit ac1c68f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
4 changes: 4 additions & 0 deletions core/lib/generators/refinery/engine/engine_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ def generate

protected

def generator_command
'rails generate refinery:engine'
end

def reject_file_with_skip_frontend?(file)
(skip_frontend? && (file.to_s.include?('app') && file.to_s.scan(/admin|models|mailers/).empty?)) ||
reject_file_without_skip_frontend?(file)
Expand Down
10 changes: 6 additions & 4 deletions core/lib/generators/refinery/form/form_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ def description
"Generates an extension which is set up for frontend form submissions like a contact page."
end

def generator_command
'rails generate refinery:form'
end

def generate
sanity_check!

Expand All @@ -29,5 +25,11 @@ def generate
finalize_extension!
end

protected

def generator_command
'rails generate refinery:form'
end

end
end
9 changes: 7 additions & 2 deletions core/lib/refinery/extension_generation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ def gemfile
end
end

def generator_command
raise "You must override the method 'generator_command' in your generator."
end

def merge_locales!
if existing_extension?
# go through all of the temporary files and merge what we need into the current files.
Expand Down Expand Up @@ -304,11 +308,12 @@ def sanity_check!
else
"Please specify the singular name '#{singular_name.singularize}' instead of '#{plural_name}'."
end
exit_with_message!(message)
exit_with_message! message
end

if attributes.empty? && self.behavior != :revoke
exit_with_message!("You must specify a name and at least one field. For help: #{generator_command}")
exit_with_message! "You must specify a name and at least one field." \
"\nFor help, run: #{generator_command}"
end
end

Expand Down

0 comments on commit ac1c68f

Please sign in to comment.