Sha256: 3de5690d6e68947393eaadafc335e2e2e4f59752c9279f5101e306485b187269

Contents?: true

Size: 1.07 KB

Versions: 105

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

require 'avm/launcher/errors/base'

module Avm
  module Launcher
    module Publish
      class Base
        attr_reader :instance

        def initialize(instance)
          @instance = instance
        end

        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

105 entries across 105 versions & 2 rubygems

Version Path
avm-tools-0.138.0 lib/avm/launcher/publish/base.rb
eac_tools-0.34.0 sub/avm-tools/lib/avm/launcher/publish/base.rb
avm-tools-0.137.0 lib/avm/launcher/publish/base.rb
eac_tools-0.33.0 sub/avm-tools/lib/avm/launcher/publish/base.rb
eac_tools-0.32.0 sub/avm-tools/lib/avm/launcher/publish/base.rb
avm-tools-0.136.2 lib/avm/launcher/publish/base.rb
eac_tools-0.31.1 sub/avm-tools/lib/avm/launcher/publish/base.rb
eac_tools-0.31.0 sub/avm-tools/lib/avm/launcher/publish/base.rb
avm-tools-0.136.1 lib/avm/launcher/publish/base.rb
eac_tools-0.30.0 sub/avm-tools/lib/avm/launcher/publish/base.rb
eac_tools-0.29.0 sub/avm-tools/lib/avm/launcher/publish/base.rb
avm-tools-0.136.0 lib/avm/launcher/publish/base.rb
eac_tools-0.28.0 sub/avm-tools/lib/avm/launcher/publish/base.rb
eac_tools-0.27.2 sub/avm-tools/lib/avm/launcher/publish/base.rb
eac_tools-0.27.1 sub/avm-tools/lib/avm/launcher/publish/base.rb
avm-tools-0.135.0 lib/avm/launcher/publish/base.rb
eac_tools-0.27.0 sub/avm-tools/lib/avm/launcher/publish/base.rb
avm-tools-0.134.0 lib/avm/launcher/publish/base.rb
eac_tools-0.26.0 sub/avm-tools/lib/avm/launcher/publish/base.rb
eac_tools-0.25.1 sub/avm-tools/lib/avm/launcher/publish/base.rb