Skip to content

Commit

Permalink
remove migrate_taps
Browse files Browse the repository at this point in the history
We don't need to migrate the tapped formulae from symlink-based to
directory-based structure any more.

Instead, we add core tap install check for `brew update-report` which
will be invoked by `brew update`.
  • Loading branch information
xu-cheng committed Apr 2, 2016
1 parent a5cfc01 commit 56cb332
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
2 changes: 0 additions & 2 deletions Library/Homebrew/cmd/prune.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ def prune
end
end

migrate_taps :force => true unless ARGV.dry_run?

if ObserverPathnameExtension.total.zero?
puts "Nothing pruned" if ARGV.verbose?
else
Expand Down
9 changes: 0 additions & 9 deletions Library/Homebrew/cmd/tap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ module Homebrew
def tap
if ARGV.include? "--repair"
Tap.each(&:link_manpages)
migrate_taps :force => true
elsif ARGV.include? "--list-official"
require "official_taps"
puts OFFICIAL_TAPS.map { |t| "homebrew/#{t}" }
Expand Down Expand Up @@ -36,12 +35,4 @@ def install_tap(user, repo, clone_target = nil)
true
end
end

# Migrate tapped formulae from symlink-based to directory-based structure.
def migrate_taps(options = {})
ignore = HOMEBREW_LIBRARY/"Formula/.gitignore"
return unless ignore.exist? || options.fetch(:force, false)
(HOMEBREW_LIBRARY/"Formula").children.each { |c| c.unlink if c.symlink? }
ignore.unlink if ignore.exist?
end
end
13 changes: 10 additions & 3 deletions Library/Homebrew/cmd/update-report.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
require "cmd/tap"
require "formula_versions"
require "migrator"
require "formulary"
require "descriptions"

module Homebrew
def update_report
# migrate to new directories based tap structure
migrate_taps
install_core_tap_if_necessary

hub = ReporterHub.new

Expand Down Expand Up @@ -63,6 +61,15 @@ def update_report
def shorten_revision(revision)
Utils.popen_read("git", "-C", HOMEBREW_REPOSITORY, "rev-parse", "--short", revision).chomp
end

def install_core_tap_if_necessary
core_tap = CoreTap.instance
return if core_tap.installed?
CoreTap.ensure_installed! :quiet => false
revision = core_tap.git_head
ENV["HOMEBREW_UPDATE_BEFORE_HOMEBREW_HOMEBREW_CORE"] = revision
ENV["HOMEBREW_UPDATE_AFTER_HOMEBREW_HOMEBREW_CORE"] = revision
end
end

class Reporter
Expand Down

0 comments on commit 56cb332

Please sign in to comment.