Sha256: ff407ea51220c4b82c8e112aba57606d84ee2e318211a36ff5961a12c2d8f6c4

Contents?: true

Size: 821 Bytes

Versions: 4

Compression:

Stored size: 821 Bytes

Contents

module SolidusSignifyd
  module Generators
    class InstallGenerator < Rails::Generators::Base
      class_option :auto_run_migrations, type: :boolean, default: false

      source_root File.expand_path("../templates", __FILE__)

      def add_initializer
        copy_file "solidus_signifyd.rb", "config/initializers/solidus_signifyd.rb"
      end

      def add_migrations
        run 'bundle exec rake railties:install:migrations FROM=solidus_signifyd'
      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 'bundle exec rake db:migrate'
        else
          puts 'Skipping 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_signifyd-1.1.0 lib/generators/solidus_signifyd/install/install_generator.rb
solidus_signifyd-1.0.1 lib/generators/solidus_signifyd/install/install_generator.rb
solidus_signifyd-1.0.0 lib/generators/solidus_signifyd/install/install_generator.rb
solidus_signifyd-0.1.1 lib/generators/solidus_signifyd/install/install_generator.rb