Sha256: 936ba16bc8fc69f12b25667becbef840cc37b7c07c6a8d1108f0d399dbda5307

Contents?: true

Size: 835 Bytes

Versions: 91

Compression:

Stored size: 835 Bytes

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
        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, nil)
      end

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

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

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

Version data entries

91 entries across 91 versions & 1 rubygems

Version Path
bosh-stemcell-1.2809.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2807.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2801.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2798.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2797.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2792.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2789.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2788.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2787.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2786.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2785.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2781.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2780.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2778.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2776.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2768.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2765.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2754.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2751.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2749.0 lib/bosh/stemcell/operating_system.rb