<commit_before>#  install_generator.rb

module SimpleFormenhanced
  module Generators
    class InstallGenerator < ::Rails::Generators::Base

      source_root File.expand_path("../templates", __FILE__)
      desc "This generator installs Simple Form Enhanced"
      argument :language_type, :type => :string, :default => 'de', :banner => '*de or other language'
			class_option :template_engine, :default => 'erb', desc: 'Template engine to be invoked (erb, haml or slim).'

      def run_other_generators
        engine = options[:template_engine]
        if File.exist? "lib/templates/#{engine}/scaffold/_form.html.#{engine}"
          FileUtils.remove "lib/templates/#{engine}/scaffold/_form.html.#{engine}"
        end
        generate "simple_form:install --bootstrap"
      end

      def add_and_move_simple_form_language_files
        copy_file "#{language_type}.simple_form.yml", "config/locales/#{language_type}/#{language_type}.simple_form.yml"
        copy_file "#{language_type}.simple_form-i18n.yml", "config/locales/#{language_type}/#{language_type}.simple_form-i18n.yml"
        FileUtils.move "config/locales/simple_form.en.yml", "config/locales/en/en.simple_form.yml"
      end

			def copy_scaffold_template
        engine = options[:template_engine]
        # if File.exist? "lib/templates/#{engine}/scaffold/_form.html.#{engine}"
        #   FileUtils.remove "lib/templates/#{engine}/scaffold/_form.html.#{engine}"
        #   copy_file "#{engine}/_form.html.#{engine}", "lib/templates/#{engine}/scaffold/_form.html.#{engine}"
        # end
        copy_file "#{engine}/edit.html.#{engine}", "lib/templates/#{engine}/scaffold/edit.html.#{engine}"
        if File.exist? "lib/templates/#{engine}/scaffold/index.html.#{engine}"
          FileUtils.remove "lib/templates/#{engine}/scaffold/index.html.#{engine}"
          copy_file "#{engine}/index.html.#{engine}", "lib/templates/#{engine}/scaffold/index.html.#{engine}"
          if File.exist? "app/assets/javascripts/datatable.js.coffee"
            insert_into_file "lib/templates/#{engine}/scaffold/index.html.#{engine}", :after => "<table" do 
              " class=\"datatable display\""
            end
          end
        end
        copy_file "#{engine}/new.html.#{engine}", "lib/templates/#{engine}/scaffold/new.html.#{engine}"
        if File.exist? "lib/templates/#{engine}/scaffold/show.html.#{engine}/"
          FileUtils.remove "lib/templates/#{engine}/scaffold/show.html.#{engine}/"
          copy_file "#{engine}/show.html.#{engine}", "lib/templates/#{engine}/scaffold/show.html.#{engine}"
        end
        if File.exist? "lib/templates/#{engine}/scaffold/_form.html.#{engine}" and File.exist? "app/inputs/date_picker_input.rb"
          FileUtils.remove "lib/templates/#{engine}/scaffold/_form.html.#{engine}"
          copy_file "#{engine}/_form.html.#{engine}", "lib/templates/#{engine}/scaffold/_form.html.#{engine}"
        end
        copy_file "#{engine}/_messages.html.#{engine}", "app/views/layouts/_messages.html.#{engine}"
      end
    end
  end
end<commit_msg>problem Show fixed<commit_after>#  install_generator.rb

module SimpleFormenhanced
  module Generators
    class InstallGenerator < ::Rails::Generators::Base

      source_root File.expand_path("../templates", __FILE__)
      desc "This generator installs Simple Form Enhanced"
      argument :language_type, :type => :string, :default => 'de', :banner => '*de or other language'
			class_option :template_engine, :default => 'erb', desc: 'Template engine to be invoked (erb, haml or slim).'

      def run_other_generators
        engine = options[:template_engine]
        if File.exist? "lib/templates/#{engine}/scaffold/_form.html.#{engine}"
          FileUtils.remove "lib/templates/#{engine}/scaffold/_form.html.#{engine}"
        end
        generate "simple_form:install --bootstrap"
      end

      def add_and_move_simple_form_language_files
        copy_file "#{language_type}.simple_form.yml", "config/locales/#{language_type}/#{language_type}.simple_form.yml"
        copy_file "#{language_type}.simple_form-i18n.yml", "config/locales/#{language_type}/#{language_type}.simple_form-i18n.yml"
        FileUtils.move "config/locales/simple_form.en.yml", "config/locales/en/en.simple_form.yml"
      end

			def copy_scaffold_template
        engine = options[:template_engine]
        # if File.exist? "lib/templates/#{engine}/scaffold/_form.html.#{engine}"
        #   FileUtils.remove "lib/templates/#{engine}/scaffold/_form.html.#{engine}"
        #   copy_file "#{engine}/_form.html.#{engine}", "lib/templates/#{engine}/scaffold/_form.html.#{engine}"
        # end
        copy_file "#{engine}/edit.html.#{engine}", "lib/templates/#{engine}/scaffold/edit.html.#{engine}"
        if File.exist? "lib/templates/#{engine}/scaffold/index.html.#{engine}"
          FileUtils.remove "lib/templates/#{engine}/scaffold/index.html.#{engine}"
          copy_file "#{engine}/index.html.#{engine}", "lib/templates/#{engine}/scaffold/index.html.#{engine}"
          if File.exist? "app/assets/javascripts/datatable.js.coffee"
            insert_into_file "lib/templates/#{engine}/scaffold/index.html.#{engine}", :after => "<table" do 
              " class=\"datatable display\""
            end
          end
        end
        copy_file "#{engine}/new.html.#{engine}", "lib/templates/#{engine}/scaffold/new.html.#{engine}"
        if File.exist? "lib/templates/#{engine}/scaffold/show.html.#{engine}"
          gsub_file "lib/templates/#{engine}/scaffold/show.html.#{engine}", "<p id=\"notice\"><%%= notice %></p>", "<%%= render \'layouts/messages\' %>"
        else
          copy_file "#{engine}/show.html.#{engine}", "lib/templates/#{engine}/scaffold/show.html.#{engine}"
        end
        if File.exist? "lib/templates/#{engine}/scaffold/_form.html.#{engine}" and File.exist? "app/inputs/date_picker_input.rb"
          FileUtils.remove "lib/templates/#{engine}/scaffold/_form.html.#{engine}"
          copy_file "#{engine}/_form.html.#{engine}", "lib/templates/#{engine}/scaffold/_form.html.#{engine}"
        end
        copy_file "#{engine}/_messages.html.#{engine}", "app/views/layouts/_messages.html.#{engine}"
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.16942613727696512, 'fraction_numerical': 0.0012859668863526765, 'mean_word_length': 3.317834836918806, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '980555', 'n_tokens_mistral': 1980, 'n_tokens_neox': 1989, 'n_words': 284}