Merge pull request #1628 from zmwangx/make-boneyard-formula-pr-consistent-with-bump-formula-pr
boneyard-formula-pr: make it more consistent with bump-formula-pr
This commit is contained in:
commit
b4dd5146ed
@ -35,18 +35,18 @@ module Homebrew
|
|||||||
boneyard_tap = Tap.fetch("homebrew", "boneyard")
|
boneyard_tap = Tap.fetch("homebrew", "boneyard")
|
||||||
tap_migrations_path = formula.tap.path/"tap_migrations.json"
|
tap_migrations_path = formula.tap.path/"tap_migrations.json"
|
||||||
if ARGV.dry_run?
|
if ARGV.dry_run?
|
||||||
puts "brew update"
|
ohai "brew update"
|
||||||
puts "brew tap #{boneyard_tap.name}"
|
ohai "brew tap #{boneyard_tap.name}"
|
||||||
puts "cd #{formula.tap.path}"
|
ohai "cd #{formula.tap.path}"
|
||||||
cd formula.tap.path
|
cd formula.tap.path
|
||||||
puts "cp #{formula_relpath} #{boneyard_tap.path}"
|
ohai "cp #{formula_relpath} #{boneyard_tap.path}"
|
||||||
puts "git rm #{formula_relpath}"
|
ohai "git rm #{formula_relpath}"
|
||||||
unless File.exist? tap_migrations_path
|
unless File.exist? tap_migrations_path
|
||||||
puts "Creating tap_migrations.json for #{formula.tap.name}"
|
ohai "Creating tap_migrations.json for #{formula.tap.name}"
|
||||||
puts "git add #{tap_migrations_path}"
|
ohai "git add #{tap_migrations_path}"
|
||||||
end
|
end
|
||||||
puts "Loading tap_migrations.json"
|
ohai "Loading tap_migrations.json"
|
||||||
puts "Adding #{formula.name} to tap_migrations.json"
|
ohai "Adding #{formula.name} to tap_migrations.json"
|
||||||
else
|
else
|
||||||
safe_system HOMEBREW_BREW_FILE, "update"
|
safe_system HOMEBREW_BREW_FILE, "update"
|
||||||
safe_system HOMEBREW_BREW_FILE, "tap", boneyard_tap.name
|
safe_system HOMEBREW_BREW_FILE, "tap", boneyard_tap.name
|
||||||
@ -67,7 +67,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
unless which("hub") || local_only
|
unless which("hub") || local_only
|
||||||
if ARGV.dry_run?
|
if ARGV.dry_run?
|
||||||
puts "brew install hub"
|
ohai "brew install hub"
|
||||||
else
|
else
|
||||||
safe_system HOMEBREW_BREW_FILE, "install", "hub"
|
safe_system HOMEBREW_BREW_FILE, "install", "hub"
|
||||||
end
|
end
|
||||||
@ -77,17 +77,19 @@ module Homebrew
|
|||||||
reason = " because #{reason}" if reason
|
reason = " because #{reason}" if reason
|
||||||
|
|
||||||
if ARGV.dry_run?
|
if ARGV.dry_run?
|
||||||
puts "cd #{formula.tap.path}"
|
ohai "cd #{formula.tap.path}"
|
||||||
puts "git checkout --no-track -b #{branch} origin/master"
|
ohai "git checkout --no-track -b #{branch} origin/master"
|
||||||
puts "git commit --no-edit --verbose --message=\"#{formula.name}: migrate to boneyard\" -- #{formula_relpath} #{tap_migrations_path.basename}"
|
ohai "git commit --no-edit --verbose --message=\"#{formula.name}: migrate to boneyard\" -- #{formula_relpath} #{tap_migrations_path.basename}"
|
||||||
|
|
||||||
unless local_only
|
unless local_only
|
||||||
puts "hub fork --no-remote"
|
ohai "hub fork --no-remote"
|
||||||
puts "hub fork"
|
ohai "hub fork"
|
||||||
puts "hub fork (to read $HUB_REMOTE)"
|
ohai "hub fork (to read $HUB_REMOTE)"
|
||||||
puts "git push $HUB_REMOTE #{branch}:#{branch}"
|
ohai "git push $HUB_REMOTE #{branch}:#{branch}"
|
||||||
puts "hub pull-request -m $'#{formula.name}: migrate to boneyard\\n\\nCreated with `brew boneyard-formula-pr`#{reason}.'"
|
ohai "hub pull-request -m $'#{formula.name}: migrate to boneyard\\n\\nCreated with `brew boneyard-formula-pr`#{reason}.'"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
ohai "git checkout -"
|
||||||
else
|
else
|
||||||
cd formula.tap.path
|
cd formula.tap.path
|
||||||
safe_system "git", "checkout", "--no-track", "-b", branch, "origin/master"
|
safe_system "git", "checkout", "--no-track", "-b", branch, "origin/master"
|
||||||
@ -108,26 +110,30 @@ module Homebrew
|
|||||||
EOS
|
EOS
|
||||||
pr_url = Utils.popen_read("hub", "pull-request", "-m", pr_message).chomp
|
pr_url = Utils.popen_read("hub", "pull-request", "-m", pr_message).chomp
|
||||||
end
|
end
|
||||||
|
|
||||||
|
safe_system "git", "checkout", "-"
|
||||||
end
|
end
|
||||||
|
|
||||||
if ARGV.dry_run?
|
if ARGV.dry_run?
|
||||||
puts "cd #{boneyard_tap.path}"
|
ohai "cd #{boneyard_tap.path}"
|
||||||
puts "git checkout --no-track -b #{branch} origin/master"
|
ohai "git checkout --no-track -b #{branch} origin/master"
|
||||||
if bottle_block
|
if bottle_block
|
||||||
puts "Removing bottle block"
|
ohai "Removing bottle block"
|
||||||
else
|
else
|
||||||
puts "No bottle block to remove"
|
ohai "No bottle block to remove"
|
||||||
end
|
end
|
||||||
puts "git add #{formula_file}"
|
ohai "git add #{formula_file}"
|
||||||
puts "git commit --no-edit --verbose --message=\"#{formula.name}: migrate from #{formula.tap.repo}\" -- #{formula_file}"
|
ohai "git commit --no-edit --verbose --message=\"#{formula.name}: migrate from #{formula.tap.repo}\" -- #{formula_file}"
|
||||||
|
|
||||||
unless local_only
|
unless local_only
|
||||||
puts "hub fork --no-remote"
|
ohai "hub fork --no-remote"
|
||||||
puts "hub fork"
|
ohai "hub fork"
|
||||||
puts "hub fork (to read $HUB_REMOTE)"
|
ohai "hub fork (to read $HUB_REMOTE)"
|
||||||
puts "git push $HUB_REMOTE #{branch}:#{branch}"
|
ohai "git push $HUB_REMOTE #{branch}:#{branch}"
|
||||||
puts "hub pull-request --browse -m $'#{formula.name}: migrate from #{formula.tap.repo}\\n\\nGoes together with $PR_URL\\n\\nCreated with `brew boneyard-formula-pr`#{reason}.'"
|
ohai "hub pull-request --browse -m $'#{formula.name}: migrate from #{formula.tap.repo}\\n\\nGoes together with $PR_URL\\n\\nCreated with `brew boneyard-formula-pr`#{reason}.'"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
ohai "git checkout -"
|
||||||
else
|
else
|
||||||
cd boneyard_tap.formula_dir
|
cd boneyard_tap.formula_dir
|
||||||
safe_system "git", "checkout", "--no-track", "-b", branch, "origin/master"
|
safe_system "git", "checkout", "--no-track", "-b", branch, "origin/master"
|
||||||
@ -153,6 +159,8 @@ module Homebrew
|
|||||||
Created with `brew boneyard-formula-pr`#{reason}.
|
Created with `brew boneyard-formula-pr`#{reason}.
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
safe_system "git", "checkout", "-"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user