Sha256: 8c48654c3731a52dfbb35a8dfbf7938db4d8f33946fa5162b898651230ae9110

Contents?: true

Size: 1.22 KB

Versions: 40

Compression:

Stored size: 1.22 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)
        when 'photon' then Photon.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
    
    class Photon < Base
      def initialize(version)
        super(name: 'photon', version: version)
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
bosh-stemcell-1.3146.10.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3146.9.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3146.8.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3146.7.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3146.6.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3146.5.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3146.4.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3146.3.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3146.2.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3146.1.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3146.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3145.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3144.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3143.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3142.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3140.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3139.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3138.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3137.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3130.0 lib/bosh/stemcell/operating_system.rb