Sha256: 8764855e3bcf07dfa14c6dcf76b4ea01f7e8f5750f188257f6efb39174a599c8

Contents?: true

Size: 1.34 KB

Versions: 26

Compression:

Stored size: 1.34 KB

Contents

desc "bump the gem version"
namespace :version do
  namespace :bump do

    task :major do
      @new_version = Napa::Version.next_major
      execute_version_bump
    end

    task :minor do
      @new_version = Napa::Version.next_minor
      execute_version_bump
    end

    task :patch do
      @new_version = Napa::Version.next_patch
      execute_version_bump
    end

    def execute_version_bump
      if !clean_staging_area?
        system "git status"
        raise "Unclean staging area! Be sure to commit or .gitignore everything first. See `git status` above."
      else
        require 'git'
        git = Git.open('.')

        write_update
        git.add('lib/napa/version.rb')
        git.commit("Version bump: #{release_tag}")
        git.add_tag(release_tag)
        git.push(git.remote('upstream'), git.branch, release_tag) if git.remote('upstream')
        puts "Version bumped: #{release_tag}"
      end
    end

    def write_update
      filedata = File.read('lib/napa/version.rb')
      changed_filedata = filedata.gsub("VERSION = '#{Napa::VERSION}'\n", "VERSION = '#{@new_version}'\n")
      File.open('lib/napa/version.rb',"w"){|file| file.puts changed_filedata}
    end

    def clean_staging_area?
      `git ls-files --deleted --modified --others --exclude-standard` == ""
    end

    def release_tag
      "v#{@new_version}"
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
napa-0.5.0 tasks/version.rake
napa-0.4.3 tasks/version.rake
napa-0.4.1 tasks/version.rake
napa-0.4.0 tasks/version.rake
napa-0.3.0 tasks/version.rake
napa-0.2.1 tasks/version.rake
napa-0.2.0 tasks/version.rake
napa-0.1.29 tasks/version.rake
napa-0.1.28 tasks/version.rake
napa-0.1.26 tasks/version.rake
napa-0.1.25 tasks/version.rake
napa-0.1.24 tasks/version.rake
napa-0.1.23 tasks/version.rake
napa-0.1.22 tasks/version.rake
napa-0.1.21 tasks/version.rake
napa-0.1.20 tasks/version.rake
napa-0.1.19 tasks/version.rake
napa-0.1.18 tasks/version.rake
napa-0.1.17 tasks/version.rake
napa-0.1.16 tasks/version.rake