-
Notifications
You must be signed in to change notification settings - Fork 3
/
pmx_runner.rb
executable file
·31 lines (28 loc) · 1.08 KB
/
pmx_runner.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#! /usr/local/bin/ruby
require 'commander/import'
require 'open-uri'
require 'yaml'
require 'docker'
require_relative 'pmx_runner/image_sorter'
require_relative 'pmx_runner/template_image'
require_relative 'pmx_runner/application'
Dir["pmx_runner/adapters/*.rb"].each {|file| require_relative file }
program :name, 'PMX Runner'
program :version, '0.0.1'
program :description, 'Executes a given Panamax template. Run without a command or options, the "deploy" command will execute using docker.'
default_command :deploy
command :deploy do |c|
c.summary = 'pmx-runner deploy URI [options]'
c.description = 'runs the template'
c.option '--client STRING', String, 'the client with which the container should be run (defaults to "docker")'
c.action do |args, options|
options.default(client: 'docker')
uri = args.first
pmx = open(uri, { ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE }) do |template|
YAML.load(template.read)
end
puts "Preparing to run #{pmx['name']}"
application = PmxRunner::Application.new(pmx, options.client.to_sym)
application.run
end
end