Sha256: 6f0a04eb504c6ba451d3c7132b74e3555001ee7fbba5c95b3c1035023a6757f0

Contents?: true

Size: 1.31 KB

Versions: 8

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true

module EacLauncher
  class Runner < ::EacRubyUtils::Console::DocoptRunner
    class Publish < ::EacLauncher::Instances::RunnerHelper
      DOC = <<DOCOPT
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

8 entries across 8 versions & 1 rubygems

Version Path
eac_launcher-0.6.8 lib/eac_launcher/runner/publish.rb
eac_launcher-0.6.7 lib/eac_launcher/runner/publish.rb
eac_launcher-0.6.6 lib/eac_launcher/runner/publish.rb
eac_launcher-0.6.5 lib/eac_launcher/runner/publish.rb
eac_launcher-0.6.4 lib/eac_launcher/runner/publish.rb
eac_launcher-0.6.3 lib/eac_launcher/runner/publish.rb
eac_launcher-0.6.2 lib/eac_launcher/runner/publish.rb
eac_launcher-0.6.1 lib/eac_launcher/runner/publish.rb