Sha256: d2903ffd61758fb0fe3d3440bcc65670755aa5fd66f528f134f588d4de448d48

Contents?: true

Size: 969 Bytes

Versions: 5

Compression:

Stored size: 969 Bytes

Contents

module Geri
  module Tasks
    class CreateAdminUser < Thor::Group
      include Thor::Actions

      def ask_admin_email
        say('Create a new Admin User')
        @email = ask('Email:')
      end

      def ask_admin_first_name
        @first_name = ask('First Name:')
      end

      def ask_admin_last_name
        @last_name = ask('Last Name:')
      end

      def ask_admin_password
        @password = ask('Password:', echo: false)
      end

      def confirm_admin_password
        @confirmation = ask("\nPassword Confirmation:", echo: false)
      end

      def create_admin_user
        AdminUser.create!(
          validate_password:     true,
          email:                 @email,
          password:              @password,
          password_confirmation: @confirmation,
          first_name:            @first_name,
          last_name:             @last_name)
        say("\nCreated admin with email '#{@email}'")
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
geri-0.1.4 lib/geri/tasks/create_admin_user.rb
geri-0.1.3 lib/geri/tasks/create_admin_user.rb
geri-0.1.1 lib/geri/tasks/create_admin_user.rb
geri-0.1.0 lib/geri/tasks/create_admin_user.rb
geri-0.0.1 lib/geri/tasks/create_admin_user.rb