Sha256: 3a0fbcd212e2ed64e3a3220adddff56c36c3a892c9fb440ee84a1e0cd92d0f08

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

module SolidusBling
  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_bling.rb"
      end

      def add_migrations
        run "bin/rails railties:install:migrations FROM=solidus_bling"
      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

5 entries across 5 versions & 1 rubygems

Version Path
solidus_bling-3.2 lib/generators/solidus_bling/install/install_generator.rb
solidus_bling-3.1.1 lib/generators/solidus_bling/install/install_generator.rb
solidus_bling-3.1.0 lib/generators/solidus_bling/install/install_generator.rb
solidus_bling-3.0.3 lib/generators/solidus_bling/install/install_generator.rb
solidus_bling-3.0.2 lib/generators/solidus_bling/install/install_generator.rb