<commit_before>module SpreeI18n
  module Generators
    class InstallGenerator < Rails::Generators::Base
      def add_javascripts
        append_file "app/assets/javascripts/admin/all.js", "//= require admin/spree_i18n"
        append_file "app/assets/javascripts/store/all.js", "//= require store/spree_i18n"
      end

      def add_stylesheets
        inject_into_file "app/assets/stylesheets/admin/all.css", " *= require admin/spree_i18n\n",
          :before => /\*\//, :verbose => true
      end

      def add_migrations
        run 'rake railties:install:migrations FROM=spree_i18n'
      end

      def run_migrations
         res = ask "Would you like to run the migrations now? [Y/n]"
         if res == "" || res.downcase == "y"<commit_msg>Auto run migrations when installing the extension<commit_after>module SpreeI18n
  module Generators
    class InstallGenerator < Rails::Generators::Base
      class_option :auto_run_migrations, :type => :boolean, :default => true

      def add_javascripts
        append_file "app/assets/javascripts/admin/all.js", "//= require admin/spree_i18n"
        append_file "app/assets/javascripts/store/all.js", "//= require store/spree_i18n"
      end

      def add_stylesheets
        inject_into_file "app/assets/stylesheets/admin/all.css", " *= require admin/spree_i18n\n",
          :before => /\*\//, :verbose => true
      end

      def add_migrations
        run 'rake railties:install:migrations FROM=spree_i18n'
      end

      def run_migrations
         if options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask "Would you like to run the migrations now? [Y/n]")
{'fraction_non_alphanumeric': 0.11717791411042945, 'fraction_numerical': 0.012269938650306749, 'mean_word_length': 2.901913875598086, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '5996337', 'n_tokens_mistral': 534, 'n_tokens_neox': 522, 'n_words': 113}