Sha256: d501f317c3dc60516b4ea7c32854c78bbaf3395019e8ce5abe3c654110677a93

Contents?: true

Size: 865 Bytes

Versions: 15

Compression:

Stored size: 865 Bytes

Contents

# frozen_string_literal: true

module SolidusBactracs
  module Generators
    class InstallGenerator < Rails::Generators::Base
      class_option :auto_run_migrations, type: :boolean, default: false
      source_root File.expand_path('templates', __dir__)

      def copy_initializer
        template 'initializer.rb', 'config/initializers/solidus_bactracs.rb'
      end

      def add_migrations
        run 'bin/rails railties:install:migrations FROM=solidus_bactracs'
      end

      def run_migrations
        run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]'))
        if run_migrations
          run 'bin/rails db:migrate'
        else
          puts 'Skipping bin/rails db:migrate, don\'t forget to run it!' # rubocop:disable Rails/Output
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
solidus_bactracs-4.0.1 lib/generators/solidus_bactracs/install/install_generator.rb
solidus_bactracs-4.0.0 lib/generators/solidus_bactracs/install/install_generator.rb
solidus_bactracs-3.5.2 lib/generators/solidus_bactracs/install/install_generator.rb
solidus_bactracs-3.5.1 lib/generators/solidus_bactracs/install/install_generator.rb
solidus_bactracs-3.5.0 lib/generators/solidus_bactracs/install/install_generator.rb
solidus_bactracs-3.4.0 lib/generators/solidus_bactracs/install/install_generator.rb
solidus_bactracs-3.3.2 lib/generators/solidus_bactracs/install/install_generator.rb
solidus_bactracs-3.3.1 lib/generators/solidus_bactracs/install/install_generator.rb
solidus_bactracs-3.3.0 lib/generators/solidus_bactracs/install/install_generator.rb
solidus_bactracs-3.2.2 lib/generators/solidus_bactracs/install/install_generator.rb
solidus_bactracs-3.2.1 lib/generators/solidus_bactracs/install/install_generator.rb
solidus_bactracs-3.2.0 lib/generators/solidus_bactracs/install/install_generator.rb
solidus_bactracs-3.1.2 lib/generators/solidus_bactracs/install/install_generator.rb
solidus_bactracs-3.1.1 lib/generators/solidus_bactracs/install/install_generator.rb
solidus_bactracs-3.1.0 lib/generators/solidus_bactracs/install/install_generator.rb