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.2549.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2546.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2539.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2537.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2534.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2531.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2524.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2513.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2479.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2448.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2446.0 lib/bosh/stemcell/operating_system.rb