Sha256: bd91a9e064fbc0e05e0d549b4db6e20a65f17fb8b79fbf2e5809d80a6a75ee3f

Contents?: true

Size: 1.79 KB

Versions: 15

Compression:

Stored size: 1.79 KB

Contents

#!/usr/bin/env ruby

require 'optparse'
require_relative '../utils/configurations'

configurations = list_configurations(File.expand_path(File.join(__dir__, '../../configurations')))

ARGV << '-h' if ARGV.empty?

options = {}

OptionParser.new do |opts|
  opts.banner = "Usage: indocker/bin/remote/compile [options] (only on remote server)"

  opts.on("-C", "--configuration REQUIRED", String, "Configuration name") do |val|
    options[:configuration] = val
  end

  opts.on("-d", "--debug", "Debug mode") do |val|
    options[:debug] = true
  end

  opts.on("-i", "--image REQUIRED", String, "Image to be compiled") do |val|
    options[:images] ||= []
    options[:images].push(val.to_sym)
  end

  opts.on("-s", "--skip-dependent", String, "Do not compile dependent images") do |val|
    options[:skip_dependent] = true
  end

  opts.on_tail("-h", "--help", "Show help") do
    puts opts
    exit
  end
end.parse!

if !options.has_key?(:configuration)
  puts "You should specify configuration using -C or --configuration option.\nAvailable configurations: #{configurations.sort.join(', ')}"
  exit 1
end

if !configurations.include?(options[:configuration])
  puts "Invalid configuration provided: #{options[:configuration]}.\nAvailable configurations: #{configurations.inspect}"
  exit 1
end

if !options.has_key?(:images)
  puts "At least one image should be provided"
end

begin
  require 'indocker'
rescue LoadError
  puts "InDocker has been moved into a separate gem. Please install using `gem install indocker`"
  exit 1
end

if options[:debug]
  Indocker.set_log_level(Logger::DEBUG)
else
  Indocker.set_log_level(Logger::INFO)
end

Indocker.set_configuration_name(options[:configuration])
require_relative '../../setup'


Indocker.compile(
  images: options[:images] || [],
  skip_dependent: !!options[:skip_dependent]
)

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
indocker-0.1.16 example/indocker/bin/remote/compile
indocker-0.1.15 example/indocker/bin/remote/compile
indocker-0.1.14 example/indocker/bin/remote/compile
indocker-0.1.13 example/indocker/bin/remote/compile
indocker-0.1.12 example/indocker/bin/remote/compile
indocker-0.1.11 example/indocker/bin/remote/compile
indocker-0.1.10 example/indocker/bin/remote/compile
indocker-0.1.9 example/indocker/bin/remote/compile
indocker-0.1.8 example/indocker/bin/remote/compile
indocker-0.1.7 example/indocker/bin/remote/compile
indocker-0.1.6 example/indocker/bin/remote/compile
indocker-0.1.5 example/indocker/bin/remote/compile
indocker-0.1.4 example/indocker/bin/remote/compile
indocker-0.1.3 example/indocker/bin/remote/compile
indocker-0.1.2 example/indocker/bin/remote/compile