Class: Commands::Init::UserModel
Instance Attribute Summary collapse
Class Method Summary
collapse
-
.abstract ⇒ Object
Internal implementation - don’t mess with this ========================================================================.
Instance Method Summary
collapse
Methods inherited from InitModel
inheritable_attributes, inherited, #rank, run
Constructor Details
Returns a new instance of UserModel.
34
35
36
37
38
39
40
|
# File 'lib/commands/init/user_model.rb', line 34
def initialize
@login = self.class.login
@full_name = self.class.full_name
@password = self.class.password
@email = self.class.email
@super = self.class.super
end
|
Instance Attribute Details
#login ⇒ Object
Returns the value of attribute login.
32
33
34
|
# File 'lib/commands/init/user_model.rb', line 32
def login
@login
end
|
#password ⇒ Object
Returns the value of attribute password.
32
33
34
|
# File 'lib/commands/init/user_model.rb', line 32
def password
@password
end
|
Class Method Details
.abstract ⇒ Object
Internal implementation - don’t mess with this
28
29
30
|
# File 'lib/commands/init/user_model.rb', line 28
def self.abstract
true
end
|
Instance Method Details
#email ⇒ Object
42
43
44
|
# File 'lib/commands/init/user_model.rb', line 42
def email
@email || "#{login}@example.com"
end
|
#execute(p4, models = nil, super_user = nil) ⇒ Object
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/commands/init/user_model.rb', line 67
def execute(p4, models=nil, super_user=nil)
return if self.class.skip
puts "user: #{to_spec} as #{p4.user}"
p4.save_user(to_spec, '-f')
p4.user = login
p4.password = '' if password
p4.run_password('', password) if password
if super_user
p4.user = super_user.login
p4.password = super_user.password if super_user.password
end
end
|
#full_name ⇒ Object
46
47
48
|
# File 'lib/commands/init/user_model.rb', line 46
def full_name
@full_name || login
end
|
#super? ⇒ Boolean
50
51
52
|
# File 'lib/commands/init/user_model.rb', line 50
def super?
@super
end
|
#to_s ⇒ Object
54
55
56
|
# File 'lib/commands/init/user_model.rb', line 54
def to_s
"UserModel: login=#{login} email=#{email} full_name=#{full_name} password=#{password}"
end
|
#to_spec ⇒ Object
58
59
60
61
62
63
64
65
|
# File 'lib/commands/init/user_model.rb', line 58
def to_spec
spec = {
'User' => login,
'Email' => email,
'FullName' => full_name
}
spec
end
|