Skip to content

Commit

Permalink
Trivial tweak of rich_cms_content_generator.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Engel committed Feb 5, 2011
1 parent 4f42f4f commit c7cd70a
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -8,7 +8,7 @@ def manifest
record do |m|
m.directory "app/models"
m.template "model.rb" , "app/models/#{model_file_name}.rb"
m.template "config.rb" , "config/initializers/enrichments.rb", {:collision => :skip}
m.file "config.rb" , "config/initializers/enrichments.rb", {:collision => :skip}
m.migration_template "migration.rb", "db/migrate", :migration_file_name => migration_file_name
end
end
Expand All @@ -17,9 +17,11 @@ def after_generate
filename = destination_path("config/initializers/enrichments.rb")
line = "\nRich::Cms::Engine.register(\".#{model_file_name}\", {:class_name => \"#{model_class_name}\"})"

return if File.open(filename).readlines.collect(&:strip).include? line.strip

File.open(filename, "a+") do |file|
file << line
end unless File.open(filename).readlines.collect(&:strip).include? line.strip
end

system "rake db:migrate" if options[:migrate]
end
Expand Down

0 comments on commit c7cd70a

Please sign in to comment.