Sha256: 8cd0b297e8c272a15da796c42e84953381decbdef07d97b8e13ca844e197f0a0

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 KB

Contents

require 'rake'
require 'dockly'

class Rake::DebTask < Rake::Task
  def needed?
    raise "Package does not exist" if package.nil?
    !package.exists?
  end

  def package
    Dockly::Deb[name.split(':').last.to_sym]
  end
end

class Rake::DockerTask < Rake::Task
  def needed?
    raise "Docker does not exist" if docker.nil?
    !docker.exists?
  end

  def docker
    Dockly::Docker[name.split(':').last.to_sym]
  end
end

module Rake::DSL
  def deb(*args, &block)
    Rake::DebTask.define_task(*args, &block)
  end

  def docker(*args, &block)
    Rake::DockerTask.define_task(*args, &block)
  end
end

namespace :dockly do
  task :load do
    raise "No dockly.rb found!" unless File.exist?('dockly.rb')
  end

  namespace :deb do
    Dockly.debs.values.each do |inst|
      deb inst.name => 'dockly:load' do |name|
        Thread.current[:rake_task] = name
        inst.build
      end
    end
  end

  namespace :docker do
    Dockly.dockers.values.each do |inst|
      docker inst.name => 'dockly:load' do
        Thread.current[:rake_task] = inst.name
        inst.generate!
      end

      namespace :noexport do
        task inst.name => 'dockly:load' do
          Thread.current[:rake_task] = inst.name
          inst.generate_build
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dockly-1.5.10 lib/dockly/rake_task.rb
dockly-1.5.9 lib/dockly/rake_task.rb