bummr 0.0.2 → 0.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e4e45c2c7ad39b56f06d1f4d1d9b92e81b9cfe99
4
- data.tar.gz: 3926625ea98f21b174811801d4651fe57529714e
3
+ metadata.gz: 25ae2fed8478c1b44bd75fdb39aa01d2c7baa196
4
+ data.tar.gz: f01bf40b1efb8b489d7724f8411dd6f48d8655dd
5
5
  SHA512:
6
- metadata.gz: 25f941aa5afaf12e341ca4418a456431e6fa7d1bbc1ad993d96fb848dc67a49bdbf26cff85c4e584037f5024cb4423f0cc5cfc9ccdf80cf61b7195e8f6fc7368
7
- data.tar.gz: 55f6cb69285537ec993bbfd573c33ae1b550656f4a8b14b7e5906c7b967cfb09a47ad3d384e188e684c524061189538e465a1c404ebb731c5815a36ee88e682f
6
+ metadata.gz: ff5beb79273d4ccedd442f83e620e4f81df35f544ae4fb452d3c381dda7930e222d35468f9ad990d5afa2eb7c3889cc01c6f37062a14c1237d315aab906bbe67
7
+ data.tar.gz: 72925d9a0abff30b1c7fb1ead19ddeae96177029e0c61622d7303619fcda4da281ecfcc72f0588b6d690e0c4de5566198f83fdd2f4bd46c3b4646d4c35af6c88
data/README.md CHANGED
@@ -1,46 +1,47 @@
1
1
  # Bummr
2
2
 
3
- Updating Gems one by one is a Bummr: especially when one gem causes your build
3
+ Updating Gems one by one is a bumm(e)r: especially when one gem causes your build
4
4
  to fail.
5
5
 
6
- The *Bummr* gem allows you to automatically update all gems which pass your
6
+ Gems should be updated in [separate commits](http://ilikestuffblog.com/2012/07/01/you-should-update-one-gem-at-a-time-with-bundler-heres-how/).
7
+
8
+ The bummr gem allows you to automatically update all gems which pass your
7
9
  build in separate commits, and logs the name and sha of each gem that fails.
8
10
 
11
+ Bummr assumes you have good test coverage and follow a [pull-request workflow] (https://help.github.com/articles/using-pull-requests/) with `master` as your
12
+ default branch.
13
+
14
+ Please note that this gem is *alpha* stage and may have bugs.
15
+
9
16
  ## Installation
10
17
 
11
18
  ```bash
12
19
  $ gem install bummr
13
20
  ```
14
21
 
15
- Add a file called `.bummr-build.sh` to the root of your git directory.
16
-
17
- Here is a suggested `.bummr-build.sh` which will `bundle exec rake` 4 times:
18
-
19
- `.bummr-build.sh`
22
+ By default, bummr will use `bundle exec rake` to run your build.
20
23
 
21
- ```bash
22
- #!/bin/sh
23
- MAX_TRIES=4
24
- COUNT=0
25
- EXIT=0
26
-
27
- while [ $COUNT -lt $MAX_TRIES ] && [ $EXIT -eq 0 ]; do
28
- git log --pretty=format:'%s' -n 1
29
- echo "\nRunning test suite... $COUNT of $MAX_TRIES"
30
- bundle exec rake
31
- let EXIT=$?
32
- let COUNT=COUNT+1
33
- done
34
-
35
- exit $EXIT
36
- ```
24
+ To customize your build command, `export BUMMR_TEST="./bummr-build.sh"`
37
25
 
38
- Commit this file and merge it to master before running `bummr update`!
26
+ If you prefer, you can [run the build more than once]
27
+ (https://gist.github.com/lpender/f6b55e7f3649db3b6df5), to protect against
28
+ brittle tests and false positives.
39
29
 
40
30
  ## Usage:
41
31
 
42
- - Create a new, clean branch off of master.
43
- - Run `bummr update`
32
+ Using bummr can take anywhere from a few minutes to several hours, depending
33
+ on the number of outdated gems you have and the number of tests in your test
34
+ suite.
35
+
36
+ - After installing, create a new, clean branch off of master.
37
+ - Run `bummr update`. This may take some time.
38
+ - `Bummr` will give you the opportunity to interactively rebase your branch
39
+ before running the tests. Delete any commits for gems which you don't want
40
+ to update and close the file.
41
+ - At this point, you can leave `bummr` to work for some time.
42
+ - If your build fails, `bummr` will attempt to automatically remove breaking
43
+ commits, until the build passes, logging any failures to `/log/bummr.log`.
44
+ - Once your build passes, open a pull-request and merge it to your `master` branch.
44
45
 
45
46
  ##### `bummr update`
46
47
 
@@ -48,7 +49,7 @@ Commit this file and merge it to master before running `bummr update`!
48
49
  - Updates them each individually, using `bundle update --source #{gemname}`
49
50
  - Commits each gem update separately, with a commit message like:
50
51
 
51
- `gemname, {0.0.1 -> 0.0.2}`
52
+ `Update gemname from 0.0.1 to 0.0.2`
52
53
 
53
54
  - Runs `git rebase -i master` to allow you the chance to review and make changes.
54
55
  - Runs `bummr test`
@@ -63,10 +64,13 @@ Commit this file and merge it to master before running `bummr update`!
63
64
  - `git bisect`s against master.
64
65
  - Finds the bad commit and attempts to remove it.
65
66
  - Logs the bad commit in `log/bummr.log`.
66
- - Runs `bummr test`
67
+ - Runs `bummr test`.
67
68
 
68
69
  ## Notes
69
70
 
71
+ - Bummr assumes you have good test coverage and follow a [pull-request workflow]
72
+ (https://help.github.com/articles/using-pull-requests/) with `master` as your
73
+ default branch.
70
74
  - Once the build passes, you can push your branch and create a pull-request!
71
75
  - You may wish to `tail -f log/bummr.log` in a separate terminal window so you
72
76
  can see which commits are being removed.
@@ -74,13 +78,11 @@ Commit this file and merge it to master before running `bummr update`!
74
78
  which case you will have to remove it manually, continue the rebase, and
75
79
  run `bummr test` again.
76
80
 
77
- ## Contributing
81
+ ## Developing
82
+
83
+ `rake build` to build locally
78
84
 
79
- 1. Fork it ( https://github.com/lpender/bummr/fork )
80
- 2. Create your feature branch (`git checkout -b my-new-feature`)
81
- 3. Commit your changes (`git commit -am 'Add some feature'`)
82
- 4. Push to the branch (`git push origin my-new-feature`)
83
- 5. Create a new Pull Request
85
+ `gem install --local ~/dev/mine/bummr/pkg/bummr-0.0.X.gem` in the app you wish to use it with.
84
86
 
85
87
  ## Wanted
86
88
 
data/bummr.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["lpender@gmail.com"]
11
11
  spec.summary = %q{Helper script to intelligently update your Gemfile}
12
12
  spec.description = %q{See Readme}
13
- spec.homepage = ""
13
+ spec.homepage = "https://github.com/lpender/bummr"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
@@ -18,11 +18,11 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency 'thor'
22
- spec.add_dependency 'colorize'
21
+ spec.add_dependency 'thor', "~> 0.19"
22
+ spec.add_dependency 'colorize', "~> 0.7"
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.7"
25
25
  spec.add_development_dependency "rake", "~> 10.0"
26
- spec.add_development_dependency 'rspec'
27
- spec.add_development_dependency 'pry'
26
+ spec.add_development_dependency 'rspec', "~> 0"
27
+ spec.add_development_dependency 'pry', "~> 0"
28
28
  end
data/lib/bummr/cli.rb CHANGED
@@ -3,6 +3,8 @@ require 'thor'
3
3
  require 'open3'
4
4
  require 'colorize'
5
5
 
6
+ TEST_COMMAND = ENV["BUMMR_TEST"] || "bundle exec rake"
7
+
6
8
  module Bummr
7
9
  class CLI < Thor
8
10
  desc "check", "Run automated checks to see if bummr can be run"
@@ -16,14 +18,24 @@ module Bummr
16
18
  errors.push message
17
19
  end
18
20
 
19
- unless File.file?(".bummr-build.sh") && File.executable?(".bummr-build.sh")
20
- message = "You must have a file '.bummr-build.sh' which runs your build"
21
+ unless File.directory? "log"
22
+ message = "There is no log directory or you are not in the root"
21
23
  say message.red
22
24
  errors.push message
23
25
  end
24
26
 
25
- unless File.directory? "log"
26
- message = "There is no log directory or you are not in the root"
27
+ status = `git status`
28
+
29
+ if status.index 'are currently'
30
+ message = ""
31
+
32
+ if status.index 'rebasing'
33
+ message += "You are already rebasing. "
34
+ elsif status.index 'bisecting'
35
+ message += "You are already bisecting. "
36
+ end
37
+
38
+ message += "Make sure `git status` is clean"
27
39
  say message.red
28
40
  errors.push message
29
41
  end
@@ -48,11 +60,11 @@ module Bummr
48
60
  say "To run Bummr, you must:"
49
61
  say "- Be in the root path of a clean git branch off of master"
50
62
  say "- Have no commits or local changes"
51
- say "- Have a file, '.bummr-build.sh' on master that runs your build"
52
63
  say "- Have a 'log' directory, where we can place logs"
53
64
  say "- Have your build configured to fail fast (recommended)"
54
65
  say "- Have locked any Gem version that you don't wish to update in your Gemfile"
55
66
  say "- It is recommended that you lock your versions of `ruby` and `rails in your Gemfile`"
67
+ say "Your test command is: '#{TEST_COMMAND}'"
56
68
 
57
69
  if yes? "Are you ready to use Bummr? (y/n)"
58
70
  check
@@ -65,18 +77,31 @@ module Bummr
65
77
  say outdated_gems_to_update.map { |g| "* #{g}" }.join("\n")
66
78
 
67
79
  outdated_gems_to_update.each_with_index do |gem, index|
68
- message = "#{gem[:name]}, {#{gem[:current_version]} -> #{gem[:spec_version]}}"
69
- say "Updating #{message}, #{index+1} of #{outdated_gems_to_update.count}"
80
+ say "Updating #{gem[:name]}: #{index+1} of #{outdated_gems_to_update.count}"
70
81
 
71
82
  system("bundle update --source #{gem[:name]}")
72
- system("git commit -am '#{message}'")
83
+ updated_version = `bundle list | grep " #{gem[:name]} "`.split('(')[1].split(')')[0]
84
+ message = "Update #{gem[:name]} from #{gem[:current_version]} to #{updated_version}"
85
+
86
+ if gem[:spec_version] != updated_version
87
+ log("#{gem[:name]} not updated from #{gem[:current_version]} to latest: #{gem[:spec_version]}")
88
+ end
89
+
90
+ unless gem[:current_version] == updated_version
91
+ say message.green
92
+ system("git commit -am '#{message}'")
93
+ else
94
+ log("#{gem[:name]} not updated")
95
+ end
73
96
  end
74
97
 
75
98
  say "Choose which gems to update"
76
99
  system("git rebase -i master")
77
- end
78
100
 
79
- test
101
+ log "Running Update + #{Time.now}"
102
+
103
+ test
104
+ end
80
105
  else
81
106
  say "Thank you!".green
82
107
  end
@@ -85,10 +110,10 @@ module Bummr
85
110
  desc "test", "Test for a successful build and bisect if necesssary"
86
111
  def test
87
112
  check(false)
113
+ `bundle`
88
114
  say "Testing the build!".green
89
115
 
90
- if system("./.bummr-build.sh") == false
91
- `bundle`
116
+ if system(TEST_COMMAND) == false
92
117
  bisect
93
118
  else
94
119
  say "Passed the build!".green
@@ -101,11 +126,10 @@ module Bummr
101
126
  def bisect
102
127
  check(false)
103
128
  say "Bad commits found! Bisecting...".red
104
- log "Bad commits found: #{Time.now}"
105
129
 
106
130
  system("git bisect start head master")
107
131
 
108
- Open3.popen2e("git bisect run ./.bummr-build.sh") do |std_in, std_out_err|
132
+ Open3.popen2e("git bisect run #{TEST_COMMAND}") do |std_in, std_out_err|
109
133
  while line = std_out_err.gets
110
134
  puts line
111
135
 
@@ -124,6 +148,7 @@ module Bummr
124
148
  private
125
149
 
126
150
  def log(message)
151
+ say message
127
152
  system("touch log/bummr.log && echo '#{message}' >> log/bummr.log")
128
153
  end
129
154
 
data/lib/bummr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Bummr
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bummr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Pender
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-16 00:00:00.000000000 Z
11
+ date: 2016-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '0.19'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '0.19'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: colorize
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '0.7'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '0.7'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -70,28 +70,28 @@ dependencies:
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: pry
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  description: See Readme
@@ -105,7 +105,6 @@ files:
105
105
  - ".gitignore"
106
106
  - ".ruby-version"
107
107
  - Gemfile
108
- - LICENSE.txt
109
108
  - README.md
110
109
  - Rakefile
111
110
  - bin/bummr
@@ -113,7 +112,7 @@ files:
113
112
  - lib/bummr.rb
114
113
  - lib/bummr/cli.rb
115
114
  - lib/bummr/version.rb
116
- homepage: ''
115
+ homepage: https://github.com/lpender/bummr
117
116
  licenses:
118
117
  - MIT
119
118
  metadata: {}
@@ -133,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
132
  version: '0'
134
133
  requirements: []
135
134
  rubyforge_project:
136
- rubygems_version: 2.4.5
135
+ rubygems_version: 2.4.8
137
136
  signing_key:
138
137
  specification_version: 4
139
138
  summary: Helper script to intelligently update your Gemfile
data/LICENSE.txt DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2014 Ryan Sonnek
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.