Sha256: aa196bef69647bc28d8fd29cd0f4602d251e7684e45e59d68c14fe036f29cc31

Contents?: true

Size: 1.04 KB

Versions: 46

Compression:

Stored size: 1.04 KB

Contents

module Bosh::Stemcell
  module OperatingSystem

    def self.for(operating_system_name, operating_system_version = nil)
      case operating_system_name
        when 'centos' then Centos.new(operating_system_version)
        when 'rhel' then Rhel.new(operating_system_version)
        when 'ubuntu' then Ubuntu.new(operating_system_version)
        else raise ArgumentError.new("invalid operating system: #{operating_system_name}")
      end
    end

    class Base
      attr_reader :name, :version

      def initialize(options = {})
        @name = options.fetch(:name)
        @version = options.fetch(:version)
      end

      def ==(other)
        name == other.name
      end
    end

    class Rhel < Base
      def initialize(version)
        super(name: 'rhel', version: version)
      end
    end

    class Centos < Base
      def initialize(version)
        super(name: 'centos', version: version)
      end
    end

    class Ubuntu < Base
      def initialize(version)
        super(name: 'ubuntu', version: version)
      end
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
bosh-stemcell-1.3063.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3062.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3058.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3056.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3050.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3048.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3042.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3039.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3033.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3031.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3030.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3029.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3026.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3025.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3022.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3016.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3012.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3010.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3008.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3004.0 lib/bosh/stemcell/operating_system.rb