Sha256: 48ad2f995276fe2a0ae32a075b90b2d3300aa0bb95afcc1a3daf87ee429295e5

Contents?: true

Size: 1.56 KB

Versions: 16

Compression:

Stored size: 1.56 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__ [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.
          -d --dry-run          "Dry run" publishing.
          --pending             Publish only pending.
          --recache             Rewrite instances cache.
          --run                 Confirm publishing.

      DOCOPT

      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 dry_run?
        options.fetch('--dry-run')
      end

      def instance_method
        run? || dry_run? ? 'publish_run' : 'publish_check'
      end

      def build_publish_options
        ::EacLauncher::Context.current.publish_options = publish_options
      end

      def publish_options
        { new: options.fetch('--new'), stereotype: options.fetch('--stereotype'),
          confirm: run? }
      end

      def run?
        options.fetch('--run') && !dry_run?
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
avm-tools-0.58.1 lib/eac_launcher/runner/publish.rb
avm-tools-0.58.0 lib/eac_launcher/runner/publish.rb
avm-tools-0.57.0 lib/eac_launcher/runner/publish.rb
avm-tools-0.56.0 lib/eac_launcher/runner/publish.rb
avm-tools-0.55.0 lib/eac_launcher/runner/publish.rb
avm-tools-0.54.2 lib/eac_launcher/runner/publish.rb
avm-tools-0.54.1 lib/eac_launcher/runner/publish.rb
avm-tools-0.54.0 lib/eac_launcher/runner/publish.rb
avm-tools-0.53.0 lib/eac_launcher/runner/publish.rb
avm-tools-0.52.0 lib/eac_launcher/runner/publish.rb
avm-tools-0.51.0 lib/eac_launcher/runner/publish.rb
avm-tools-0.50.0 lib/eac_launcher/runner/publish.rb
avm-tools-0.49.0 lib/eac_launcher/runner/publish.rb
avm-tools-0.48.0 lib/eac_launcher/runner/publish.rb
avm-tools-0.47.0 lib/eac_launcher/runner/publish.rb
avm-tools-0.46.0 lib/eac_launcher/runner/publish.rb