Sha256: 798c26002705dbd484eeaa52a8d182df07fa2757515b3c3e70850d4ac7524760

Contents?: true

Size: 1.15 KB

Versions: 7

Compression:

Stored size: 1.15 KB

Contents

class Jeweler
  module Bumping
    # Bumps the patch version.
    #
    # 1.5.1 -> 1.5.2
    def bump_patch_version()
      patch = self.patch_version.to_i + 1

      write_version(major_version, minor_version, patch)
    end

    # Bumps the minor version.
    #
    # 1.5.1 -> 1.6.0
    def bump_minor_version()
      minor = minor_version.to_i + 1

      write_version(major_version, minor)
    end

    # Bumps the major version.
    #
    # 1.5.1 -> 2.0.0
    def bump_major_version()
      major = major_version.to_i + 1

      write_version(major)
    end

    # Bumps the version, to the specific major/minor/patch version, writing out the appropriate version.rb, and then reloads it.
    def write_version(major = 0, minor = 0, patch = 0)
      major ||= 0
      minor ||= 0
      patch ||= 0
      
      File.open(version_yaml_path, 'w+') do |f|
        version_hash = {
          'major' => major.to_i,
          'minor' => minor.to_i,
          'patch' => patch.to_i
        }
        YAML.dump(version_hash, f)
      end
      refresh_version
      
      @gemspec.version = version
      
      puts "Wrote to #{version_yaml_path}: #{version}"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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