Sha256: 935f89eae76393614858a8d1a8aa0fa6bc0ea3420a2dc8a274208664bb74ab6a

Contents?: true

Size: 1.07 KB

Versions: 6

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

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

      def self.exit_on_failure?
        true
      end

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

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

      def run_migrations
        run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]')) # rubocop:disable Layout/LineLength
        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

      def install_dependencies
        puts "\nTo complete the installation, please run:\nbin/rails generate solidus_brazilian_adaptations:install"
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
solidus_me-2.0.1 lib/generators/solidus_me/install/install_generator.rb
solidus_me-2.0.0 lib/generators/solidus_me/install/install_generator.rb
solidus_me-1.0.7 lib/generators/solidus_me/install/install_generator.rb
solidus_me-1.0.6 lib/generators/solidus_me/install/install_generator.rb
solidus_me-1.0.5 lib/generators/solidus_me/install/install_generator.rb
solidus_me-1.0.4 lib/generators/solidus_me/install/install_generator.rb