Sha256: 3103af7fb4b5f2698e94f4328f1151ca4695ddc6e09a2787e83cbb1a5de364c6

Contents?: true

Size: 1.25 KB

Versions: 8

Compression:

Stored size: 1.25 KB

Contents

require 'yaml'
class Jeweler
  module Versioning
    # Major version, as defined by the gemspec's Version module.
    # For 1.5.3, this would return 1.
    def major_version
      version_yaml['major']
    end

    # Minor version, as defined by the gemspec's Version module.
    # For 1.5.3, this would return 5.
    def minor_version
      version_yaml['minor']
    end

    # Patch version, as defined by the gemspec's Version module.
    # For 1.5.3, this would return 5.
    def patch_version
      version_yaml['patch']
    end

    # Human readable version, which is used in the gemspec.
    def version
      "#{major_version}.#{minor_version}.#{patch_version}"
    end
    
  protected
    def version_yaml_path
      denormalized_path = File.join(@base_dir, 'VERSION.yml')
      absolute_path = File.expand_path(denormalized_path)
      absolute_path.gsub(Dir.getwd + File::SEPARATOR, '')
    end
    
    def version_yaml
      @version_yaml ||= read_version_yaml
    end
    
    def read_version_yaml
      if File.exists?(version_yaml_path)
        YAML.load_file(version_yaml_path)
      else
        raise VersionYmlError, "#{version_yaml_path} does not exist!"
      end
    end
    
    def refresh_version
      @version_yaml = read_version_yaml
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
technicalpickles-jeweler-0.1.1 lib/jeweler/versioning.rb
technicalpickles-jeweler-0.2.0 lib/jeweler/versioning.rb
technicalpickles-jeweler-0.3.0 lib/jeweler/versioning.rb
technicalpickles-jeweler-0.3.1 lib/jeweler/versioning.rb
technicalpickles-jeweler-0.3.2 lib/jeweler/versioning.rb
technicalpickles-jeweler-0.3.3 lib/jeweler/versioning.rb
technicalpickles-jeweler-0.3.4 lib/jeweler/versioning.rb
technicalpickles-jeweler-0.4.1 lib/jeweler/versioning.rb