Sha256: 31661d48f10af97032fa13d64efb00f1f6d113b1ee746e26a0a61c3a9b8c26ef

Contents?: true

Size: 837 Bytes

Versions: 1

Compression:

Stored size: 837 Bytes

Contents

module Messaging
  module Generators
    class DeviseGenerator < Rails::Generators::NamedBase
      desc "Uses Devise for authentication"

      argument :name, :type => :string, :default => "MessagingUser"


      def self.source_root
        @_messaging_source_root ||= File.expand_path("../templates", __FILE__)
      end

      def install_devise
        require 'devise'
        if File.exists?(File.join(destination_root, "config", "initializers", "devise.rb"))
          log :generate, "No need to install devise, already done."
        else
          log :generate, "devise:install"
          invoke "devise:install"
        end
      end

      def create_user
        invoke "devise", [name]
      end

      def copy_model
        template 'messaging_user.rb.erb', 'app/models/messaging_user.rb'
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
messaging_4-0.0.1 lib/generators/messaging/devise/devise_generator.rb