Sha256: c0f496897cbcecabc6daa84b92fe3fc60cbc1112233db16eb2a173966c31e007

Contents?: true

Size: 854 Bytes

Versions: 4

Compression:

Stored size: 854 Bytes

Contents

module SolidusI18n
  module Generators
    class InstallGenerator < Rails::Generators::Base
      class_option :auto_run_migrations, type: :boolean, default: true

      def add_javascripts
        append_file 'vendor/assets/javascripts/spree/backend/all.js',
          "//= require spree/backend/solidus_i18n\n"
        append_file 'vendor/assets/javascripts/spree/frontend/all.js',
          "//= require spree/frontend/solidus_i18n\n"
      end

      def add_migrations
        run 'bin/rake solidus_i18n:install:migrations'
      end

      def run_migrations
        if options[:auto_run_migrations] ||
          ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]'))
          run 'bin/rake db:migrate'
        else
          puts "Skiping rake db:migrate, don't forget to run it!"
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
solidus_i18n-1.3.0 lib/generators/solidus_i18n/install/install_generator.rb
solidus_i18n-1.2.0 lib/generators/solidus_i18n/install/install_generator.rb
solidus_i18n-1.1.0 lib/generators/solidus_i18n/install/install_generator.rb
solidus_i18n-1.0.0 lib/generators/solidus_i18n/install/install_generator.rb