Sha256: 8c209e4b7fcc992e378a01d1413345c0838b0681063ad6ef5192d45ea355f68c

Contents?: true

Size: 1.86 KB

Versions: 44

Compression:

Stored size: 1.86 KB

Contents

# frozen_string_literal: true

require 'eac_launcher/instances/runner_helper'

module Avm
  module Tools
    class Runner < ::EacRubyUtils::Console::DocoptRunner
      class Launcher < ::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
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
avm-tools-0.86.0 lib/avm/tools/runner/launcher/publish.rb
avm-tools-0.85.1 lib/avm/tools/runner/launcher/publish.rb
avm-tools-0.85.0 lib/avm/tools/runner/launcher/publish.rb
avm-tools-0.84.0 lib/avm/tools/runner/launcher/publish.rb
avm-tools-0.83.0 lib/avm/tools/runner/launcher/publish.rb
avm-tools-0.82.1 lib/avm/tools/runner/launcher/publish.rb
avm-tools-0.82.0 lib/avm/tools/runner/launcher/publish.rb
avm-tools-0.81.0 lib/avm/tools/runner/launcher/publish.rb
avm-tools-0.80.0 lib/avm/tools/runner/launcher/publish.rb
avm-tools-0.79.0 lib/avm/tools/runner/launcher/publish.rb
avm-tools-0.78.0 lib/avm/tools/runner/launcher/publish.rb
avm-tools-0.77.0 lib/avm/tools/runner/launcher/publish.rb
avm-tools-0.76.1 lib/avm/tools/runner/launcher/publish.rb
avm-tools-0.76.0 lib/avm/tools/runner/launcher/publish.rb
avm-tools-0.75.1 lib/avm/tools/runner/launcher/publish.rb
avm-tools-0.75.0 lib/avm/tools/runner/launcher/publish.rb
avm-tools-0.74.1 lib/avm/tools/runner/launcher/publish.rb
avm-tools-0.74.0 lib/avm/tools/runner/launcher/publish.rb
avm-tools-0.73.0 lib/avm/tools/runner/launcher/publish.rb
avm-tools-0.72.0 lib/avm/tools/runner/launcher/publish.rb