Sha256: 726483d0c09cc60aa0e09443e4f217465f7b7a969296b6bc5f6188aeee9221f5

Contents?: true

Size: 1.04 KB

Versions: 6

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

require 'avm/launcher/errors/base'
require 'eac_ruby_utils/core_ext'

module Avm
  module Launcher
    module Publish
      class Base
        common_constructor :instance

        def run
          s = check
          info("Check: #{s}")
          return unless s.status == ::Avm::Launcher::Publish::CheckResult::STATUS_PENDING

          publish
        end

        def check
          s = check_with_rescue
          ::Avm::Launcher::Context.current.instance_manager.publish_state_set(
            instance, stereotype.stereotype_name, s.status
          )
          s
        end

        private

        def stereotype
          self.class.name.deconstantize.constantize
        end

        def check_with_rescue
          internal_check
        rescue ::Avm::Launcher::Errors::Base => e
          ::Avm::Launcher::Publish::CheckResult.blocked("Error: #{e}")
        rescue ::Avm::Launcher::Git::Error => e
          ::Avm::Launcher::Publish::CheckResult.blocked("Git error: #{e}")
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
avm-0.48.0 lib/avm/launcher/publish/base.rb
eac_tools-0.36.1 sub/avm/lib/avm/launcher/publish/base.rb
avm-0.47.0 lib/avm/launcher/publish/base.rb
eac_tools-0.36.0 sub/avm/lib/avm/launcher/publish/base.rb
avm-0.46.0 lib/avm/launcher/publish/base.rb
eac_tools-0.35.0 sub/avm/lib/avm/launcher/publish/base.rb