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.2669.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2657.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2652.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2641.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2640.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2624.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2619.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2611.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2606.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2605.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2603.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2597.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2596.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2583.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2579.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2578.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2577.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2576.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2560.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2559.0 lib/bosh/stemcell/operating_system.rb