Module: Dockly

Defined in:
lib/dockly.rb,
lib/dockly/version.rb,
lib/dockly/s3_writer.rb,
lib/dockly/bash_builder.rb

Defined Under Namespace

Modules: BuildCache, History, RakeHelper Classes: AbstractCommand, BashBuilder, BuildCacheCommand, BuildDebCommand, BuildOrCopyAllCommand, BuildRpmCommand, Cli, Deb, Docker, DockerCommand, Foreman, ListCommand, Rpm, S3Writer, TarDiff

Constant Summary collapse

LOAD_FILE =
'dockly.rb'
MAJOR =
3
MINOR =
4
PATCH =
0
RELEASE =
nil
VERSION =
[MAJOR, MINOR, PATCH, RELEASE].compact.join('.')

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.load_fileObject



30
31
32
# File 'lib/dockly.rb', line 30

def load_file
  @load_file || LOAD_FILE
end

Class Method Details

.assume_role(role_name = nil) ⇒ Object



59
60
61
62
# File 'lib/dockly.rb', line 59

def assume_role(role_name = nil)
  @assume_role = role_name if role_name
  @assume_role
end

.aws_region(region = nil) ⇒ Object



75
76
77
78
# File 'lib/dockly.rb', line 75

def aws_region(region = nil)
  @aws_region = region unless region.nil?
  @aws_region || 'us-east-1'
end

.git_shaObject



55
56
57
# File 'lib/dockly.rb', line 55

def git_sha
  @git_sha ||= Dockly::Util::Git.sha
end

.instanceObject



34
35
36
# File 'lib/dockly.rb', line 34

def instance
  @instance ||= load_inst
end

.load_instObject



38
39
40
41
42
43
44
# File 'lib/dockly.rb', line 38

def load_inst
  setup.tap do |state|
    if File.exists?(load_file)
      instance_eval(IO.read(load_file), load_file)
    end
  end
end

.perform_role_assumptionObject



64
65
66
67
68
69
70
71
72
73
# File 'lib/dockly.rb', line 64

def perform_role_assumption
  return if assume_role.nil?
  Aws.config.update(
    credentials: Aws::AssumeRoleCredentials.new(
      role_arn: assume_role, role_session_name: 'dockly',
      client: Aws::STS::Client.new(region: aws_region)
    ),
    region: aws_region
  )
end

.s3Object



80
81
82
# File 'lib/dockly.rb', line 80

def s3
  @s3 ||= Aws::S3::Client.new(region: aws_region)
end

.setupObject



46
47
48
49
50
51
52
53
# File 'lib/dockly.rb', line 46

def setup
  {
    :debs => Dockly::Deb.instances,
    :rpms => Dockly::Rpm.instances,
    :dockers => Dockly::Docker.instances,
    :foremans => Dockly::Foreman.instances
  }
end