Module: Drydock

Defined in:
lib/drydock.rb,
lib/drydock/phase.rb,
lib/drydock/errors.rb,
lib/drydock/logger.rb,
lib/drydock/drydock.rb,
lib/drydock/project.rb,
lib/drydock/cli_flags.rb,
lib/drydock/formatters.rb,
lib/drydock/tar_writer.rb,
lib/drydock/phase_chain.rb,
lib/drydock/plugins/apk.rb,
lib/drydock/plugins/npm.rb,
lib/drydock/file_manager.rb,
lib/drydock/plugins/base.rb,
lib/drydock/stream_monitor.rb,
lib/drydock/runtime_options.rb,
lib/drydock/container_config.rb,
lib/drydock/image_repository.rb,
lib/drydock/plugins/rubygems.rb,
lib/drydock/object_caches/base.rb,
lib/drydock/ignorefile_definition.rb,
lib/drydock/object_caches/no_cache.rb,
lib/drydock/plugins/package_manager.rb,
lib/drydock/object_caches/in_memory_cache.rb,
lib/drydock/object_caches/filesystem_cache.rb

Overview

:nodoc:

Defined Under Namespace

Modules: Formatters, ObjectCaches, Plugins Classes: CliFlags, ContainerConfig, ExecutionError, FileManager, Formatter, IgnorefileDefinition, ImageRepository, InsufficientVersionError, InvalidCommandExecutionError, InvalidInstructionError, Logger, OperationError, Phase, PhaseChain, Project, RuntimeOptions, StreamMonitor, TarWriter

Class Method Summary collapse

Class Method Details



4
5
6
# File 'lib/drydock/drydock.rb', line 4

def self.banner
  "Drydock v#{Drydock.version}"
end

.build(opts = {}, &blk) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/drydock/drydock.rb', line 8

def self.build(opts = {}, &blk)
  Project.new(opts).tap do |project|
    dryfile, dryfilename = yield

    Dir.chdir(File.dirname(dryfilename))
    Drydock.logger.info("Working directory set to #{Dir.pwd}")

    begin
      catch :done do
        project.instance_eval(dryfile, dryfilename)
      end
    rescue => e
      Drydock.logger.error("Error processing #{dryfilename}:")
      Drydock.logger.error(message: "#{e.class}: #{e.message}")
      e.backtrace.each do |backtrace|
        Drydock.logger.debug(message: "#{backtrace}", indent: 1)
      end
    ensure
      Drydock.logger.info("Cleaning up")
      project.finalize!
    end
  end
end

.from(repo, opts = {}, &blk) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/drydock/drydock.rb', line 32

def self.from(repo, opts = {}, &blk)
  opts = opts.clone
  tag  = opts.delete(:tag, 'latest')

  build(opts).tap do |project|
    project.from(repo, tag)
    yield project
  end
end

.loggerObject



42
43
44
# File 'lib/drydock/drydock.rb', line 42

def self.logger
  @logger ||= Logger.new(File.new('/dev/null', 'w+'))
end

.logger=(logger) ⇒ Object



46
47
48
# File 'lib/drydock/drydock.rb', line 46

def self.logger=(logger)
  @logger = logger
end

.using(project) ⇒ Object

Raises:

  • (NotImplementedError)


50
51
52
# File 'lib/drydock/drydock.rb', line 50

def self.using(project)
  raise NotImplementedError, "TODO(rpasay)"
end

.versionObject



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

def self.version
  version_file = File.join(File.dirname(__FILE__), '..', '..', 'VERSION')
  File.exist?(version_file) ? File.read(version_file).chomp : ""
end