Sha256: dfdaed3790d5492e6ac0f98ed20351e5ddfb4a46cb23cf9947bf8c633515f987

Contents?: true

Size: 1.45 KB

Versions: 3

Compression:

Stored size: 1.45 KB

Contents

require 'dockly/util'
require 'fog'
require 'pry'
require 'foreman/cli_fix'
require 'foreman/export/base_fix'

module Dockly
end

require 'dockly/aws'
require 'dockly/foreman'
require 'dockly/build_cache'
require 'dockly/docker'
require 'dockly/deb'
require 'dockly/util/tar'
require 'dockly/util/git'

module Dockly
  attr_reader :instance, :git_sha
  attr_writer :load_file

  LOAD_FILE = 'dockly.rb'

  def load_file
    @load_file || LOAD_FILE
  end

  def inst
    @instance ||= load_inst
  end

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

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

  {
    :deb => Dockly::Deb,
    :docker => Dockly::Docker,
    :foreman => Dockly::Foreman
  }.each do |method, klass|
    define_method(method) do |sym, &block|
      if block.nil?
        inst[:"#{method}s"][sym]
      else
        klass.new!(:name => sym, &block)
      end
    end
  end

  [:debs, :dockers, :foremans].each do |method|
    define_method(method) do
      inst[method]
    end
  end

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

  module_function :inst, :load_inst, :setup, :load_file, :load_file=,
                  :deb,  :docker,  :foreman, :git_sha,
                  :debs, :dockers, :foremans
end

require 'dockly/rake_task'

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dockly-0.0.6 lib/dockly.rb
dockly-0.0.5 lib/dockly.rb
dockly-0.0.4 lib/dockly.rb