DynamoMTL/mercury-engine

View on GitHub
lib/generators/mercury_engine/install_generator.rb

Summary

Maintainability
A
0 mins
Test Coverage
module MercuryEngine
  module Generators
    class InstallGenerator < Rails::Generators::Base
      def add_route
        route "mount MercuryEngine::Engine => '/'"
      end

      def add_migrations
        run 'bundle exec rake railties:install:migrations FROM=mercury_engine'
      end

      def run_migrations
         response = ask "Would you like to run the migrations now? [Y/n]"

         if response == "" || response.downcase == "y"
           run 'bundle exec rake db:migrate'
         else
           say "Skipping rake db:migrate, don't forget to run it!", :yellow
         end
      end
    end
  end
end