Sha256: 573a971c2ac5ad9987c49918be0e8260313d1640d9700283d1ee7fb20b749bb9

Contents?: true

Size: 496 Bytes

Versions: 4

Compression:

Stored size: 496 Bytes

Contents

require "aws-sdk-iam"

class Jets::Code
  class User
    delegate :build_root, to: Jets

    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

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jets-6.0.5 lib/jets/code/user.rb
jets-6.0.4 lib/jets/code/user.rb
jets-6.0.3 lib/jets/code/user.rb
jets-6.0.2 lib/jets/code/user.rb