Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
9872e60
Ignore vim swp files & compiled "gem build" files & log dir
matthewhively Apr 8, 2025
698d777
Cleanup the bundled gem files
matthewhively Apr 8, 2025
989f89f
comments
matthewhively Apr 8, 2025
4710cdb
Readme now lists all ENV vars in one place
matthewhively Apr 9, 2025
1889dd6
Fix non fatal errors during spec tests
matthewhively Apr 10, 2025
42935c2
Bummr::Remover.instance.remove_commit returns message instead of puts
matthewhively Apr 10, 2025
0837d75
Display messages during spec testing showing which test-spec is running
matthewhively Apr 10, 2025
cc1c401
Use %x{} instead of backticks (`)
matthewhively Apr 10, 2025
f1296a0
Stub out "display_info" when testing ABORTING bummr update
matthewhively Apr 10, 2025
80bef05
Fix indentation
matthewhively Apr 10, 2025
8ffd821
Stub out "puts" when testing outdated_gems
matthewhively Apr 10, 2025
c79542c
Stub out "puts" when testing writing to log/bummr.log
matthewhively Apr 10, 2025
52769a5
Stub out "puts" when testing updater
matthewhively Apr 10, 2025
aee89c9
Ensure "vendor/cache" folder exists
matthewhively Apr 10, 2025
1decadf
Exclude user CLI informational printouts from coverage tests
matthewhively Apr 10, 2025
d7fff3b
Ignore macos DS_Store thumbnails
matthewhively Apr 11, 2025
1508b25
Reconfigure Coverage report
matthewhively Apr 11, 2025
3d10117
Exclude some more sections from coverage reporting
matthewhively Apr 14, 2025
f3c9af9
Update bummr version
matthewhively Apr 8, 2025
c8d307c
Merge master into cleanup_spec
matthewhively Jul 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/.yardoc
/_yardoc/
/coverage/
/log/
/doc/
/pkg/
/spec/reports/
Expand All @@ -10,4 +11,7 @@
*.so
*.o
*.a
*.swp
mkmf.log
bummr-*.gem
.DS_Store
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
bummr (1.1.0)
bummr (1.1.1a)
rainbow
thor

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ Update gemname from 0.0.1 to 0.0.2
- Once the build passes, you can push your branch and create a pull-request!
- You may wish to `tail -f log/bummr.log` in a separate terminal window so you
can see which commits are being removed.
- Environment variables that adjust bummr behavior
- BUMMR_TEST = your app's testing suite command (default: `bundle exec rake`)
- BASE_BRANCH = your repo's primary branch (default: `main`)
- BUMMR_HEADLESS = skip interactive rebase after all updates are complete (default: `false`)
- BUMMR_GIT_COMMIT = the shell git commit command to be used (default: `git commit`)


## License

Expand Down
4 changes: 3 additions & 1 deletion bummr.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ Gem::Specification.new do |spec|
spec.homepage = "https://github.com/lpender/bummr"
spec.license = "MIT"

spec.files = `git ls-files -z`.split("\x0")
spec.files = Dir["{lib,bin}/**/*"] + %w|LICENSE README.md|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]

# Toolkit for building powerful command-line interfaces
spec.add_dependency "thor"
# Colorize printed text on ANSI terminals
spec.add_dependency "rainbow"

spec.add_development_dependency "rspec"
Expand Down
2 changes: 1 addition & 1 deletion lib/bummr/bisecter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def bisect
end

if line == "bisect run success\n"
Bummr::Remover.instance.remove_commit(sha)
puts Bummr::Remover.instance.remove_commit(sha)
end
end
end
Expand Down
10 changes: 5 additions & 5 deletions lib/bummr/check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def check(fullcheck=true)
private

def check_base_branch
if `git rev-parse --abbrev-ref HEAD` == "#{BASE_BRANCH}\n"
if %x{git rev-parse --abbrev-ref HEAD} == "#{BASE_BRANCH}\n"
message = "Bummr is not meant to be run on your base branch"
puts message.color(:red)
puts "Please checkout a branch with 'git checkout -b update-gems'"
Expand All @@ -44,7 +44,7 @@ def check_log
end

def check_status
status = `git status`
status = %x{git status}

if status.index 'are currently'
message = ""
Expand All @@ -55,15 +55,15 @@ def check_status
message += "You are already bisecting. "
end

message += "Make sure `git status` is clean"
message += "Make sure 'git status' is clean"
puts message.color(:red)
@errors.push message
end
end

def check_diff
unless `git diff #{BASE_BRANCH}`.empty?
message = "Please make sure that `git diff #{BASE_BRANCH}` returns empty"
unless %x{git diff #{BASE_BRANCH}}.empty?
message = "Please make sure that 'git diff #{BASE_BRANCH}' returns empty"
puts message.color(:red)
@errors.push message
end
Expand Down
12 changes: 9 additions & 3 deletions lib/bummr/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ class CLI < Thor
include Bummr::Prompt
include Bummr::Scm

# :nocov: internals are tested by spec/check_spec.rb
desc "check", "Run automated checks to see if bummr can be run"
def check(fullcheck=true)
Bummr::Check.instance.check(fullcheck)
end
# :nocov: end

desc "update",
"Update outdated gems, run tests, bisect if tests fail\n\n" +
Expand Down Expand Up @@ -77,13 +79,16 @@ def bisect
end
end

# :nocov: internals are tested by spec/lib/remover_spec.rb
desc "remove_commit", "Remove a commit from the history"
def remove_commit(sha)
Bummr::Remover.instance.remove_commit(sha)
puts Bummr::Remover.instance.remove_commit(sha)
end
# :nocov: end

private

# :nocov: This is stubbed out during actual testing because its boilerplate information for the user
def display_info
puts "Bummr #{VERSION}"
puts "To run Bummr, you must:"
Expand All @@ -92,7 +97,7 @@ def display_info
puts "- Have a 'log' directory, where we can place logs"
puts "- Have your build configured to fail fast (recommended)"
puts "- Have locked any Gem version that you don't wish to update in your Gemfile"
puts "- It is recommended that you lock your versions of `ruby` and `rails` in your `Gemfile`"
puts "- It is recommended that you lock your versions of 'ruby' and 'rails' in your 'Gemfile'"
puts "\n"
puts "Your test command is: " + "'#{TEST_COMMAND}'".color(:yellow)
puts "\n"
Expand All @@ -106,7 +111,8 @@ def print_received_options
puts "--#{key.color(:yellow)}: #{value}"
end

puts "\nRun `#{"bummr help update".color(:yellow)}` for more information.\n\n"
puts "\nRun '#{"bummr help update".color(:yellow)}' for more information.\n\n"
end
# :nocov: end
end
end
3 changes: 2 additions & 1 deletion lib/bummr/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ def rebase_interactive(sha)
system("git rebase -i #{BASE_BRANCH}") unless HEADLESS
end

# print only the commit subject line
def message(sha)
`git log --pretty=format:'%s' -n 1 #{sha}`
%x{git log --pretty=format:'%s' -n 1 #{sha}}
end

private
Expand Down
7 changes: 5 additions & 2 deletions lib/bummr/outdated.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def outdated_gems(options = {})

Open3.popen2("bundle outdated" + bundle_options) do |_std_in, std_out|
while line = std_out.gets
puts line
puts line # TODO: remove this if possible (pointless for spec tests)
gem = parse_gem_from(line)

if gem && (options[:all_gems] || gemfile_contains(gem[:name]))
Expand All @@ -43,8 +43,11 @@ def gemfile_contains(gem_name)
/gem ['"]#{gem_name}['"]/.match gemfile
end

# :nocov: no need to test whether linux "cat Gemfile" works
def gemfile
@gemfile ||= `cat Gemfile`
@gemfile ||= %x{cat Gemfile}
end
# :nocov: end

end
end
8 changes: 4 additions & 4 deletions lib/bummr/remover.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ def remove_commit(sha)
log "Resetting..."
system("git bisect reset")

message = "\nThe commit:\n\n `#{sha} #{git.message(sha)}`\n\n" +
message = "\nThe commit:\n\n '#{sha} #{git.message(sha)}'\n\n" +
"Is breaking the build.\n\n" +
"Please do one of the following: \n\n" +
" 1. Update your code to work with the latest version of this gem.\n\n" +
" 2. Perform the following steps to lock the gem version:\n\n" +
" - `git reset --hard main`\n" +
" - 'git reset --hard main'\n" +
" - Lock the version of this Gem in your Gemfile.\n" +
" - Commit the changes.\n" +
" - Run `bummr update` again.\n\n"
" - Run 'bummr update' again.\n\n"

puts message.color(:yellow)
message.color(:yellow)
end
end
end
2 changes: 1 addition & 1 deletion lib/bummr/updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def update_gem(gem, index)
end

def updated_version_for(gem)
string = `bundle list --paths | grep "#{gem[:name]}"`
string = %x{bundle list --paths | grep "#{gem[:name]}"}
string.match(/#{File::SEPARATOR}#{gem[:name]}-(.*)$/)[1]
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/bummr/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Bummr
VERSION = "1.1.0"
VERSION = "1.1.1a"
end
4 changes: 4 additions & 0 deletions spec/black_box/bummr_update_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
require "jet_black"

describe "bummr update command" do
before(:all) do
puts "\n<< black_box/bummr_update_spec >>\n"
end

let(:session) { JetBlack::Session.new(options: { clean_bundler_env: true }) }
let(:bummr_gem_path) { File.expand_path("../../", __dir__) }

Expand Down
10 changes: 7 additions & 3 deletions spec/check_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
require 'spec_helper'

describe Bummr::Check do
before(:all) do
puts "\n<< Bummr::Check >>\n"
end

let(:check) { Bummr::Check.instance }

before(:each) do
Expand Down Expand Up @@ -81,7 +85,7 @@
check.check

expect(check).to have_received(:puts)
.with("You are already bisecting. Make sure `git status` is clean".color(:red))
.with("You are already bisecting. Make sure 'git status' is clean".color(:red))
expect(check).to have_received(:yes?)
expect(check).to have_received(:exit).with(0)
end
Expand All @@ -98,7 +102,7 @@
check.check

expect(check).to have_received(:puts)
.with("You are already rebasing. Make sure `git status` is clean".color(:red))
.with("You are already rebasing. Make sure 'git status' is clean".color(:red))
expect(check).to have_received(:yes?)
expect(check).to have_received(:exit).with(0)
end
Expand All @@ -116,7 +120,7 @@
check.check(true)

expect(check).to have_received(:puts)
.with("Please make sure that `git diff main` returns empty".color(:red))
.with("Please make sure that 'git diff main' returns empty".color(:red))
expect(check).to have_received(:yes?)
expect(check).to have_received(:exit).with(0)
end
Expand Down
4 changes: 4 additions & 0 deletions spec/lib/bisecter_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
require 'spec_helper'

describe Bummr::Bisecter do
before(:all) do
puts "\n<< Bummr::Bisecter >>\n"
end

let(:std_out_err_bad_commit) {
output = String.new
output += "mybadcommit is the first bad commit\n"
Expand Down
5 changes: 5 additions & 0 deletions spec/lib/cli_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
require 'spec_helper'

describe Bummr::CLI do
before(:all) do
puts "\n<< Bummr::CLI >>\n"
end

# https://github.com/wireframe/gitx/blob/171da367072b0e82d5906d1e5b3f8ff38e5774e7/spec/thegarage/gitx/cli/release_command_spec.rb#L9
let(:args) { [] }
let(:options) { {} }
Expand All @@ -18,6 +22,7 @@
describe "#update" do
context "when user rejects moving forward" do
it "does not attempt to move forward" do
expect(cli).to receive(:display_info) # NOOP this function call
expect(cli).to receive(:yes?).and_return(false)
expect(cli).not_to receive(:check)

Expand Down
4 changes: 4 additions & 0 deletions spec/lib/git_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
require "spec_helper"

describe Bummr::Git do
before(:all) do
puts "\n<< Bummr::Git >>\n"
end

describe "#add" do
it "stages specified files with git" do
git = stub_git
Expand Down
12 changes: 9 additions & 3 deletions spec/lib/log_spec.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
require "spec_helper"

describe Bummr::Log do
before(:all) do
puts "\n<< Bummr::Log >>\n"
end

let(:object) { Object.new }
let(:message) { "test message" }

before do
`mkdir -p log`
%x{mkdir -p log}
object.extend(Bummr::Log)
end

after do
`rm log/bummr.log`
%x{rm log/bummr.log}
end

describe "#log" do
Expand All @@ -23,9 +27,11 @@
end

it "outputs the message to log/bummr.log" do
allow(object).to receive(:puts) # NOOP this function call

object.log message

result = `cat log/bummr.log`
result = %x{cat log/bummr.log}

expect(result).to eq message + "\n"
end
Expand Down
Loading