Sha256: 217ef34ce89aade3545d840db7c738178d6c94a91872f09eb3750dbf4b17cdee

Contents?: true

Size: 718 Bytes

Versions: 1

Compression:

Stored size: 718 Bytes

Contents

  class DeviseLdapMultipleGenerator < Rails::Generators::Base

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

    argument :user_model, :type => :string, :default => "user", :desc => "Model to update"

    # ToDo: Request user input to use a scope that already exists, or make it a parameter to pass into the generator
    def create_ldap_config
      copy_file "default.yml", "config/ldap/#{user_model}.yml"
    end

    def update_user_model
      gsub_file "app/models/#{user_model}.rb", /:database_authenticatable/, ":ldap_authenticatable"
      inject_into_class "app/models/#{user_model}.rb", user_model.capitalize.constantize do
        "\n  include DeviseLDAPMultiple\n"
      end
    end

  end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
devise_ldap_multiple-0.9.2 lib/generators/devise_ldap_multiple/devise_ldap_multiple_generator.rb