Code Monkey home page Code Monkey logo

bump's Introduction

Gem Version

A gem to bump versions of gems and chef-cookbooks.

  • bumps version major / minor / patch / pre
  • bundles
  • commits changes

Installation

gem install bump

Usage

Show current version

bump current

0.1.2

Bump (major, minor, patch, pre)

bump patch

Bump version 0.1.2 to 0.1.3

Show next version

bump show-next patch

0.1.3

Show version file path

bump file

lib/foo/version.rb

Options

--no-commit

Do not commit after bumping.

bump patch --no-commit

--tag

Will add a git tag like v1.2.3 (if the current project is a git repository and --no-commit has not been given).

bump patch --tag

The --tag-prefix option can change the tag prefix:

bump patch --tag --tag-prefix v-     # tag as v-1.2.3
bump patch --tag --tag-prefix ""     # tag as 1.2.3

--no-bundle

Do not run bundle command after bumping.

bump patch --no-bundle

--replace-in

Bump the version in additional files.

bump patch --replace-in Readme.md

--commit-message [MSG], -m [MSG]

Append additional information to the commit message.

bump patch --commit-message "Something extra"

or

bump patch -m "Something extra"

--changelog

Updates CHANGELOG.md when bumping. This requires a heading (starting with ##) that includes the previous version and a heading above that, for example:

### Next
- Added bar

### v0.0.0 - 2019-12-24
- Added foo

--edit-changelog

Updates CHANGELOG.md when bumping (see above), and opens the changelog in an editor specified in $EDITOR (or vi), then waits for the editor to be closed and continues.

EDITOR="subl -n -w" bump patch --edit-changelog

Rake

# Rakefile
require "bump/tasks"

#
# do not always tag the version
# Bump.tag_by_default = false
#
# bump the version in additional files
# Bump.replace_in_default = ["Readme.md"]
#
# Maintain changelog:
# Bump.changelog = true
# Opens the changelog in an editor when bumping
# Bump.changelog = :editor
rake bump:current                           # display current version
rake bump:show-next INCREMENT=minor         # display next minor version
rake bump:file                              # display version file path

# bumping using defaults for `COMMIT`, `TAG`, and `BUNDLE`
rake bump:major
rake bump:patch
rake bump:minor
rake bump:pre

# bumping with option(s)
rake bump:patch TAG=false BUNDLE=false      # commit, but don't tag or run `bundle`
rake bump:patch TAG=true TAG_PREFIX=v-      # tag with a prefix 'v-' ex. the tag will look like v-0.0.1
rake bump:patch COMMIT=false TAG=false      # don't commit, don't tag
rake bump:minor BUNDLE=false                # don't run `bundle`
rake bump:minor COMMIT_MESSAGE="release it" # custom commit message, appended to version

Ruby

require "bump"
Bump::Bump.current        # -> "1.2.3"
Bump::Bump.next_version("patch")        # -> "1.2.4"
Bump::Bump.file           # -> "lib/foo/version.rb"
Bump::Bump.run("patch")   # -> version changed
Bump::Bump.run("patch", tag: true, tag_prefix: 'v-') # -> version changed with tagging with '-v' as prefix
Bump::Bump.run("patch", commit: false, bundle:false, tag:false) # -> version changed with options
Bump::Bump.run("patch", commit_message: '[no ci]') # -> creates a commit message with 'v1.2.3 [no ci]' instead of default: 'v1.2.3'

Supported locations

  • VERSION file with 1.2.3
  • gemspec with gem.version = "1.2.3" or Gem:Specification.new "gem-name", "1.2.3" do
  • lib/**/version.rb file with VERSION = "1.2.3"
  • metadata.rb with version "1.2.3"
  • VERSION = "1.2.3" in lib/**/*.rb

Author

Gregory
License: MIT

bump's People

Contributors

abangratz avatar amatsuda avatar apanzerj avatar aried3r avatar bergholdt avatar bethesque avatar bukharih avatar davefp avatar dnd avatar gizipp avatar goyalmunish avatar gregorym avatar grosser avatar hauleth avatar hidr0 avatar jasonkarns avatar jasonwbarnett avatar jvanderhoof avatar modsognir avatar mscoutermarsh avatar olleolleolle avatar randome avatar revolter avatar robcarruthers avatar salzig avatar tamgrosser avatar tobias-grasse avatar ysv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

bump's Issues

bumping triggers bundle which updates unrelated gem versions

given a gemspec project with Gemfile.lock including outdated versions, a bump minor updates the gems version in Gemfile.lock ... but it should only update the version of the gemspec gem ... I tried with --conservative flag, but that's not supported for a bundle or bundle install 🤷‍♂
so only workaround I can see if either setting some config flag or running bundle update <gem name> --conservative (might be tricky to find the name)
this seems to be triggered by the ruby version I'm on not matching the version it was last bundled with ... so this might be unfixable since it needs to bump to be able to bundle :(

Deprecation warning `Bundler.with_clean_env`

Running rake bump:X now shows the deprecation warning

[DEPRECATED] Bundler.with_clean_envhas been deprecated in favor ofBundler.with_unbundled_env. If you instead want the environment before bundler was originally loaded, use Bundler.with_original_env(called at /.../gems/bump-0.9.0/lib/bump.rb:160)

Bump.tag_by_default = true doesn't work

With this Rakefile

require "bundler/gem_tasks"

require 'rake/testtask'
require 'bump/tasks'
Bump.tag_by_default = true

Rake::TestTask.new do |t|
  t.libs << 'test'
end

desc 'Run tests'
task :default => :test

I get

NoMethodError: undefined method `tag_by_default=' for Bump:Module

How to define build version or metadata

Semantic versioning supports a metadata version denoted by appending a plus sign. It declared in semver spec item no 10.

https://semver.org/#spec-item-10

  1. Build metadata MAY be denoted by appending a plus sign and a series of dot-separated identifiers immediately following the patch or pre-release version. Identifiers MUST comprise only ASCII alphanumerics and hyphens [0-9A-Za-z-]. Identifiers MUST NOT be empty. Build metadata MUST be ignored when determining version precedence. Thus two versions that differ only in the build metadata, have the same precedence. Examples: 1.0.0-alpha+001, 1.0.0+20130313144700, 1.0.0-beta+exp.sha.5114f85, 1.0.0+21AF26D3----117B344092BD.

In my case, I need to attach the build information like a short commit embedded into version information. I've tried to define a version like this in the VERSION file 1.0.0+a34wsfr. But when I tried to run bump current it returned 1.0.0 instead of 1.0.0+a34wsfr. Is it expected? And how to properly set the build version within this gem?

SNAPSHOT versions

Using the commands in this order:
bump set 1.0.1-SNAPSHOT
bump set 1.0.1

Should result in final version being 1.0.1, but it is still 1.0.1-SNAPSHOT. The replace seems to only replace numerical characters.

Please extend this. Thanks!

Rakefile Configuration

How could the tag_prefix = "" be made the default for a Rakefile?

In other words, I want no prefix:

$ rake bump:patch
1.0.1

Instead of the default prefix v:

$ rake bump:patch
v1.0.1

Feature request: add a timestamp to a file named VERSION_TIMESTAMP

It would be very nice to have a timestamp added somewhere. For instance, a VERSION_TIMESTAMP alongside the VERSION file.

Use case: I wished to display at the footer of my Rails app the current app release version and release date/time. It would be very usefull to parse Rails.root/VERISON_TIMESTAMP to load that info into a constant on app initialization.

bump:pre is too simple

The current pre-release bumping (implemented in #11) is very naïve and not really intuitive:

» rake bump:current
Current version: 1.2.3
» rake bump:pre
Bump version 1.2.3 to 1.2.3-alpha
» rake bump:pre
Bump version 1.2.3-alpha to 1.2.3-beta
» rake bump:pre
Bump version 1.2.3-beta to 1.2.3-rc
» rake bump:pre
Bump version 1.2.3-rc to 1.2.3
» rake bump:pre
Bump version 1.2.3 to 1.2.3-alpha
» rake bump:pre
Bump version 1.2.3-alpha to 1.2.3-beta

If you need e.g. three beta versions before moving to a release candidate, bump is of no help.

I would prefer if repeated calls to bump:pre increased a number. Perhaps that requires separate bump:alpha, bump:beta and bump:rc commands?

» rake bump:current
Current version: 1.2.3
» rake bump:alpha
Bump version 1.2.3 to 1.2.3-alpha1
» rake bump:alpha
Bump version 1.2.3-alpha1 to 1.2.3-alpha2
» rake bump:beta
Bump version 1.2.3-alpha2 to 1.2.3-beta1
» rake bump:rc
Bump version 1.2.3-beta1 to 1.2.3-rc1
» rake bump:rc
Bump version 1.2.3-rc1 to 1.2.3-rc2
» rake bump:rc
Bump version 1.2.3-rc2 to 1.2.3-rc3

Changelog without commit or a way to add Changelog message in between.

Hello is there a way to separate the bump in two commands?

The first command to:

  1. bump the version in the version.rb
  2. add the version to Changelog.md
  3. bundle update

I then want to go in and write my information in Changelog.md

Then I want to commit with the automatic message and tag the commit.

RSpec 3 and `should` syntax

I'm about to submit a PR to bump rspec to v3 (for features like fit and simplified boolean tags, etc).

Since implicit should syntax is deprecated in RSpec 3, would you prefer the syntax be set to should explicitly or just switch to expect syntax directly?

Support manually specifying the version

Sometimes when working on a project with a larger codebase just bumping a single digit at a time doesn't quite work, and the version needs to be able to be manually given, so as to avoid numerous bump messages in the commit log. I don't see a way to do this currently with bump.

I would like to contribute a pull request, as all of the framework is currently in place to support this. I'm just not sure how this would want to be handled when running from the command line. I was thinking of identifying the version number, and passing it with the options hash as :version.

Add Custom elements to commit message

I'm using Circle CI to build and push our gems directly to our gem repo. I'd like to be able to append a message ([ci skip] in this case) to the commit so Circle won't run tests.

Something like this is what I'm thinking:

Bump::Bump.run("patch", commit_message: '[ci skip]')

which would result in the message: 'v1.2.3 [ci skip]'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.