midwire_common 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ *0.1.7* (December 31, 2013)
2
+
3
+ * Added branch checking to guard against bumping version on master branch
4
+
1
5
  *0.1.6* (December 31, 2013)
2
6
 
3
7
  * Handle nested modules
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Midwire Common Gem
2
2
 
3
- **Version: 0.1.6**
3
+ **Version: 0.1.7**
4
4
 
5
5
  A handy Ruby library for Midwire development
6
6
 
@@ -1,6 +1,6 @@
1
1
  original_verbosity = $VERBOSE
2
2
  $VERBOSE = nil
3
3
  module MidwireCommon
4
- VERSION = "0.1.6"
4
+ VERSION = "0.1.7"
5
5
  end
6
6
  $VERBOSE = original_verbosity
@@ -2,6 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'readline'
4
4
  require 'fileutils'
5
+ require 'pry'
5
6
 
6
7
  module Bundler
7
8
  class GemHelper
@@ -31,6 +32,7 @@ namespace :version do
31
32
 
32
33
  desc "Increment the patch version and write changes to the changelog"
33
34
  task :bump_patch do
35
+ exit unless check_branch
34
36
  major, minor, patch = read_version
35
37
  patch = patch.to_i + 1
36
38
  write_version([major, minor, patch])
@@ -44,6 +46,7 @@ namespace :version do
44
46
 
45
47
  desc "Increment the minor version and write changes to the changelog"
46
48
  task :bump_minor do
49
+ exit unless check_branch
47
50
  major, minor, patch = read_version
48
51
  minor = minor.to_i + 1
49
52
  patch = 0
@@ -53,6 +56,7 @@ namespace :version do
53
56
 
54
57
  desc "Increment the major version and write changes to the changelog"
55
58
  task :bump_major do
59
+ exit unless check_branch
56
60
  major, minor, patch = read_version
57
61
  major = major.to_i + 1
58
62
  minor = 0
@@ -120,4 +124,30 @@ namespace :version do
120
124
  end
121
125
  response
122
126
  end
127
+
128
+ def current_branch
129
+ `git rev-parse --abbrev-ref HEAD`.chomp
130
+ end
131
+
132
+ def check_branch
133
+ if current_branch == 'master'
134
+ puts "You typically do not want to bump versions on the 'master' branch"
135
+ puts "unless you plan to rebase or back-merge into the 'develop'."
136
+ puts ""
137
+ puts "If you don't care or don't know what I'm talking about just enter 'y'"
138
+ puts "and continue."
139
+ puts ""
140
+ puts "Optionally, you can hit 'n' to abort and switch your branch to 'develop'"
141
+ puts "or whatever branch you use for development, bump the version, merge to"
142
+ puts "'master' then 'rake release'."
143
+ puts ""
144
+ puts "Do you really want to bump the version on your 'master' branch? (y/n)"
145
+ while (line = $stdin.gets.chomp)
146
+ return true if line.match /[yY]/
147
+ puts "Aborting version bump."
148
+ return false
149
+ end
150
+ end
151
+ return true
152
+ end
123
153
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: midwire_common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -197,7 +197,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
197
197
  version: '0'
198
198
  segments:
199
199
  - 0
200
- hash: -4180799989477412744
200
+ hash: -1122474148263051726
201
201
  required_rubygems_version: !ruby/object:Gem::Requirement
202
202
  none: false
203
203
  requirements:
@@ -206,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
206
  version: '0'
207
207
  segments:
208
208
  - 0
209
- hash: -4180799989477412744
209
+ hash: -1122474148263051726
210
210
  requirements: []
211
211
  rubyforge_project:
212
212
  rubygems_version: 1.8.23