Sha256: 8addffcb921733d549e2ae2935b95a4e172e14377696c23c488430725cffba2e

Contents?: true

Size: 1013 Bytes

Versions: 31

Compression:

Stored size: 1013 Bytes

Contents

# frozen_string_literal: true

require 'eac_launcher/instances/error'

module EacLauncher
  module Publish
    class Base
      attr_reader :instance

      def initialize(instance)
        @instance = instance
      end

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

        publish
      end

      def check
        s = check_with_rescue
        ::EacLauncher::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 ::EacLauncher::Instances::Error => e
        ::EacLauncher::Publish::CheckResult.blocked("Error: #{e}")
      rescue ::EacLauncher::Git::Error => e
        ::EacLauncher::Publish::CheckResult.blocked("Git error: #{e}")
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 2 rubygems

Version Path
avm-tools-0.62.1 lib/eac_launcher/publish/base.rb
avm-tools-0.62.0 lib/eac_launcher/publish/base.rb
avm-tools-0.61.0 lib/eac_launcher/publish/base.rb
avm-tools-0.60.0 lib/eac_launcher/publish/base.rb
avm-tools-0.59.0 lib/eac_launcher/publish/base.rb
avm-tools-0.58.1 lib/eac_launcher/publish/base.rb
avm-tools-0.58.0 lib/eac_launcher/publish/base.rb
avm-tools-0.57.0 lib/eac_launcher/publish/base.rb
avm-tools-0.56.0 lib/eac_launcher/publish/base.rb
avm-tools-0.55.0 lib/eac_launcher/publish/base.rb
avm-tools-0.54.2 lib/eac_launcher/publish/base.rb
avm-tools-0.54.1 lib/eac_launcher/publish/base.rb
avm-tools-0.54.0 lib/eac_launcher/publish/base.rb
avm-tools-0.53.0 lib/eac_launcher/publish/base.rb
avm-tools-0.52.0 lib/eac_launcher/publish/base.rb
avm-tools-0.51.0 lib/eac_launcher/publish/base.rb
avm-tools-0.50.0 lib/eac_launcher/publish/base.rb
avm-tools-0.49.0 lib/eac_launcher/publish/base.rb
avm-tools-0.48.0 lib/eac_launcher/publish/base.rb
avm-tools-0.47.0 lib/eac_launcher/publish/base.rb