Sha256: 0dc0cdc25cb7c4b5f6f8bffa6d2cbb4314a8c252535de8e695398e431b250742

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

module Spree
  module Auth
    module Generators
      class InstallGenerator < Rails::Generators::Base
        class_option :migrate, type: :boolean, default: true, banner: 'Migrate the database'

        def self.source_paths
          paths = superclass.source_paths
          paths << File.expand_path('../templates', __FILE__)
          paths.flatten
        end

        def add_javascripts
          append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require spree/frontend/spree_auth\n"
        end

        def generate_devise_key
          return if ENV['CI']
          template 'config/initializers/devise.rb', 'config/initializers/devise.rb'
        end

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

        def run_migrations
         if options[:migrate]
           run 'bundle exec rake db:migrate VERBOSE=false'
         else
           puts "Skiping rake db:migrate, don't forget to run it!"
         end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree_auth_devise-3.3.0.rc1 lib/generators/spree/auth/install/install_generator.rb
spree_auth_devise-3.2.0 lib/generators/spree/auth/install/install_generator.rb