Sha256: 933493dcd5247c9be8d1ae46e987324938c5414563de42a8f34fab67191dea24

Contents?: true

Size: 1.23 KB

Versions: 35

Compression:

Stored size: 1.23 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 'photonos' then Photonos.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 Photonos < Base
      def initialize(version)
        super(name: 'photonos', version: version)
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
bosh-stemcell-1.3262.24.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3232.24.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3232.14.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3262.4.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3262.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3232.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3215.4.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3215.3.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3215.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3213.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3202.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3200.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3197.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3196.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3192.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3191.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3189.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3184.1.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3184.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.3181.0 lib/bosh/stemcell/operating_system.rb