Sha256: 6e61bc6d148e3d715f35fd6be9f70862ad3da3c179e667a64e51f1b4dfb5651a

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

module EacLauncher
  class Runner < ::EacRubyUtils::Console::DocoptRunner
    class Publish < ::EacLauncher::Instances::RunnerHelper
      DOC = <<DOCOPT.freeze
Publica projetos ou instâncias.

Usage:
  __PROGRAM__ (check|dry-run|run) [options] [<instance_path>...]
  __PROGRAM__ -h | --help

Options:
  -h --help             Show this screen.
  --new                 Publish projects not published before.
  -s --stereotype=<st>  Publish only for stereotype <stereotype>.
  --all            Publish all instances.
  --pending             Publish only pending.
  --recache             Rewrite instances cache.

DOCOPT

      OPTIONS = {
        new: '--new', confirm: 'run', stereotype: '--stereotype'
      }.freeze

      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

      private

      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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eac_launcher-0.6.0 lib/eac_launcher/runner/publish.rb