Sha256: da3a1fcecc323c598711188fd51968d6585b63bfdc2b277ef84512e035f71c3d

Contents?: true

Size: 1.37 KB

Versions: 10

Compression:

Stored size: 1.37 KB

Contents

# frozen_string_literal: true

module Headdesk
  module Checks
    #
    # Module for Teak checks
    #
    module Teak
      #
      # Module for Teak APK checks
      #
      module APK
        def self.included(klass)
          klass.include(Check::APK)
          klass.extend(Preconditions)
          klass.include(Utility)
        end

        #
        # Precondition tests for presence of Teak class SDK in APK
        #
        module Preconditions
          def preconditions?
            false unless apk.class?('io.teak.sdk.Teak')
          end

          def check_name(cname = nil)
            cname = "teak/#{cname}" if cname
            super(cname)
          end
        end

        #
        # Utility methods for Teak based checks
        #
        module Utility
          def teak_sdk
            return @teak_sdk if @teak_sdk

            major, minor, revision = apk.find_class('io.teak.sdk.Teak')
                                        .field('SDKVersion')
                                        .value
                                        .to_version
            @teak_sdk = OpenStruct.new(
              version: "#{major}.#{minor}.#{revision}",
              major: major, minor: minor, revision: revision
            )

            @teak_sdk
          end
        end
      end
    end
  end
end

Dir[File.dirname(__FILE__) + '/teak/*.rb'].each { |file| require file }

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
headdesk-0.11.1 lib/headdesk/checks/teak.rb
headdesk-0.11.0 lib/headdesk/checks/teak.rb
headdesk-0.10.0 lib/headdesk/checks/teak.rb
headdesk-0.9.0 lib/headdesk/checks/teak.rb
headdesk-0.8.0 lib/headdesk/checks/teak.rb
headdesk-0.7.0 lib/headdesk/checks/teak.rb
headdesk-0.6.0 lib/headdesk/checks/teak.rb
headdesk-0.5.2 lib/headdesk/checks/teak.rb
headdesk-0.5.1 lib/headdesk/checks/teak.rb
headdesk-0.5.0 lib/headdesk/checks/teak.rb