Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
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.2.0)
bummr (1.2.1c)
rainbow
thor

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Update gemname from 0.0.1 to 0.0.2
- 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`)
- BUMMR_GIT_COMMIT = the shell git commit command to be used (default: `git commit --quiet`)


## License
Expand Down
1 change: 1 addition & 0 deletions lib/bummr.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# grouped by dependency order than alpha
require 'bummr/constants'
require 'bummr/log'
require 'bummr/prompt'
require "bummr/scm"
Expand Down
4 changes: 2 additions & 2 deletions lib/bummr/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def check(fullcheck=true)
method_option :gem, type: :string

def update
system("bundle install")
system(Bummr::BUNDLE_INSTALL_CMD)
display_info

if yes? "Are you ready to use Bummr? (y/n)"
Expand Down Expand Up @@ -58,7 +58,7 @@ def test
check(false)

if yes? "Do you want to test the build now? (y/n)"
system "bundle install"
system(Bummr::BUNDLE_INSTALL_CMD)
puts "Testing the build!".color(:green)

if system(TEST_COMMAND) == false
Expand Down
6 changes: 6 additions & 0 deletions lib/bummr/constants.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module Bummr
BUNDLE_INSTALL_CMD="bundle install --quiet".freeze
BUNDLE_EXEC_RAKE="bundle exec rake".freeze
# TODO: maybe "bundle outdated" ?
DEFAULT_GIT_COMMIT_CMD="git commit --quiet".freeze
end
2 changes: 1 addition & 1 deletion lib/bummr/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Git
include Log

def initialize
@git_commit = ENV.fetch("BUMMR_GIT_COMMIT") { "git commit" }
@git_commit = ENV.fetch("BUMMR_GIT_COMMIT") { Bummr::DEFAULT_GIT_COMMIT_CMD }
end

def add(files)
Expand Down
8 changes: 7 additions & 1 deletion lib/bummr/updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ def update_outdated_gems

def update_gem(gem, index)
puts "Updating #{gem[:name]}: #{index + 1} of #{@outdated_gems.count}"
system("bundle update #{gem[:name]}")
# Reduce STDOUT with filter
tmp = %x{bundle update #{gem[:name]} 2>&1}
tmp.split("\n").grep(/^(Installing|Using)/).each do |x|
a = x.split(" (")
# recolorize
puts "¦--> #{a[0]}" + " (#{a[1]}".color(:green)
end

# Get the current (maybe new?) bundled version for this gem
bundled_version = bundled_version_for(gem)
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.2.0"
VERSION = "1.2.1c".freeze
end
16 changes: 8 additions & 8 deletions spec/lib/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def mock_bummr_standard_flow
expect(cli).to receive(:yes?).and_return(true)
expect(cli).to receive(:check)
expect(cli).to receive(:log)
expect(cli).to receive(:system).with("bundle install")
expect(cli).to receive(:system).with(Bummr::BUNDLE_INSTALL_CMD)
expect(Bummr::Updater).to receive(:new).with(outdated_gems).and_return updater
expect(cli).to receive(:test)
expect(git).to receive(:rebase_interactive).with(BASE_BRANCH)
Expand All @@ -54,7 +54,7 @@ def mock_bummr_standard_flow
expect(cli).to receive(:yes?).and_return(true)
expect(cli).to receive(:check)
expect(cli).to receive(:log)
expect(cli).to receive(:system).with("bundle install")
expect(cli).to receive(:system).with(Bummr::BUNDLE_INSTALL_CMD)
expect(cli).to receive(:puts).with("No outdated gems to update".color(:green))

cli.update
Expand Down Expand Up @@ -125,7 +125,7 @@ def mock_bummr_standard_flow
expect(cli).to receive(:display_info)
expect(cli).to receive(:check)
expect(cli).to receive(:log)
expect(cli).to receive(:system).with("bundle install")
expect(cli).to receive(:system).with(Bummr::BUNDLE_INSTALL_CMD)
expect(cli).to receive(:puts).with("No outdated gems to update".color(:green))

cli.update
Expand All @@ -145,13 +145,13 @@ def mock_bummr_standard_flow

context "build passes" do
it "reports that it passed the build, does not bisect" do
allow(cli).to receive(:system).with("bundle exec rake").and_return true
allow(cli).to receive(:system).with(Bummr::BUNDLE_EXEC_RAKE).and_return true

cli.test

expect(cli).to have_received(:check).with(false)
expect(cli).to have_received(:system).with("bundle install")
expect(cli).to have_received(:system).with("bundle exec rake")
expect(cli).to have_received(:system).with(Bummr::BUNDLE_INSTALL_CMD)
expect(cli).to have_received(:system).with(Bummr::BUNDLE_EXEC_RAKE)
expect(cli).not_to have_received(:bisect)
end
end
Expand All @@ -163,8 +163,8 @@ def mock_bummr_standard_flow
cli.test

expect(cli).to have_received(:check).with(false)
expect(cli).to have_received(:system).with("bundle install")
expect(cli).to have_received(:system).with("bundle exec rake")
expect(cli).to have_received(:system).with(Bummr::BUNDLE_INSTALL_CMD)
expect(cli).to have_received(:system).with(Bummr::BUNDLE_EXEC_RAKE)
expect(cli).to have_received(:bisect)
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/lib/git_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@
git.commit(commit_message)

expect(git).to have_received(:system).with(
"git commit -m '#{commit_message}'"
"#{Bummr::DEFAULT_GIT_COMMIT_CMD} -m '#{commit_message}'"
)
end

describe "when BUMMR_GIT_COMMIT is defined" do
it "commits using defined value" do
allow(ENV).to receive(:fetch).with("BUMMR_GIT_COMMIT").and_return("git commit --no-verify")
allow(ENV).to receive(:fetch).with("BUMMR_GIT_COMMIT").and_return("#{Bummr::DEFAULT_GIT_COMMIT_CMD} --no-verify")
git = stub_git
commit_message = "Update Foo from 0.0.1 to 0.0.2"

git.commit(commit_message)

expect(git).to have_received(:system).with(
"git commit --no-verify -m '#{commit_message}'"
"#{Bummr::DEFAULT_GIT_COMMIT_CMD} --no-verify -m '#{commit_message}'"
)
end
end
Expand Down