class CdmMigrator::InstallGenerator

Public Instance Methods

inject_content_dm_yml() click to toggle source
# File lib/generators/cdm_migrator/install/install_generator.rb, line 67
def inject_content_dm_yml
  copy_file("config/cdm_migrator.yml", "config/cdm_migrator.yml") unless File.file?("config/cdm_migrator.yml")
end
inject_menu_presenter() click to toggle source
# File lib/generators/cdm_migrator/install/install_generator.rb, line 43
def inject_menu_presenter
        hyku_file_path = "app/presenters/hyku/menu_presenter.rb"
        hyrax_file_path = "app/presenters/hyrax/menu_presenter.rb"
        if File.file?(hyku_file_path) && File.readlines(hyku_file_path).join.include?("cdm_migrator_section")
             insert_into_file hyku_file_path, :after => /def settings_section\?\n.*\(controller_name\)\n[ \t]*end/ do
                       "\n\n" \
                       "    def cdm_migrator_section?\n" \
                       "      %w[cdm csv].include?(controller_name)\n" \
                       "    end\n"
             end
        elsif File.file?(hyrax_file_path) && File.readlines(hyrax_file_path).join.include?("cdm_migrator_section")
             insert_into_file hyrax_file_path, :after => /def settings_section\?\n.*\(controller_name\)\n[ \t]*end/ do
                       "\n\n" \
                       "    def cdm_migrator_section?\n" \
                       "      %w[cdm csv].include?(controller_name)\n" \
                       "    end\n"
             end
        elsif Hyku
             copy_file "presenters/hyku/menu_presenter.rb", "app/presenters/hyku/menu_presenter.rb"
        elsif Hyrax
             copy_file "presenters/hyrax/menu_presenter.rb", "app/presenters/hyrax/menu_presenter.rb"
        end
end
inject_stylesheets() click to toggle source
# File lib/generators/cdm_migrator/install/install_generator.rb, line 71
def inject_stylesheets
  css_file_path = "app/assets/stylesheets/application.css"
  copy_file("stylesheets/csv_checker.css", "app/assets/stylesheets/csv_checker.css") unless File.file?("app/assets/styelsheets/csv_checker.css")
  insert_into_file css_file_path, :before => " *= require_self\n" do
    " *= require csv_checker\n "
  end
end