Skip to content

Commit

Permalink
Delete the vendor/engines/<engine> directory when it's completely emp…
Browse files Browse the repository at this point in the history
…ty after destroying the extension.
  • Loading branch information
parndt committed Feb 2, 2012
1 parent d9b2e10 commit dfcd72c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/lib/generators/refinery/engine/engine_generator.rb
Expand Up @@ -76,7 +76,7 @@ def generate
exit(1)
end

unless attributes.empty? and self.behavior != :revoke
if attributes.any? || self.behavior == :revoke
Pathname.glob(Pathname.new(self.class.source_root).join('**', '**')).reject{|f| f.directory? or reject_file?(f) }.sort.each do |path|
unless (engine_path = engine_path_for(path, engine_name)).nil?
template path, engine_path
Expand Down Expand Up @@ -136,6 +136,12 @@ def generate
puts "rake db:migrate"
puts "------------------------"
end
else
engine_path = destination_pathname.join('vendor', 'engines', engine_plural_name)
if Pathname.glob(engine_path.join('**', '*')).all?(&:directory?)
say_status :remove, relative_to_original_destination_root(engine_path.to_s), true
FileUtils.rm_rf engine_path unless options[:pretend]
end
end
else
puts "You must specify at least one field. For help: rails generate refinery:engine"
Expand Down

0 comments on commit dfcd72c

Please sign in to comment.