From a580e17ada58d2fcd1a9095cb0734a307ab7a8ec Mon Sep 17 00:00:00 2001 From: Chaz Ruhl Date: Tue, 3 Feb 2015 11:10:09 -0600 Subject: [PATCH] updated README, reworked commit message, clean-up --- README.md | 8 +++++--- lib/chef/knife/spork-bump.rb | 10 ---------- lib/knife-spork/plugins/git.rb | 13 ++----------- 3 files changed, 7 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 545b505..f1c93b4 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ custom_plugin_path: "/home/me/spork-plugins" always_promote_remote: true skip_berkshelf: false role_match_file_name: true -bump_config: true +bump_comment: true json_options: indent: " " plugins: @@ -87,6 +87,7 @@ plugins: branch: some_branch bump_tag: false bump_commit: false + bump_comment: false irccat: server: irccat.mydomain.com port: 12345 @@ -138,8 +139,8 @@ The `always_promote_remote` directive allows you to tell spork promote to always The `skip_berkshelf` directive is a temporary flag added in [#138](https://github.com/jonlives/knife-spork/issues/138) to allow Berkshelf functionality to be optionally bypassed until Berkshelf 3 support has been added to knife-spork per [#85](https://github.com/jonlives/knife-spork/issues/85). It simply removed the :Berkshelf constant from the namespace used by knife-spork. #### Bump Comment -The 'bump_comment` directive tells spork to always prompt the user for a comment reguarding the changes to this version of the cookbook. This comment will be appended to the CHANGELOG.md file along with the new version # and the user name. This can also be done with the "--bump_comment" on the command line. -NOTE: See bump_tag & bump_commit under the Git plug-in +The 'bump_comment` directive tells spork to prompt the user for a comment reguarding the changes to this version of the cookbook. This comment will be appended to the CHANGELOG.md file along with the new version # and the user name. This can also be done with the "--bump_comment" on the command line. +NOTE: The bump_comment & bump_commit directives under the Git plug-in, allow spork to take this comment and use it as a git commit message. #### JSON Options The `json_options` directive allows you to tell spork to pass options to [pretty_generate](http://www.ruby-doc.org/stdlib-1.9.3/libdoc/json/rdoc/JSON.html#method-i-pretty_generate) to control the format of the resulting json @@ -266,6 +267,7 @@ Spork Bump This function lets you easily version your cookbooks without having to manually edit the cookbook's `metadata.rb` & `CHANGELOG.md` files. You can either specify the version level you'd like to bump (`major`, `minor`, or `patch`), or you can manually specify a version number. This might be used if, for example, you want to jump several version numbers in one go and don't want to have to run knife bump once for each number. If no bump level is specified, a patch level bump will be performed. Spork Bump can also be configured promt the user for a comment reguarding thier change. This comment will be appended to the CHANGELOG.md file along with the new version, and the current username. This is done either by using the '--bump_comment' option on the command line or by setting the bump_comment: directive to true. +NOTE: The bump_comment & bump_commit directives under the Git plug-in, allow spork to take this comment and use it as a git commit message. #### Usage ```bash diff --git a/lib/chef/knife/spork-bump.rb b/lib/chef/knife/spork-bump.rb index e083ae9..ca84725 100644 --- a/lib/chef/knife/spork-bump.rb +++ b/lib/chef/knife/spork-bump.rb @@ -64,8 +64,6 @@ def run self.config = Chef::Config.merge!(config) config[:cookbook_path] ||= Chef::Config[:cookbook_path] config[:bump_comment] ||= spork_config.bump_comment - config[:bump_tag] ||= spork_config.bump_tag - config[:bump_commit] ||= spork_config.bump_commit if @name_args.empty? show_usage @@ -109,14 +107,6 @@ def bump new_contents = File.read(metadata_file).gsub(/(version\s+['"])[0-9\.]+(['"])/, "\\1#{new_version}\\2") File.open(metadata_file, 'w'){ |f| f.write(new_contents) } - if config[:bump_tag] - ui.info "Bump Tag is enabled" - end - - if config[:bump_commit] - ui.info "Bump Commit is enabled" - end - if config[:bump_comment] changelog_file = "#{@cookbook.root_dir}/CHANGELOG.md" ui.info "Enter Change Log comment, then press Ctrl-D: " diff --git a/lib/knife-spork/plugins/git.rb b/lib/knife-spork/plugins/git.rb index 8654318..6579a5d 100644 --- a/lib/knife-spork/plugins/git.rb +++ b/lib/knife-spork/plugins/git.rb @@ -56,9 +56,9 @@ def after_bump } file = File.open change_file change_comment=[*file][last_comment_line + 1] - git_commit(change_comment) + git_commit('.', "[Knife-Spork] #{change_comment}") else - git_commit("Bumping #{cookbook.name} to #{new_version}") + git_commit('.',"[Knife-Spork] Bumping #{cookbook.name} to #{new_version}") end end end @@ -74,7 +74,6 @@ def after_promote_local else "master" end - git_commit(environment_path, "promote #{cookbooks.collect{ |c| "#{c.name}@#{c.version}" }.join(",")} to #{environments.join(",")}") git_push(branch) end @@ -88,14 +87,6 @@ def bump_tag config.bump_tag || false end - def bump_commit - config.bump_commit || false - end - - def bump_tag - config.bump_tag || false - end - private def git safe_require 'git'