Sha256: 1b21b95bc3a4a1f275e3372a12f6fb2ad4f63bfcfe84f3943ad58e3fca07808d

Contents?: true

Size: 1.8 KB

Versions: 8

Compression:

Stored size: 1.8 KB

Contents

module PEBuild
  module Util
    # Utilities related to PE Packages
    #
    # This module provides general-purpose utility functions for working with
    # PE packages.
    #
    # @since 0.13.0
    module PEPackaging

      # Determine package tag from Facts
      #
      # The `platform_tag` is a `os-version-archtecture` value that is used in
      # many PE package filenames and repostiory names.
      #
      # @param facts [Hash] A hash of facts which includes `architecture`
      #   and `os` values.
      #
      # @return [String] A string representing the platform tag.
      def platform_tag(facts)
        case facts['os']['family'].downcase
        when 'redhat'
          # TODO: Fedora might be in here.
          os      = 'el'
          version = facts['os']['release']['major']
          arch    = facts['architecture']
        when 'windows'
          os      = 'windows'
          version = nil
          arch    = (facts['architecture'] == 'x64' ? 'x86_64' : 'i386')
        when 'debian'
          case os = facts['os']['name'].downcase
          when 'debian'
            version = facts['os']['release']['major']
          when 'ubuntu'
            version = facts['os']['release']['full']
          end
          # TODO: Add "unknown debian" error.
          arch = (facts['architecture'] == 'x86_64' ? 'amd64' : 'i386')
        when 'solaris'
          os      = 'solaris'
          version = facts['os']['release']['major']
          arch    = (facts['architecture'].match(/^i\d+/) ? 'i386' : 'sparc')
        when 'suse'
          os      = 'sles'
          version = facts['os']['release']['major']
          arch    = facts['architecture']
        end
        # TODO: Add "unknown os" error.

        [os, version, arch].join('-').downcase
      end
      module_function :platform_tag

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
vagrant-pe_build-0.13.7 lib/pe_build/util/pe_packaging.rb
vagrant-pe_build-0.13.6 lib/pe_build/util/pe_packaging.rb
vagrant-pe_build-0.13.5 lib/pe_build/util/pe_packaging.rb
vagrant-pe_build-0.13.4 lib/pe_build/util/pe_packaging.rb
vagrant-pe_build-0.13.3 lib/pe_build/util/pe_packaging.rb
vagrant-pe_build-0.13.2 lib/pe_build/util/pe_packaging.rb
vagrant-pe_build-0.13.1 lib/pe_build/util/pe_packaging.rb
vagrant-pe_build-0.13.0 lib/pe_build/util/pe_packaging.rb