### Install Bump Gem Source: https://github.com/gregorym/bump/blob/master/README.md Installs the 'bump' gem using the standard Ruby gem installation command. This makes the 'bump' command-line tool available in your system's PATH. ```bash gem install bump ``` -------------------------------- ### Changelog Format for Bump Source: https://context7.com/gregorym/bump/llms.txt Example of the CHANGELOG.md structure that Bump automatically updates. It shows the format before and after a version bump operation. ```markdown ## Next - Added new feature - Fixed bug ## v1.2.3 - 2024-01-15 - Previous changes ## v1.2.2 - 2024-01-01 - Earlier changes After running `bump patch --changelog`: ## Next ## v1.2.4 - 2024-01-20 - Added new feature - Fixed bug ## v1.2.3 - 2024-01-15 - Previous changes ``` -------------------------------- ### Gemspec Version File Format Source: https://context7.com/gregorym/bump/llms.txt Example of how Bump interacts with version information defined within a .gemspec file. Bump can automatically update the version string in this format. ```ruby # myapp.gemspec Gem::Specification.new do |s| s.name = "myapp" s.version = "1.2.3" # Bump will update this s.summary = "My application" end # Alternative format Gem::Specification.new "myapp", "1.2.3" do |s| s.summary = "My application" end ``` -------------------------------- ### Get Current Version (Ruby API) Source: https://context7.com/gregorym/bump/llms.txt Retrieves the current version string of the project programmatically using the Bump Ruby API. It also provides a method to get the path to the version file. ```ruby require "bump" # Get current version version = Bump::Bump.current puts version # Output: "1.2.3" # Get version file path file = Bump::Bump.file puts file # Output: "lib/myapp/version.rb" ``` -------------------------------- ### Bump Patch Version (CLI) Source: https://context7.com/gregorym/bump/llms.txt Increments the patch version for bug fixes. Options include `--no-commit` to skip git commits, `--no-bundle` to skip running bundle install, `--tag` to create a git tag, and `--tag-prefix` to customize the tag prefix. ```bash bump patch # Output: Bump version 1.2.3 to 1.2.4 # Without committing to git bump patch --no-commit # Output: 1.2.4 # Without running bundle install bump patch --no-bundle # Output: 1.2.4 # With git tagging bump patch --tag # Creates commit and tag v1.2.4 # With custom tag prefix bump patch --tag --tag-prefix "release-" # Creates tag release-1.2.4 ``` -------------------------------- ### Show Next Version (CLI) Source: https://context7.com/gregorym/bump/llms.txt Previews the next version number without making any changes to the project files. This allows for planning and verification. ```bash bump show-next patch # Output: 1.2.4 bump show-next minor # Output: 1.3.0 bump show-next major # Output: 2.0.0 ``` -------------------------------- ### Run Bump CLI Commands Source: https://context7.com/gregorym/bump/llms.txt Execute version bumping operations using the Bump CLI. Supports various actions like patching, setting specific versions, and managing changelogs. Outputs status and results. ```ruby output, status = Bump::Bump.run("patch", commit: false, bundle: false, tag: false ) output, status = Bump::Bump.run("patch", commit_message: "[skip ci]" ) output, status = Bump::Bump.run("set", version: "2.0.0") output, status = Bump::Bump.run("patch", replace_in: ["README.md", "docs/version.txt"] ) output, status = Bump::Bump.run("patch", changelog: true) output, status = Bump::Bump.run("current") puts output # "1.2.3" output, status = Bump::Bump.run("file") puts output # "lib/myapp/version.rb" ``` -------------------------------- ### VERSION File Format Source: https://context7.com/gregorym/bump/llms.txt Demonstrates the simplest version file format supported by Bump: a plain text file containing only the version number. Bump reads and writes to this file directly. ```text 1.2.3 ``` -------------------------------- ### Show Version File Path (CLI) Source: https://context7.com/gregorym/bump/llms.txt Displays the absolute path to the file that Bump is currently using to manage the version information. ```bash bump file # Output: lib/foo/version.rb ``` -------------------------------- ### Bump Pre-release Version (CLI) Source: https://context7.com/gregorym/bump/llms.txt Cycles through pre-release identifiers (alpha, beta, rc, release). Each execution advances the pre-release version according to semantic versioning rules. ```bash # From 1.2.3 bump pre # Output: 1.2.3-alpha # From 1.2.3-alpha bump pre # Output: 1.2.3-beta # From 1.2.3-beta bump pre # Output: 1.2.3-rc # From 1.2.3-rc bump pre # Output: 1.2.3 ``` -------------------------------- ### Bump Command Line Options Source: https://github.com/gregorym/bump/blob/master/README.md Illustrates various command-line options for the 'bump' tool to customize its behavior. These options control committing, tagging, bundling, and updating changelogs. ```bash bump patch --no-commit bump patch --tag bump patch --tag --tag-prefix v- bump patch --no-bundle bump patch --replace-in Readme.md bump patch --commit-message "Something extra" bump patch -m "Something extra" bump patch --changelog EDITOR="subl -n -w" bump patch --edit-changelog ``` -------------------------------- ### Bump Version Command Line Usage Source: https://github.com/gregorym/bump/blob/master/README.md Demonstrates common command-line operations for the 'bump' tool. This includes checking the current version, bumping to the next version (major, minor, patch, pre), and showing the next version without applying changes. ```bash bump current bump patch bump show-next patch bump file ``` -------------------------------- ### Execute Bump Rake Tasks Source: https://context7.com/gregorym/bump/llms.txt Perform version operations using Rake tasks, with options configurable via environment variables. Supports displaying versions, bumping, and setting specific versions. ```bash # Display current version rake bump:current # Output: 1.2.3 # Display next version rake bump:show-next INCREMENT=patch # Output: 1.2.4 rake bump:show-next INCREMENT=minor # Output: 1.3.0 # Display version file path rake bump:file # Output: lib/myapp/version.rb # Bump versions rake bump:patch rake bump:minor rake bump:major rake bump:pre # Bump with options via environment variables rake bump:patch TAG=true rake bump:patch TAG=true TAG_PREFIX=v- rake bump:patch COMMIT=false TAG=false rake bump:minor BUNDLE=false rake bump:patch COMMIT_MESSAGE="release candidate" # Set specific version VERSION=2.0.0 rake bump:set ``` -------------------------------- ### Show Current Version (CLI) Source: https://context7.com/gregorym/bump/llms.txt Displays the current version of a gem or cookbook by reading from the detected version file. The `--value-only` flag is useful for scripting. ```bash bump current # Output: 1.2.3 # With --value-only flag for scripting bump current --value-only # Output: 1.2.3 ``` -------------------------------- ### Chef Metadata Version Format Source: https://context7.com/gregorym/bump/llms.txt Illustrates the version definition within a Chef cookbook's metadata.rb file. Bump can parse and update the version string in this format. ```ruby # metadata.rb name "my_cookbook" version "1.2.3" maintainer "Your Name" ``` -------------------------------- ### Run Version Bump (Ruby API) Source: https://context7.com/gregorym/bump/llms.txt Executes a version bump operation programmatically with full control over options such as tagging and custom tag prefixes. It returns the output and status of the operation. ```ruby require "bump" # Basic patch bump (commits by default) output, status = Bump::Bump.run("patch") puts output if status == 0 # Output: "1.2.4" # Bump with tagging output, status = Bump::Bump.run("patch", tag: true) # Bump with custom tag prefix output, status = Bump::Bump.run("patch", tag: true, tag_prefix: "v-") # Creates tag: v-1.2.4 ``` -------------------------------- ### Configure Bump Rake Tasks Source: https://context7.com/gregorym/bump/llms.txt Set up and configure default behaviors for Bump's Rake tasks within your Rakefile. This allows for consistent release settings across your project. ```ruby # Rakefile require "bump/tasks" # Optional: Configure defaults Bump.tag_by_default = true # Always create git tags Bump.replace_in_default = ["README.md"] # Always update README Bump.changelog = true # Always update CHANGELOG.md # Bump.changelog = :editor # Open editor for changelog ``` -------------------------------- ### Bump Ruby API Usage Source: https://github.com/gregorym/bump/blob/master/README.md Demonstrates how to use the 'bump' gem's Ruby API for version management. This includes accessing current and next versions, file paths, and executing bump operations with various options. ```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' ``` -------------------------------- ### Version Module Format Source: https://context7.com/gregorym/bump/llms.txt Shows how Bump can update a version constant defined within a Ruby module, typically found in lib/**/version.rb or lib/**/*.rb files. Supports different constant naming conventions. ```ruby # lib/myapp/version.rb module MyApp VERSION = "1.2.3" end # Alternative capitalization module MyApp Version = "1.2.3" end ``` -------------------------------- ### Replace Version in Additional Files (CLI) Source: https://context7.com/gregorym/bump/llms.txt Updates the version string in specified additional files, in addition to the main version file. This ensures consistency across documentation or other relevant files. ```bash bump patch --replace-in README.md # Updates version in both version file and README.md ``` -------------------------------- ### Set Specific Version (CLI) Source: https://context7.com/gregorym/bump/llms.txt Sets the version to an exact specified value, bypassing the automatic incrementing logic. This is useful for direct version control. ```bash bump set 2.0.0 # Output: 2.0.0 ``` -------------------------------- ### Custom Commit Messages (CLI) Source: https://context7.com/gregorym/bump/llms.txt Allows customization of the git commit message when bumping versions. The `--commit-message` or `-m` flag can be used, with the `%` placeholder available for dynamic tag insertion. ```bash bump patch --commit-message "Release notes here" # Commit message: v1.2.4 Release notes here bump patch -m "[skip ci]" # Commit message: v1.2.4 [skip ci] # Use % placeholder for custom formatting bump patch -m "chore: release %" # Commit message: chore: release v1.2.4 ``` -------------------------------- ### Calculate Next Version (Ruby API) Source: https://context7.com/gregorym/bump/llms.txt Calculates the next version number based on the current version and the specified bump type (patch, minor, major, pre). It can also handle pre-release version sequencing. ```ruby require "bump" current = Bump::Bump.current # "1.2.3" # Calculate next versions Bump::Bump.next_version("patch") # => "1.2.4" Bump::Bump.next_version("minor") # => "1.3.0" Bump::Bump.next_version("major") # => "2.0.0" Bump::Bump.next_version("pre") # => "1.2.3-alpha" # With pre-release version Bump::Bump.next_version("pre", "1.2.3-alpha") # => "1.2.3-beta" Bump::Bump.next_version("pre", "1.2.3-beta") # => "1.2.3-rc" Bump::Bump.next_version("pre", "1.2.3-rc") # => "1.2.3" ``` -------------------------------- ### Update Changelog (CLI) Source: https://context7.com/gregorym/bump/llms.txt Automatically updates the CHANGELOG.md file by adding a new heading for the bumped version. The `--edit-changelog` option allows opening the changelog in an editor before committing. ```bash bump patch --changelog # Updates CHANGELOG.md with new version heading # Open changelog in editor before committing EDITOR="code -w" bump patch --edit-changelog ``` -------------------------------- ### Bump Minor Version (CLI) Source: https://context7.com/gregorym/bump/llms.txt Increments the minor version for backward-compatible new features. This command updates the version number in the relevant files. ```bash bump minor # Output: Bump version 1.2.3 to 1.3.0 ``` -------------------------------- ### Bump Rake Tasks Source: https://github.com/gregorym/bump/blob/master/README.md Shows how to integrate 'bump' functionality into Rake tasks within a Rakefile. This allows for programmatic control over version bumping and related actions. ```ruby # Rakefile require "bump/tasks" # Bump.tag_by_default = false # Bump.replace_in_default = ["Readme.md"] # Bump.changelog = true # Bump.changelog = :editor # rake bump:current # rake bump:show-next INCREMENT=minor # rake bump:file # rake bump:major # rake bump:patch # rake bump:minor # rake bump:pre # rake bump:patch TAG=false BUNDLE=false # rake bump:patch TAG=true TAG_PREFIX=v- # rake bump:patch COMMIT=false TAG=false # rake bump:minor BUNDLE=false # rake bump:minor COMMIT_MESSAGE="release it" ``` -------------------------------- ### Bump Major Version (CLI) Source: https://context7.com/gregorym/bump/llms.txt Increments the major version for breaking changes. This command updates the version number in the relevant files and can be used for significant updates. ```bash bump major # Output: Bump version 1.2.3 to 2.0.0 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.