Class: Geri::Tasks::CreateAdminUser

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/geri/tasks/create_admin_user.rb

Instance Method Summary collapse

Instance Method Details

#ask_admin_emailObject



6
7
8
9
# File 'lib/geri/tasks/create_admin_user.rb', line 6

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

#ask_admin_first_nameObject



11
12
13
# File 'lib/geri/tasks/create_admin_user.rb', line 11

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

#ask_admin_last_nameObject



15
16
17
# File 'lib/geri/tasks/create_admin_user.rb', line 15

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

#ask_admin_passwordObject



19
20
21
# File 'lib/geri/tasks/create_admin_user.rb', line 19

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

#confirm_admin_passwordObject



23
24
25
# File 'lib/geri/tasks/create_admin_user.rb', line 23

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

#create_admin_userObject



27
28
29
30
31
32
33
34
35
36
# File 'lib/geri/tasks/create_admin_user.rb', line 27

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