Class: Jets::Code::User

Inherits:
Object
  • Object
show all
Defined in:
lib/jets/code/user.rb

Instance Method Summary collapse

Instance Method Details

#iam_userObject



18
19
20
21
22
# File 'lib/jets/code/user.rb', line 18

def iam_user
  @iam ||= Aws::IAM::Client.new
  @iam.get_user.user.user_name
rescue Aws::IAM::Errors::ValidationError
end

#saveObject



7
8
9
10
11
12
# File 'lib/jets/code/user.rb', line 7

def save
  user = iam_user || ENV["USER"] || ENV["JETS_DEPLOY_USER"]
  FileUtils.mkdir_p(File.dirname(user_file))
  IO.write(user_file, user)
  user
end

#user_fileObject



14
15
16
# File 'lib/jets/code/user.rb', line 14

def user_file
  "#{build_root}/stage/code/.jets/deploy_user"
end