Class: GitWit::SshUserGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Actions
Defined in:
lib/generators/git_wit/ssh_user/ssh_user_generator.rb

Instance Method Summary collapse

Methods included from Actions::Ssh::Actions

#ssh_home, #ssh_sudoers

Methods included from Actions::Dscl::Actions

#dscl_group, #dscl_group_membership, #dscl_user

Methods included from Actions::Etc::Actions

#etc_user

Instance Method Details

#add_user_to_groupObject



24
25
26
# File 'lib/generators/git_wit/ssh_user/ssh_user_generator.rb', line 24

def add_user_to_group
  dscl_group_membership ssh_user, ssh_group if mac?
end

#add_user_to_sudoersObject



32
33
34
# File 'lib/generators/git_wit/ssh_user/ssh_user_generator.rb', line 32

def add_user_to_sudoers
  ssh_sudoers ssh_user
end

#build_homeObject



28
29
30
# File 'lib/generators/git_wit/ssh_user/ssh_user_generator.rb', line 28

def build_home
  ssh_home ssh_user, home
end

#check_userObject

Raises:

  • (Thor::Error)


11
12
13
# File 'lib/generators/git_wit/ssh_user/ssh_user_generator.rb', line 11

def check_user
  raise Thor::Error, "GitWit ssh_user is not configured." unless ssh_user.present?
end

#create_groupObject



20
21
22
# File 'lib/generators/git_wit/ssh_user/ssh_user_generator.rb', line 20

def create_group
  dscl_group ssh_group if mac?
end

#create_userObject



15
16
17
18
# File 'lib/generators/git_wit/ssh_user/ssh_user_generator.rb', line 15

def create_user
  @home = dscl_user ssh_user, home if mac?
  @home = etc_user ssh_user, home if linux?
end