From 39fd28fda72ae74dbf62d831d655c6445f6c8413 Mon Sep 17 00:00:00 2001 From: "Michael J. Giarlo" Date: Fri, 17 Jul 2015 13:44:34 -0700 Subject: [PATCH] Append MIME types in the install generator. Fixes #132 The install generator currently injects MIME types before every newline, which results in multiple MIME type registrations and lots of warnings in the console. This PR eliminates all the warnings and results in a tidier . Thanks to @jcoyne for the sleuthery on this one. --- hydra-core/lib/generators/hydra/head_generator.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hydra-core/lib/generators/hydra/head_generator.rb b/hydra-core/lib/generators/hydra/head_generator.rb index 78b71d2d7..b9fb6ea72 100644 --- a/hydra-core/lib/generators/hydra/head_generator.rb +++ b/hydra-core/lib/generators/hydra/head_generator.rb @@ -78,10 +78,10 @@ def create_configuration_files def create_conneg_configuration file_path = "config/initializers/mime_types.rb" - inject_into_file file_path, :before => /\Z/ do - "\nMime::Type.register \"application/n-triples\", :nt" + - "\nMime::Type.register \"application/json\", :jsonld" + - "\nMime::Type.register \"text/turtle\", :ttl" + append_to_file file_path do + "Mime::Type.register \"application/n-triples\", :nt\n" + + "Mime::Type.register \"application/json\", :jsonld\n" + + "Mime::Type.register \"text/turtle\", :ttl" end end