Sha256: dbb130395acf828a99c888a8e042d62ccbc2008b499184075e19ca907bead56d

Contents?: true

Size: 725 Bytes

Versions: 5

Compression:

Stored size: 725 Bytes

Contents

module Spree
  class CustomAuthenticationGenerator < Rails::Generators::Base
    desc 'Set up a Spree installation with a custom authentication helpers'

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

    def generate
      template 'authentication_helpers.rb.tt', 'lib/spree/authentication_helpers.rb'

      file_action = File.exist?('config/initializers/spree.rb') ? :append_file : :create_file
      send(file_action, 'config/initializers/spree.rb') do
        %Q{
          Rails.application.config.to_prepare do
            require_dependency 'spree/authentication_helpers'
          end\n}
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spree_core-4.10.1 lib/generators/spree/custom_authentication/custom_authentication_generator.rb
spree_core-4.10.0 lib/generators/spree/custom_authentication/custom_authentication_generator.rb
spree_core-4.9.0 lib/generators/spree/custom_authentication/custom_authentication_generator.rb
spree_core-4.8.3 lib/generators/spree/custom_authentication/custom_authentication_generator.rb
spree_core-4.8.2 lib/generators/spree/custom_authentication/custom_authentication_generator.rb