#!/usr/bin/env ruby require 'rubygems' require 'bundler/setup' require 'eac_launcher' class Runner < ::EacLauncher::Instances::RunnerHelper DOC = <...] __PROGRAM__ -h | --help Options: -h --help Show this screen. --new Publish projects not published before. -s --stereotype= Publish only for stereotype . --all Publish all instances. --pending Publish only pending. --recache Rewrite instances cache. DOCOPT OPTIONS = { new: '--new', confirm: 'run', stereotype: '--stereotype' }.freeze private def run ::EacLauncher::Context.current.recache = options['--recache'] build_publish_options instances.each do |i| next unless i.options.publishable? i.send(instance_method) end end def instance_method options['run'] || options['dry-run'] ? 'publish_run' : 'publish_check' end def build_publish_options ::EacLauncher::Context.current.publish_options = publish_options end def publish_options Hash[OPTIONS.map { |k, v| [k, options[v]] }] end end Runner.new