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.2881.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2865.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2862.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2859.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2858.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2855.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2852.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2849.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2847.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2840.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2839.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2831.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2830.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2829.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2827.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2824.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2820.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2818.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2811.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2810.0 lib/bosh/stemcell/operating_system.rb