aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorJack Nagel2014-09-14 11:18:55 -0500
committerJack Nagel2014-09-14 11:19:30 -0500
commit1f162dba6f2355f3d7f58b5bdd0194c4ccbcdc24 (patch)
tree731eb11a663cc1c67522e210a2162fa26dea799c /Library/Homebrew
parent672339b7ca08f791a485f71397b54d7de6ad020f (diff)
downloadhomebrew-1f162dba6f2355f3d7f58b5bdd0194c4ccbcdc24.tar.bz2
Consistently call name on formula instead of relying on to_s
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/build.rb2
-rw-r--r--Library/Homebrew/cmd/install.rb2
-rw-r--r--Library/Homebrew/cmd/upgrade.rb4
-rw-r--r--Library/Homebrew/exceptions.rb6
-rw-r--r--Library/Homebrew/formula_installer.rb22
-rw-r--r--Library/Homebrew/test/test_software_spec.rb1
6 files changed, 19 insertions, 18 deletions
diff --git a/Library/Homebrew/build.rb b/Library/Homebrew/build.rb
index 90f2fc199..34903c9aa 100644
--- a/Library/Homebrew/build.rb
+++ b/Library/Homebrew/build.rb
@@ -172,7 +172,7 @@ class Build
end
Keg.new(path).optlink
rescue StandardError
- raise "#{f.opt_prefix} not present or broken\nPlease reinstall #{f}. Sorry :("
+ raise "#{f.opt_prefix} not present or broken\nPlease reinstall #{f.name}. Sorry :("
end
end
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index c8e0e9e42..94f9e3a78 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -29,7 +29,7 @@ module Homebrew
# Building head-only without --HEAD is an error
if not ARGV.build_head? and f.stable.nil?
raise CannotInstallFormulaError, <<-EOS.undent
- #{f} is a head-only formula
+ #{f.name} is a head-only formula
Install with `brew install --HEAD #{f.name}`
EOS
end
diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb
index ae8ba2c73..8f1b7fabe 100644
--- a/Library/Homebrew/cmd/upgrade.rb
+++ b/Library/Homebrew/cmd/upgrade.rb
@@ -11,10 +11,10 @@ module Homebrew
else
outdated = ARGV.formulae.select do |f|
if f.installed?
- onoe "#{f}-#{f.installed_version} already installed"
+ onoe "#{f.name}-#{f.installed_version} already installed"
false
elsif not f.rack.directory? or f.rack.subdirs.empty?
- onoe "#{f} not installed"
+ onoe "#{f.name} not installed"
false
else
true
diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb
index 7afb0db0e..da48d60ca 100644
--- a/Library/Homebrew/exceptions.rb
+++ b/Library/Homebrew/exceptions.rb
@@ -85,7 +85,7 @@ class FormulaAlreadyInstalledError < RuntimeError; end
class FormulaInstallationAlreadyAttemptedError < RuntimeError
def initialize(formula)
- super "Formula installation already attempted: #{formula}"
+ super "Formula installation already attempted: #{formula.name}"
end
end
@@ -175,7 +175,7 @@ class BuildError < RuntimeError
Homebrew.dump_build_env(env)
puts
onoe "#{formula.name} #{formula.version} did not build"
- unless (logs = Dir["#{HOMEBREW_LOGS}/#{formula}/*"]).empty?
+ unless (logs = Dir["#{HOMEBREW_LOGS}/#{formula.name}/*"]).empty?
puts "Logs:"
puts logs.map{|fn| " #{fn}"}.join("\n")
end
@@ -239,7 +239,7 @@ end
class ResourceMissingError < ArgumentError
def initialize(formula, resource)
- super "#{formula} does not define resource #{resource.inspect}"
+ super "#{formula.name} does not define resource #{resource.inspect}"
end
end
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index 07bcaaf4a..8178f9582 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -60,7 +60,7 @@ class FormulaInstaller
unless f.bottle.compatible_cellar?
if install_bottle_options[:warn]
- opoo "Building source; cellar of #{f}'s bottle is #{f.bottle.cellar}"
+ opoo "Building source; cellar of #{f.name}'s bottle is #{f.bottle.cellar}"
end
return false
end
@@ -101,7 +101,7 @@ class FormulaInstaller
raise FormulaInstallationAlreadyAttemptedError, f if @@attempted.include? f
if f.installed?
- msg = "#{f}-#{f.installed_version} already installed"
+ msg = "#{f.name}-#{f.installed_version} already installed"
msg << ", it's just not linked" unless f.linked_keg.symlink? or f.keg_only?
raise FormulaAlreadyInstalledError, msg
end
@@ -111,7 +111,7 @@ class FormulaInstaller
dep.installed? and not dep.keg_only? and not dep.linked_keg.directory?
end
raise CannotInstallFormulaError,
- "You must `brew link #{unlinked_deps*' '}' before #{f} can be installed" unless unlinked_deps.empty?
+ "You must `brew link #{unlinked_deps*' '}' before #{f.name} can be installed" unless unlinked_deps.empty?
end
end
@@ -134,8 +134,8 @@ class FormulaInstaller
if f.linked_keg.directory?
# some other version is already installed *and* linked
raise CannotInstallFormulaError, <<-EOS.undent
- #{f}-#{f.linked_keg.resolved_path.basename} already installed
- To install this version, first `brew unlink #{f}'
+ #{f.name}-#{f.linked_keg.resolved_path.basename} already installed
+ To install this version, first `brew unlink #{f.name}'
EOS
end
@@ -149,7 +149,7 @@ class FormulaInstaller
raise "Unrecognized architecture for --bottle-arch: #{arch}"
end
- oh1 "Installing #{Tty.green}#{f}#{Tty.reset}" if show_header?
+ oh1 "Installing #{Tty.green}#{f.name}#{Tty.reset}" if show_header?
@@attempted << f
@@ -216,7 +216,7 @@ class FormulaInstaller
deps = expand_dependencies(req_deps + f.deps)
if deps.empty? and only_deps?
- puts "All dependencies for #{f} are satisfied."
+ puts "All dependencies for #{f.name} are satisfied."
else
install_dependencies(deps)
end
@@ -316,7 +316,7 @@ class FormulaInstaller
def install_dependencies(deps)
if deps.length > 1
- oh1 "Installing dependencies for #{f}: #{Tty.green}#{deps.map(&:first)*", "}#{Tty.reset}"
+ oh1 "Installing dependencies for #{f.name}: #{Tty.green}#{deps.map(&:first)*", "}#{Tty.reset}"
end
deps.each { |dep, options| install_dependency(dep, options) }
@@ -360,7 +360,7 @@ class FormulaInstaller
fi.verbose = verbose? unless verbose == :quieter
fi.debug = debug?
fi.prelude
- oh1 "Installing #{f} dependency: #{Tty.green}#{dep.name}#{Tty.reset}"
+ oh1 "Installing #{f.name} dependency: #{Tty.green}#{dep.name}#{Tty.reset}"
fi.install
fi.caveats
fi.finish
@@ -466,7 +466,7 @@ class FormulaInstaller
end
def build
- FileUtils.rm Dir["#{HOMEBREW_LOGS}/#{f}/*"]
+ FileUtils.rm Dir["#{HOMEBREW_LOGS}/#{f.name}/*"]
@start_time = Time.now
@@ -530,7 +530,7 @@ class FormulaInstaller
keg.optlink
rescue Keg::LinkError => e
onoe "Failed to create #{f.opt_prefix}"
- puts "Things that depend on #{f} will probably not build."
+ puts "Things that depend on #{f.name} will probably not build."
puts e
end
return
diff --git a/Library/Homebrew/test/test_software_spec.rb b/Library/Homebrew/test/test_software_spec.rb
index 1306a92b9..d4b271177 100644
--- a/Library/Homebrew/test/test_software_spec.rb
+++ b/Library/Homebrew/test/test_software_spec.rb
@@ -19,6 +19,7 @@ class SoftwareSpecTests < Homebrew::TestCase
end
def test_raises_when_accessing_missing_resources
+ @spec.owner = Class.new { def name; "test"; end }.new
assert_raises(ResourceMissingError) { @spec.resource('foo') }
end