Sha256: 735fef78efed49574205c37abefc73d88261b0f8a207bb933f2e520149e9bb84

Contents?: true

Size: 1.25 KB

Versions: 51

Compression:

Stored size: 1.25 KB

Contents

# Author:: Xabier de Zuazo (<xabier@onddo.com>)
# Copyright:: Copyright (c) 2013 Onddo Labs, SL.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

require 'chef/version_class'

class Chef
  class Version
    class Platform < Chef::Version

      protected

      def parse(str="")
        @major, @minor, @patch =
          case str.to_s
          when /^(\d+)\.(\d+)\.(\d+)$/
            [ $1.to_i, $2.to_i, $3.to_i ]
          when /^(\d+)\.(\d+)$/
            [ $1.to_i, $2.to_i, 0 ]
          when /^(\d+)$/
            [ $1.to_i, 0, 0 ]
          else
            msg = "'#{str.to_s}' does not match 'x.y.z', 'x.y' or 'x'"
            raise Chef::Exceptions::InvalidPlatformVersion.new( msg )
          end
      end

    end
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
chef-11.12.8-x86-mingw32 lib/chef/version/platform.rb
chef-11.12.8 lib/chef/version/platform.rb
chef-11.14.0.alpha.2-x86-mingw32 lib/chef/version/platform.rb
chef-11.14.0.alpha.2 lib/chef/version/platform.rb
chef-11.12.4-x86-mingw32 lib/chef/version/platform.rb
chef-11.12.4 lib/chef/version/platform.rb
chef-11.12.4.rc.2-x86-mingw32 lib/chef/version/platform.rb
chef-11.12.4.rc.2 lib/chef/version/platform.rb
chef-11.12.2-x86-mingw32 lib/chef/version/platform.rb
chef-11.12.2 lib/chef/version/platform.rb
chef-11.12.0-x86-mingw32 lib/chef/version/platform.rb
chef-11.12.0 lib/chef/version/platform.rb
chef-11.12.0.rc.1-x86-mingw32 lib/chef/version/platform.rb
chef-11.12.0.rc.1 lib/chef/version/platform.rb
chef-11.12.0.alpha.1-x86-mingw32 lib/chef/version/platform.rb
chef-11.12.0.alpha.1 lib/chef/version/platform.rb
chef-11.10.4.ohai7.0-x86-mingw32 lib/chef/version/platform.rb
chef-11.10.4.ohai7.0 lib/chef/version/platform.rb
chef-11.10.4 lib/chef/version/platform.rb
chef-11.10.4-x86-mingw32 lib/chef/version/platform.rb