Sha256: 917b242a29d40f253d288e9fdf16e69a8fedf39b637808a03ca7c05a0c6b41ac

Contents?: true

Size: 1.61 KB

Versions: 9

Compression:

Stored size: 1.61 KB

Contents

# frozen_string_literal: true

require 'avm/launcher/instances/runner_helper'

module Avm
  module Tools
    class Runner
      class Launcher
        class Publish < ::Avm::Launcher::Instances::RunnerHelper
          runner_with :help do
            desc 'Publica projetos ou instâncias.'
            bool_opt '--all', 'Get all instances.'
            bool_opt '-d', '--dry-run', '"Dry run" publishing.'
            bool_opt '--new', 'Publish projects not published before.'
            bool_opt '--pending', 'Publish only pending.'
            bool_opt '--recache', 'Rewrite instances cache.'
            bool_opt '--run', 'Confirm publishing.'
            arg_opt '-s', '--stereotype', 'Publish only for stereotype <stereotype>.'
            pos_arg :instance_path, repeat: true, optional: true
          end

          def run
            ::Avm::Launcher::Context.current.recache = parsed.recache?
            build_publish_options
            instances.each do |i|
              next unless i.options.publishable?

              i.send(instance_method)
            end
          end

          private

          def dry_run?
            parsed.dry_run?
          end

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

          def build_publish_options
            ::Avm::Launcher::Context.current.publish_options = publish_options
          end

          def publish_options
            { new: parsed.new?, stereotype: parsed.stereotype?, confirm: run? }
          end

          def run?
            parsed.run? && !dry_run?
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
avm-tools-0.104.0 lib/avm/tools/runner/launcher/publish.rb
avm-tools-0.103.1 lib/avm/tools/runner/launcher/publish.rb
avm-tools-0.103.0 lib/avm/tools/runner/launcher/publish.rb
avm-tools-0.102.2 lib/avm/tools/runner/launcher/publish.rb
avm-tools-0.102.1 lib/avm/tools/runner/launcher/publish.rb
avm-tools-0.102.0 lib/avm/tools/runner/launcher/publish.rb
avm-tools-0.101.0 lib/avm/tools/runner/launcher/publish.rb
avm-tools-0.100.0 lib/avm/tools/runner/launcher/publish.rb
avm-tools-0.99.1 lib/avm/tools/runner/launcher/publish.rb