language stringclasses 1
value | owner stringlengths 2 15 | repo stringlengths 2 21 | sha stringlengths 45 45 | message stringlengths 7 36.3k | path stringlengths 1 199 | patch stringlengths 15 102k | is_multipart bool 2
classes |
|---|---|---|---|---|---|---|---|
Other | Homebrew | brew | f1df7f208fdb5afc1bf4f25320db1bef4efc0a99.json | info: remove unreachable code | Library/Homebrew/cmd/info.rb | @@ -135,16 +135,6 @@ def info_formula f
c = Caveats.new(f)
ohai 'Caveats', c.caveats unless c.empty?
-
- rescue FormulaUnavailableError
- # check for DIY installation
- d = HOMEBREW_PREFIX+name
- if d.directory?
- ohai "DIY Installation"
- d.children.each{ |keg| puts "#{keg} (#{keg.abv})... | false |
Other | Homebrew | brew | 1d265e5a0acbc6fa92d4684bcbc9bc2abcf0155a.json | Check respond_to? instead of inline rescue | Library/Homebrew/caveats.rb | @@ -8,7 +8,7 @@ def initialize(f)
def caveats
caveats = []
caveats << f.caveats
- caveats << f.keg_only_text rescue nil if f.keg_only?
+ caveats << f.keg_only_text if f.keg_only? && f.respond_to?(:keg_only_text)
caveats << bash_completion_caveats
caveats << zsh_completion_caveats
cavea... | false |
Other | Homebrew | brew | 33cae6ac42a480c39b9510ac4d65a3c5b6c08797.json | PythonInstalled: Fix libdir for Python 3.x | Library/Homebrew/requirements/python_dependency.rb | @@ -139,7 +139,11 @@ def incdir
# Dir containing e.g. libpython2.7.dylib
def libdir
if brewed? || from_osx?
- prefix/"lib/#{xy}/config"
+ if @min_version.major == 3
+ prefix/"lib/#{xy}/config-#{version.major}.#{version.minor}m"
+ else
+ prefix/"lib/#{xy}/config"
+ end
e... | false |
Other | Homebrew | brew | 4c9ac19e878750cf2c2832759d9902796079d9f0.json | Consolidate sudo checks.
Closes Homebrew/homebrew#20318. | Library/Homebrew/cmd/install.rb | @@ -18,10 +18,6 @@ def install
end
end unless ARGV.force?
- if Process.uid.zero? and not File.stat(HOMEBREW_BREW_FILE).uid.zero?
- raise "Cowardly refusing to `sudo brew install'\n#{SUDO_BAD_ERRMSG}"
- end
-
install_formulae ARGV.formulae
end
| true |
Other | Homebrew | brew | 4c9ac19e878750cf2c2832759d9902796079d9f0.json | Consolidate sudo checks.
Closes Homebrew/homebrew#20318. | Library/Homebrew/cmd/link.rb | @@ -5,10 +5,6 @@ module Homebrew extend self
def link
raise KegUnspecifiedError if ARGV.named.empty?
- if Process.uid.zero? and not File.stat(HOMEBREW_BREW_FILE).uid.zero?
- raise "Cowardly refusing to `sudo brew link'\n#{SUDO_BAD_ERRMSG}"
- end
-
mode = OpenStruct.new
mode.overwrite = ... | true |
Other | Homebrew | brew | 4c9ac19e878750cf2c2832759d9902796079d9f0.json | Consolidate sudo checks.
Closes Homebrew/homebrew#20318. | Library/Homebrew/cmd/pin.rb | @@ -2,9 +2,6 @@
module Homebrew extend self
def pin
- if Process.uid.zero? and not File.stat(HOMEBREW_BREW_FILE).uid.zero?
- abort "Cowardly refusing to `sudo pin'"
- end
raise FormulaUnspecifiedError if ARGV.named.empty?
ARGV.formulae.each do |f| | true |
Other | Homebrew | brew | 4c9ac19e878750cf2c2832759d9902796079d9f0.json | Consolidate sudo checks.
Closes Homebrew/homebrew#20318. | Library/Homebrew/cmd/unpin.rb | @@ -2,9 +2,6 @@
module Homebrew extend self
def unpin
- if Process.uid.zero? and not File.stat(HOMEBREW_BREW_FILE).uid.zero?
- abort "Cowardly refusing to `sudo unpin'"
- end
raise FormulaUnspecifiedError if ARGV.named.empty?
ARGV.formulae.each do |f| | true |
Other | Homebrew | brew | 4c9ac19e878750cf2c2832759d9902796079d9f0.json | Consolidate sudo checks.
Closes Homebrew/homebrew#20318. | Library/Homebrew/cmd/upgrade.rb | @@ -8,12 +8,6 @@ def plural_s
module Homebrew extend self
def upgrade
- if Process.uid.zero? and not File.stat(HOMEBREW_BREW_FILE).uid.zero?
- # note we only abort if Homebrew is *not* installed as sudo and the user
- # calls brew as root. The fix is to chown brew to root.
- abort "Cowardly refu... | true |
Other | Homebrew | brew | 4c9ac19e878750cf2c2832759d9902796079d9f0.json | Consolidate sudo checks.
Closes Homebrew/homebrew#20318. | Library/Homebrew/exceptions.rb | @@ -213,11 +213,3 @@ def to_s
super + advice.to_s
end
end
-
-module Homebrew extend self
- SUDO_BAD_ERRMSG = <<-EOS.undent
- You can use brew with sudo, but only if the brew executable is owned by root.
- However, this is both not recommended and completely unsupported so do so at
- your own risk.
- ... | true |
Other | Homebrew | brew | 4c9ac19e878750cf2c2832759d9902796079d9f0.json | Consolidate sudo checks.
Closes Homebrew/homebrew#20318. | Library/Homebrew/global.rb | @@ -99,3 +99,9 @@ module Homebrew extend self
require 'compat' unless ARGV.include? "--no-compat" or ENV['HOMEBREW_NO_COMPAT']
ORIGINAL_PATHS = ENV['PATH'].split(':').map{ |p| Pathname.new(p).expand_path rescue nil }.compact.freeze
+
+SUDO_BAD_ERRMSG = <<-EOS.undent
+ You can use brew with sudo, but only if the br... | true |
Other | Homebrew | brew | 4c9ac19e878750cf2c2832759d9902796079d9f0.json | Consolidate sudo checks.
Closes Homebrew/homebrew#20318. | Library/brew.rb | @@ -58,29 +58,37 @@ def require? path
begin
trap("INT", std_trap) # restore default CTRL-C handler
- aliases = {'ls' => :list,
- 'homepage' => :home,
- '-S' => :search,
- 'up' => :update,
- 'ln' => :link,
- 'instal' => :install, # gem does the same
- ... | true |
Other | Homebrew | brew | dbccff4d8019aedb414ff007a2578a2a46910484.json | brew-test-bot: write bottle metadata files. | Library/Contributions/cmd/brew-test-bot.rb | @@ -18,11 +18,11 @@
class Step
attr_reader :command, :name, :status, :output, :time
- def initialize test, command, puts_output_on_success = false
+ def initialize test, command, options={}
@test = test
@category = test.category
@command = command
- @puts_output_on_success = puts_output_on_suc... | false |
Other | Homebrew | brew | bf828aa36bcee07d6a030b720e12c525ab86c854.json | Bottle DSL: allow checksums access. | Library/Homebrew/formula_support.rb | @@ -90,7 +90,8 @@ def initialize
# a Hash, which indicates the platform the checksum applies on.
Checksum::TYPES.each do |cksum|
class_eval <<-EOS, __FILE__, __LINE__ + 1
- def #{cksum}(val)
+ def #{cksum}(val=nil)
+ return @#{cksum} if val.nil?
@#{cksum} ||= Hash.new
case ... | false |
Other | Homebrew | brew | 95f9c6227a99a2cfa3f9768ab867d3c775693b56.json | Use new download strategy for local bottles.
Fixes installation of e.g. ScriptFileFormula/denominator bottles. | Library/Homebrew/download_strategy.rb | @@ -2,6 +2,8 @@
require 'vendor/multi_json'
class AbstractDownloadStrategy
+ attr_accessor :local_bottle_path
+
def initialize name, package
@url = package.url
specs = package.specs
@@ -36,8 +38,6 @@ def cached_location; end
end
class CurlDownloadStrategy < AbstractDownloadStrategy
- attr_accesso... | true |
Other | Homebrew | brew | 95f9c6227a99a2cfa3f9768ab867d3c775693b56.json | Use new download strategy for local bottles.
Fixes installation of e.g. ScriptFileFormula/denominator bottles. | Library/Homebrew/formula_installer.rb | @@ -403,8 +403,14 @@ def clean
end
def pour
- fetched, downloader = f.fetch, f.downloader
- f.verify_download_integrity(fetched) unless downloader.local_bottle_path
+ downloader = f.downloader
+ if downloader.local_bottle_path
+ downloader = LocalBottleDownloadStrategy.new f,
+ ... | true |
Other | Homebrew | brew | ff65923531f2642d5998251100f4ed1615003983.json | Raise bottle exceptions for Homebrew developers. | Library/Homebrew/formula_installer.rb | @@ -104,6 +104,7 @@ def install
tab.write
end
rescue
+ raise if ARGV.homebrew_developer?
opoo "Bottle installation failed: building from source."
end
| false |
Other | Homebrew | brew | e5ee7d59f52453b28cd3f71078e8a0de53f0e227.json | Fix failing test | Library/Homebrew/test/test_formula_validation.rb | @@ -9,7 +9,7 @@ def assert_invalid(attr, &block)
def test_cant_override_brew
e = assert_raises(RuntimeError) { Class.new(Formula) { def brew; end } }
- assert_equal "You cannot override Formula#brew", e.message
+ assert_match /You cannot override Formula#brew/, e.message
end
def test_validates_n... | false |
Other | Homebrew | brew | a8f5527f7475ad0d6ee11f7e7d01f5da3ec13cc2.json | CurlDownloadStrategy: use opt path for xz | Library/Homebrew/download_strategy.rb | @@ -114,10 +114,8 @@ def stage
with_system_path { safe_system 'tar', 'xf', @tarball_path }
chdir
when :xz
- raise "You must install XZutils: brew install xz" unless which "xz"
- with_system_path {
- safe_system "#{Formula.factory('xz').bin}/xz -dc \"#{@tarball_path}\" | tar xf -"
- ... | false |
Other | Homebrew | brew | fb83fc7bc4bb7260ea300cf1b2f4874ee7268755.json | Add class name to method_added error | Library/Homebrew/formula.rb | @@ -677,7 +677,7 @@ def patch
def self.method_added method
case method
when :brew
- raise "You cannot override Formula#brew"
+ raise "You cannot override Formula#brew in class #{name}"
when :test
@test_defined = true
end | false |
Other | Homebrew | brew | 159b9d8e2dd08ab4ad913e56669e961a7767b3d9.json | Move oldest_cpu to Hardware | Library/Homebrew/extend/ENV.rb | @@ -328,7 +328,7 @@ def set_cpu_flags flags, default, map = {}
append flags, xarch unless xarch.empty?
if ARGV.build_bottle?
- append flags, Hardware::CPU.optimization_flags[MacOS.oldest_cpu]
+ append flags, Hardware::CPU.optimization_flags[Hardware.oldest_cpu]
else
# Don't set -msse3 ... | true |
Other | Homebrew | brew | 159b9d8e2dd08ab4ad913e56669e961a7767b3d9.json | Move oldest_cpu to Hardware | Library/Homebrew/hardware.rb | @@ -45,4 +45,16 @@ def self.cores_as_words
Hardware.processor_count
end
end
+
+ def self.oldest_cpu
+ if Hardware::CPU.type == :intel
+ if Hardware::CPU.is_64_bit?
+ :core2
+ else
+ :core
+ end
+ else
+ Hardware::CPU.family
+ end
+ end
end | true |
Other | Homebrew | brew | 159b9d8e2dd08ab4ad913e56669e961a7767b3d9.json | Move oldest_cpu to Hardware | Library/Homebrew/macos.rb | @@ -28,18 +28,6 @@ def uncached_cat
end
end
- def oldest_cpu
- if Hardware::CPU.type == :intel
- if Hardware::CPU.is_64_bit?
- :core2
- else
- :core
- end
- else
- Hardware::CPU.family
- end
- end
-
def locate tool
# Don't call tools (cc, make, strip, etc.)... | true |
Other | Homebrew | brew | 856cebd9b45c40f361c62ca780ff8ef8976e64b9.json | Use ivar accessors | Library/Homebrew/formula.rb | @@ -45,7 +45,7 @@ def initialize name='__UNKNOWN__', path=nil
@active_spec = determine_active_spec
validate_attributes :url, :name, :version
- @downloader = download_strategy.new(name, @active_spec)
+ @downloader = download_strategy.new(name, active_spec)
# Combine DSL `option` and `def options... | true |
Other | Homebrew | brew | 856cebd9b45c40f361c62ca780ff8ef8976e64b9.json | Use ivar accessors | Library/Homebrew/formula_support.rb | @@ -16,11 +16,11 @@ def initialize url=nil, version=nil
end
def download_strategy
- @download_strategy ||= DownloadStrategyDetector.detect(@url, @using)
+ @download_strategy ||= DownloadStrategyDetector.detect(url, using)
end
def verify_download_integrity fn
- fn.verify_checksum @checksum
+ ... | true |
Other | Homebrew | brew | 92d65aace7edfc751c342c019e895d33bbea013c.json | linkapps: replace #max_by with #max
Enumerable#max_by didn't exist in 1.8.6, so linkapps failed on Leopard. | Library/Contributions/cmd/brew-linkapps.rb | @@ -13,7 +13,7 @@
kegs = rack.subdirs.map { |d| Keg.new(d) }
next if kegs.empty?
- keg = kegs.detect(&:linked?) || kegs.max_by(&:version)
+ keg = kegs.detect(&:linked?) || kegs.max {|a,b| a.version <=> b.version}
Dir["#{keg}/*.app", "#{keg}/bin/*.app", "#{keg}/libexec/*.app"].each do |app|
puts "Lin... | false |
Other | Homebrew | brew | 28acfbba51ea1e4e67365e5c9fa666d0c5ca9db5.json | Improve tokenization of version strings
Tokens like "b4", "beta1", "p195", &c. are now treated as atoms rather
than being broken down even further. Additionally, we enable support for
padding in the middle of versions strings, so we can successfully
compare something like "2.1-p195" with "2.1.0-p194" by inferring that... | Library/Homebrew/test/test_versions.rb | @@ -8,24 +8,39 @@ def test_version_comparisons
assert_operator version('0.1'), :==, version('0.1.0')
assert_operator version('0.1'), :<, version('0.2')
assert_operator version('1.2.3'), :>, version('1.2.2')
- assert_operator version('1.2.3-p34'), :>, version('1.2.3-p33')
assert_operator version('... | true |
Other | Homebrew | brew | 28acfbba51ea1e4e67365e5c9fa666d0c5ca9db5.json | Improve tokenization of version strings
Tokens like "b4", "beta1", "p195", &c. are now treated as atoms rather
than being broken down even further. Additionally, we enable support for
padding in the middle of versions strings, so we can successfully
compare something like "2.1-p195" with "2.1.0-p194" by inferring that... | Library/Homebrew/version.rb | @@ -1,92 +1,168 @@
-class VersionElement
+class Version
include Comparable
- def initialize elem
- elem = elem.to_s.downcase
- @elem = case elem
- when /\d+/ then elem.to_i
- when 'a', 'alpha' then 'alpha'
- when 'b', 'beta' then 'beta'
- else elem
- end
+ class Token
+ include ... | true |
Other | Homebrew | brew | 44878e623faaee327024d1f3b9b0301e6fc0e234.json | README.md: add license information.
Closes Homebrew/homebrew#20241.
Closes Homebrew/homebrew#20248. | README.md | @@ -17,9 +17,13 @@ Who Are You?
------------
I'm [Max Howell][mxcl] and I'm a splendid chap.
+License
+-------
+Code is under the [BSD 2 Clause (NetBSD) license][license].
[home]:http://brew.sh
[wiki]:http://wiki.github.com/mxcl/homebrew
[mxcl]:http://twitter.com/mxcl
[formula]:http://github.com/mxcl/homebrew... | false |
Other | Homebrew | brew | 816531e28dd476f5f266e3327f0b73b11c23e9ce.json | Remove postgresql and mysql audit noise
Closes Homebrew/homebrew#20159. | Library/Homebrew/cmd/audit.rb | @@ -148,7 +148,7 @@ def audit_deps
problem <<-EOS.undent unless dep.tags.any? || f.name =~ /automake/ && dep.name == 'autoconf'
#{dep} dependency should be "depends_on '#{dep}' => :build"
EOS
- when "git", "ruby", "emacs", "mysql", "mercurial"
+ when "git", "ruby", "emacs", "mercuri... | false |
Other | Homebrew | brew | b97b013fcea50c783faf85e7c12f7844eb86e4b3.json | Extract attr_rw from Formula for reuse
Closes Homebrew/homebrew#20239. | Library/Homebrew/compilers.rb | @@ -6,19 +6,12 @@ def build
class CompilerFailure
attr_reader :compiler
+ attr_rw :build, :cause
def initialize compiler, &block
@compiler = compiler
instance_eval(&block) if block_given?
- @build ||= 9999
- end
-
- def build val=nil
- val.nil? ? @build.to_i : @build = val.to_i
- end
-
- ... | true |
Other | Homebrew | brew | b97b013fcea50c783faf85e7c12f7844eb86e4b3.json | Extract attr_rw from Formula for reuse
Closes Homebrew/homebrew#20239. | Library/Homebrew/extend/module.rb | @@ -0,0 +1,11 @@
+class Module
+ def attr_rw(*attrs)
+ attrs.each do |attr|
+ module_eval <<-EOS, __FILE__, __LINE__ + 1
+ def #{attr}(val=nil)
+ val.nil? ? @#{attr} : @#{attr} = val
+ end
+ EOS
+ end
+ end
+end | true |
Other | Homebrew | brew | b97b013fcea50c783faf85e7c12f7844eb86e4b3.json | Extract attr_rw from Formula for reuse
Closes Homebrew/homebrew#20239. | Library/Homebrew/formula.rb | @@ -688,16 +688,6 @@ def self.method_added method
class << self
# The methods below define the formula DSL.
- def self.attr_rw(*attrs)
- attrs.each do |attr|
- class_eval <<-EOS, __FILE__, __LINE__ + 1
- def #{attr}(val=nil)
- val.nil? ? @#{attr} : @#{attr} = val
- ... | true |
Other | Homebrew | brew | b97b013fcea50c783faf85e7c12f7844eb86e4b3.json | Extract attr_rw from Formula for reuse
Closes Homebrew/homebrew#20239. | Library/Homebrew/formula_support.rb | @@ -77,6 +77,7 @@ def verify_download_integrity fn
class Bottle < SoftwareSpec
attr_writer :url
+ attr_rw :root_url, :prefix, :cellar, :revision
def initialize
super
@@ -103,22 +104,6 @@ def #{cksum}(val)
end
EOS
end
-
- def root_url val=nil
- val.nil? ? @root_url : @root_url = val
-... | true |
Other | Homebrew | brew | b97b013fcea50c783faf85e7c12f7844eb86e4b3.json | Extract attr_rw from Formula for reuse
Closes Homebrew/homebrew#20239. | Library/Homebrew/global.rb | @@ -1,3 +1,4 @@
+require 'extend/module'
require 'extend/fileutils'
require 'extend/pathname'
require 'extend/ARGV' | true |
Other | Homebrew | brew | b97b013fcea50c783faf85e7c12f7844eb86e4b3.json | Extract attr_rw from Formula for reuse
Closes Homebrew/homebrew#20239. | Library/Homebrew/requirement.rb | @@ -88,18 +88,7 @@ def infer_env_modification(o)
end
class << self
- # The default formula to install to satisfy this requirement.
- def default_formula(val=nil)
- val.nil? ? @default_formula : @default_formula = val.to_s
- end
-
- def fatal(val=nil)
- val.nil? ? @fatal : @fatal = val
- ... | true |
Other | Homebrew | brew | b97b013fcea50c783faf85e7c12f7844eb86e4b3.json | Extract attr_rw from Formula for reuse
Closes Homebrew/homebrew#20239. | Library/Homebrew/test/testing_env.rb | @@ -7,9 +7,11 @@
ABS__FILE__ = File.expand_path(__FILE__)
$:.push(File.expand_path(__FILE__+'/../..'))
+require 'extend/module'
require 'extend/fileutils'
require 'extend/pathname'
require 'extend/string'
+require 'extend/symbol'
require 'exceptions'
require 'utils'
require 'rbconfig' | true |
Other | Homebrew | brew | 623b21a7bd2c346427f88e8711fb1e2d90aaa6e0.json | mercurial: Install python bindings properly
Also allow to build with --HEAD by making brew's
download strategy aware of a brewed but unlined hg.
Adapted the caveats so that the procedure to brew
hg --HEAD is clear.
Mention how to config hgk in the caveats. | Library/Homebrew/download_strategy.rb | @@ -552,6 +552,7 @@ def hgpath
@path ||= %W[
#{which("hg")}
#{HOMEBREW_PREFIX}/bin/hg
+ #{Formula.factory('mercurial').opt_prefix}/bin/hg
#{HOMEBREW_PREFIX}/share/python/hg
].find { |p| File.executable? p }
end | false |
Other | Homebrew | brew | ef0920e01d171497a45226bd8ab83b17c3151376.json | Remove unnecessary use of instance_eval | Library/Homebrew/formula.rb | @@ -307,7 +307,7 @@ def std_cmake_args
def python(options={:allowed_major_versions => [2, 3]}, &block)
require 'python_helper'
- self.instance_eval{ python_helper(options, &block) }
+ python_helper(options, &block)
end
# Explicitly only execute the block for 2.x (if a python 2.x is available) | false |
Other | Homebrew | brew | 79953637711de5ba74a9228d6d415c76c1353588.json | Remove empty test file
This breaks my test runner in weird ways. | Library/Homebrew/test/test_python.rb | @@ -1 +0,0 @@
-#TODO!
\ No newline at end of file | false |
Other | Homebrew | brew | 9647954a603dcb39cc8bb3f5fd0028670c2db0de.json | Allow gcc-4.2 in HOMEBREW_CC
Fixes:
$ HOMEBREW_CC=gcc brew irb
...
irb(main):001:0> require 'superenv'
=> true
irb(main):002:0> ENV.setup_build_environment
=> nil
irb(main):003:0> ENV.setup_build_environment
Warning: Invalid value for HOMEBREW_CC: gcc-4.2 | Library/Homebrew/superenv.rb | @@ -108,7 +108,7 @@ def determine_cc
when 'clang', 'gcc-4.0' then ENV['HOMEBREW_CC']
# depending on Xcode version plain 'gcc' could actually be
# gcc-4.0 or llvm-gcc
- when 'gcc' then 'gcc-4.2'
+ when 'gcc', 'gcc-4.2' then 'gcc-4.2'
when 'llvm', 'llvm-gcc' then 'llvm-gc... | false |
Other | Homebrew | brew | 2f02942a84c641ac8890654a0bf7f239029d6f34.json | PostgresqlDependency: use canonical name for default formula | Library/Homebrew/requirements.rb | @@ -41,7 +41,7 @@ def message; <<-EOS.undent
class PostgresqlDependency < Requirement
fatal true
- default_formula 'postgres'
+ default_formula 'postgresql'
satisfy { which 'pg_config' }
| false |
Other | Homebrew | brew | 347c905a7f5967880c59582c7760e2ed23994ca3.json | brew-test-bot: improve long command output. | Library/Contributions/cmd/brew-test-bot.rb | @@ -63,7 +63,7 @@ def puts_command
end
def puts_result
- puts "#{Tty.send status_colour}#{status_upcase}#{Tty.reset}"
+ puts " #{Tty.send status_colour}#{status_upcase}#{Tty.reset}"
end
def has_output? | false |
Other | Homebrew | brew | a886a1b3e373b1ff8e986e52fa0aca14972f20e5.json | test_mach: move helper method out of global namespace | Library/Homebrew/test/test_mach.rb | @@ -1,10 +1,14 @@
require 'testing_env'
-def file pn
- `/usr/bin/file -h '#{pn}'`.chomp
+module FileHelper
+ def file pn
+ `/usr/bin/file -h '#{pn}'`.chomp
+ end
end
class MachOPathnameTests < Test::Unit::TestCase
+ include FileHelper
+
def test_fat_dylib
pn = Pathname.new("#{TEST_FOLDER}/mach/fat... | false |
Other | Homebrew | brew | 41af4592059530e1df14fcb8b846f6b286847ae2.json | Require hardware where it is needed | Library/Homebrew/extend/ENV.rb | @@ -1,3 +1,5 @@
+require 'hardware'
+
module HomebrewEnvExtension
# -w: keep signal to noise high
SAFE_CFLAGS_FLAGS = "-w -pipe" | true |
Other | Homebrew | brew | 41af4592059530e1df14fcb8b846f6b286847ae2.json | Require hardware where it is needed | Library/Homebrew/macos.rb | @@ -1,4 +1,5 @@
require 'os/mac/version'
+require 'hardware'
module MacOS extend self
| true |
Other | Homebrew | brew | 41af4592059530e1df14fcb8b846f6b286847ae2.json | Require hardware where it is needed | Library/Homebrew/test/test_ENV.rb | @@ -1,5 +1,4 @@
require 'testing_env'
-require 'hardware'
class EnvironmentTests < Test::Unit::TestCase
def test_ENV_options | true |
Other | Homebrew | brew | 41af4592059530e1df14fcb8b846f6b286847ae2.json | Require hardware where it is needed | Library/Homebrew/test/test_download_strategies.rb | @@ -1,7 +1,6 @@
require 'testing_env'
require 'download_strategy'
require 'bottles' # XXX: hoist these regexps into constants in Pathname?
-require 'hardware' # XXX: wat. fix this require mess!
class SoftwareSpecDouble
attr_reader :url, :specs | true |
Other | Homebrew | brew | 41af4592059530e1df14fcb8b846f6b286847ae2.json | Require hardware where it is needed | Library/Homebrew/test/test_language_module_dependency.rb | @@ -1,9 +1,6 @@
require 'testing_env'
require 'requirements/language_module_dependency'
-# XXX: Figure out what env file needs to require hardware
-require 'hardware'
-
class LanguageModuleDependencyTests < Test::Unit::TestCase
def assert_deps_fail(spec)
l = LanguageModuleDependency.new(*spec.shift.reverse... | true |
Other | Homebrew | brew | 41af4592059530e1df14fcb8b846f6b286847ae2.json | Require hardware where it is needed | Library/Homebrew/test/test_software_spec.rb | @@ -1,8 +1,5 @@
require 'testing_env'
require 'formula_support'
-
-# XXX: grrrrr
-require 'hardware'
require 'bottles'
class SoftwareSpecTests < Test::Unit::TestCase | true |
Other | Homebrew | brew | 41af4592059530e1df14fcb8b846f6b286847ae2.json | Require hardware where it is needed | Library/Homebrew/test/test_version_subclasses.rb | @@ -1,7 +1,6 @@
require 'testing_env'
require 'version'
require 'os/mac/version'
-require 'hardware'
class MacOSVersionTests < Test::Unit::TestCase
def setup | true |
Other | Homebrew | brew | d212b360eca4969109a3bfcf0fd86e45b75554f7.json | superenv: Improve compiler selection
This fixes superenv on Xcode 3.2.6, and also fixes C++ software with
gcc-4.2 on all Xcodes. | Library/ENV/4.3/cc | @@ -62,12 +62,15 @@ class Cmd
# the work since Makefiles are dumb and include a lot of excess flags.
ENV['HOMEBREW_CC']
when 'c++'
- if ENV['HOMEBREW_CC'] =~ /llvm-gcc/
+ case ENV['HOMEBREW_CC']
+ when /clang/
+ 'clang++'
+ when /llvm-gcc/
'g++'
- elsif ENV['H... | true |
Other | Homebrew | brew | d212b360eca4969109a3bfcf0fd86e45b75554f7.json | superenv: Improve compiler selection
This fixes superenv on Xcode 3.2.6, and also fixes C++ software with
gcc-4.2 on all Xcodes. | Library/Homebrew/superenv.rb | @@ -93,7 +93,7 @@ def determine_cc
"gcc"
elsif ENV['HOMEBREW_CC']
case ENV['HOMEBREW_CC']
- when 'clang', 'gcc' then ENV['HOMEBREW_CC']
+ when 'clang', 'gcc', 'gcc-4.0' then ENV['HOMEBREW_CC']
when 'llvm', 'llvm-gcc' then 'llvm-gcc'
else
opoo "Invalid value for ... | true |
Other | Homebrew | brew | 255c6e7c3fb34fbf8bd8899a051beec930fc7a4d.json | doctor: combine git existence and version checks | Library/Homebrew/cmd/doctor.rb | @@ -687,8 +687,22 @@ def check_filesystem_case_sensitive
EOS
end
+def __check_git_version
+ # https://help.github.com/articles/https-cloning-errors
+ `git --version`.chomp =~ /git version ((?:\d+\.?)+)/
+
+ if Version.new($1) < Version.new("1.7.10") then <<-EOS.undent
+ An outdated version of Git was detect... | false |
Other | Homebrew | brew | 68b3e6f3fb4947076b94a7c0ab09281a8f19fda4.json | Add required methods to AbstractDownloadStrategy
Fixes Homebrew/homebrew#20080. | Library/Homebrew/download_strategy.rb | @@ -28,6 +28,11 @@ def expand_safe_system_args args
def quiet_safe_system *args
safe_system(*expand_safe_system_args(args))
end
+
+ # All download strategies are expected to implement these methods
+ def fetch; end
+ def stage; end
+ def cached_location; end
end
class CurlDownloadStrategy < AbstractD... | false |
Other | Homebrew | brew | 1856f8eadf68cb69195dac95ac79857485789b74.json | brew-test-bot: shorten Jenkins env SHA-1s. | Library/Contributions/cmd/brew-test-bot.rb | @@ -133,8 +133,12 @@ def git arguments
end
def download
+ def shorten_revision revision
+ git("rev-parse --short #{revision}").strip
+ end
+
def current_sha1
- git('rev-parse --short HEAD').strip
+ shorten_revision 'HEAD'
end
def current_branch
@@ -146,8 +150,8 @@ def curre... | false |
Other | Homebrew | brew | 95ab813b35f32314296c70d91d3c11310d9da349.json | Fix Formula#installed_prefix logic
Due to the precedence of "and" relative to "||", this was not working as
intended; but because #version influences #prefix, the outcome was still
correct. So we can simplify this method quite a bit, and take the
opportunity to share code with #prefix. | Library/Homebrew/formula.rb | @@ -99,17 +99,9 @@ def linked_keg
end
def installed_prefix
- devel_prefix = unless devel.nil?
- Pathname.new("#{HOMEBREW_CELLAR}/#{name}/#{devel.version}")
- end
-
- head_prefix = unless head.nil?
- Pathname.new("#{HOMEBREW_CELLAR}/#{name}/#{head.version}")
- end
-
- if active_spec == h... | false |
Other | Homebrew | brew | fafa62d1d2a2bb517263f89beff9f57fa35a9753.json | brew-test-bot: use Jenkins env, add step.passed? | Library/Contributions/cmd/brew-test-bot.rb | @@ -47,6 +47,10 @@ def status_upcase
@status.to_s.upcase
end
+ def passed?
+ @status == :passed
+ end
+
def failed?
@status == :failed
end
@@ -140,7 +144,12 @@ def current_branch
@category = __method__
@start_branch = current_branch
- if @hash or @url
+ # Use Jenkins environm... | false |
Other | Homebrew | brew | d3b9367cbbdb8785c9572af13cb323f6809d7f03.json | Fix completion of install options without formula
Fixes Homebrew/homebrew#20084. | Library/Contributions/brew_bash_completion.sh | @@ -220,7 +220,7 @@ _brew_install ()
--use-gcc
--use-llvm
--verbose
- $(brew options --compact "$prv")
+ $(brew options --compact "$prv" 2>/dev/null)
"
fi
return | false |
Other | Homebrew | brew | 8407ad23561882b879febbf4870efa7ccca36fd7.json | Add tests for Formula#installed_prefix | Library/Homebrew/test/test_formula.rb | @@ -26,6 +26,84 @@ def test_installed?
assert f.installed?
end
+ def test_installed_prefix
+ f = Class.new(TestBall).new
+ assert_equal f.prefix, f.installed_prefix
+ end
+
+ def test_installed_prefix_head_installed
+ f = formula do
+ head 'foo'
+ devel do
+ url 'foo'
+ ver... | false |
Other | Homebrew | brew | 4adecd73b64de53913262870a4855e13ae085b81.json | tests: extract common formula helper | Library/Homebrew/test/test_formula_spec_selection.rb | @@ -2,10 +2,6 @@
require 'formula'
class FormulaSpecSelectionTests < Test::Unit::TestCase
- def formula(*args, &block)
- @_f = Class.new(Formula, &block).new(*args)
- end
-
def assert_spec_selected(spec)
assert_equal @_f.send(spec), @_f.active_spec
end | true |
Other | Homebrew | brew | 4adecd73b64de53913262870a4855e13ae085b81.json | tests: extract common formula helper | Library/Homebrew/test/test_formula_validation.rb | @@ -2,10 +2,6 @@
require 'formula'
class FormulaValidationTests < Test::Unit::TestCase
- def formula(*args, &block)
- Class.new(Formula, &block).new(*args)
- end
-
def assert_invalid(attr, &block)
e = assert_raises(FormulaValidationError, &block)
assert_equal attr, e.attr | true |
Other | Homebrew | brew | 4adecd73b64de53913262870a4855e13ae085b81.json | tests: extract common formula helper | Library/Homebrew/test/testing_env.rb | @@ -106,3 +106,9 @@ def assert_empty(obj, msg=nil)
assert(obj.empty?, msg)
end if RUBY_VERSION.to_f <= 1.8
end
+
+class Test::Unit::TestCase
+ def formula(*args, &block)
+ @_f = Class.new(Formula, &block).new(*args)
+ end
+end | true |
Other | Homebrew | brew | f0008a7e8f2b8dcab3866a05528c3038df71644e.json | brew-test-bot: add times, cleanup JUnit output. | Library/Contributions/cmd/brew-test-bot.rb | @@ -16,7 +16,7 @@
HOMEBREW_CONTRIBUTED_CMDS = HOMEBREW_REPOSITORY + "Library/Contributions/cmd/"
class Step
- attr_reader :command, :name, :status, :output
+ attr_reader :command, :name, :status, :output, :time
def initialize test, command, puts_output_on_success = false
@test = test
@@ -26,6 +26,7 @@ d... | true |
Other | Homebrew | brew | f0008a7e8f2b8dcab3866a05528c3038df71644e.json | brew-test-bot: add times, cleanup JUnit output. | Library/Contributions/cmd/brew-test-bot.xml.erb | @@ -1,13 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
-<% tests.each do |test| %>
-<testsuite name="<%= test.name %>" tests="<%= test.steps.count %>">
- <% test.steps.each do |step| %>
- <testcase name="<%= step.name %>" status="<%= step.status %>">
- <system-out><![CDATA[<%= step.output %>]]></system-out>
- ... | true |
Other | Homebrew | brew | 892d601465bbb261291f92f0fd95e5b9a11f24ee.json | brew-test-bot: improve JUnit output. | Library/Contributions/cmd/brew-test-bot.rb | @@ -16,17 +16,16 @@
HOMEBREW_CONTRIBUTED_CMDS = HOMEBREW_REPOSITORY + "Library/Contributions/cmd/"
class Step
- attr_reader :command, :repository, :name
- attr_accessor :status
+ attr_reader :command, :name, :status, :output
- def initialize test, command
+ def initialize test, command, puts_output_on_succes... | true |
Other | Homebrew | brew | 892d601465bbb261291f92f0fd95e5b9a11f24ee.json | brew-test-bot: improve JUnit output. | Library/Contributions/cmd/brew-test-bot.xml.erb | @@ -1,14 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
-<testsuites name="brew-test-bot">
- <% tests.each do |test| %>
- <testsuite name="<%= test.name %>" tests="<%= test.steps.count %>">
- <% test.steps.each do |step| %>
- <testcase name="<%= step.name %>" status="<%= step.status %>">
- ... | true |
Other | Homebrew | brew | 052293f22cba6f45a6d983909ac9a01ca5df54b8.json | brew-test-bot: add missing xml.erb file. | Library/Contributions/cmd/brew-test-bot.xml.erb | @@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<testsuites name="brew-test-bot">
+ <% tests.each do |test| %>
+ <testsuite name="<%= test.name %>" tests="<%= test.steps.count %>">
+ <% test.steps.each do |step| %>
+ <testcase name="<%= step.name %>" status="<%= step.status %>">
+ ... | false |
Other | Homebrew | brew | b1f00c57573bcb852f97cdbd863ba664635e9ab2.json | brew-test-bot: add optional JUnit support. | Library/Contributions/cmd/brew-test-bot.rb | @@ -6,15 +6,17 @@
# --keep-logs: Write and keep log files under ./brewbot/
# --cleanup: Clean the Homebrew directory. Very dangerous. Use with care.
# --skip-setup: Don't check the local system is setup correctly.
+# --junit: Generate a JUnit XML test results file.
require 'formula'
require 'uti... | false |
Other | Homebrew | brew | 05f92b5c98775b554a609d10c96f6c55377045be.json | build: expand dependencies only once
Closes Homebrew/homebrew#20081. | Library/Homebrew/build.rb | @@ -73,8 +73,7 @@ def post_superenv_hacks
def pre_superenv_hacks
# Allow a formula to opt-in to the std environment.
- ARGV.unshift '--env=std' if (f.env.std? or
- f.recursive_dependencies.detect{|d| d.name == 'scons' }) and
+ ARGV.unshift '--env=std' if (f.env.std? or deps.any? { |d| d.name == 'sc... | false |
Other | Homebrew | brew | 12158b201dc67e96cf8cceb700f569d16aab756d.json | build: expand requirements only once | Library/Homebrew/build.rb | @@ -55,17 +55,18 @@ def main
end
class Build
- attr_reader :f, :deps
+ attr_reader :f, :deps, :reqs
def initialize(f)
@f = f
@deps = expand_deps
+ @reqs = f.recursive_requirements
end
def post_superenv_hacks
# Only allow Homebrew-approved directories into the PATH, unless
# a f... | false |
Other | Homebrew | brew | 67694b8c6064e4424a05e79a7e7907c5f9f744fb.json | build: move build methods into a class | Library/Homebrew/build.rb | @@ -40,7 +40,7 @@ def main
# can be inconvenient for the user. But we need to be safe.
system "/usr/bin/sudo", "-k"
- install(Formula.factory($0))
+ Build.new(Formula.factory($0)).install
rescue Exception => e
unless error_pipe.nil?
e.continuation = nil if ARGV.debug?
@@ -54,106 +54,114 @@ def main
... | false |
Other | Homebrew | brew | 439a2f4fae2e5ddae40a808246f28b5b4e7961f6.json | Dependency: use instanceof? in eql?
This matches the eql? definition for requirements. | Library/Homebrew/dependency.rb | @@ -20,7 +20,7 @@ def ==(other)
end
def eql?(other)
- other.is_a?(self.class) && hash == other.hash
+ instance_of?(other.class) && hash == other.hash
end
def hash | false |
Other | Homebrew | brew | dd9346ada2a9730bd98432f9f77f3d3cc81b853f.json | outdated: yield version list rather than recreate it | Library/Homebrew/cmd/outdated.rb | @@ -3,9 +3,8 @@
module Homebrew extend self
def outdated
- outdated_brews do |f|
+ outdated_brews do |f, versions|
if $stdout.tty? and not ARGV.flag? '--quiet'
- versions = f.rack.subdirs.map { |d| Keg.new(d).version }.sort
puts "#{f.name} (#{versions*', '} < #{f.version})"
els... | false |
Other | Homebrew | brew | 92857a7bd8737b7dd30941d8aaef27023e7efb8a.json | Define inspect on Option and Options | Library/Homebrew/options.rb | @@ -31,6 +31,10 @@ def hash
name.hash
end
+ def inspect
+ "#<#{self.class}: #{flag.inspect}>"
+ end
+
private
def split_name(name)
@@ -101,6 +105,10 @@ def to_a
end
alias_method :to_ary, :to_a
+ def inspect
+ "#<#{self.class}: #{@options.map(&:inspect).join(", ")}>"
+ end
+
def se... | false |
Other | Homebrew | brew | 404845eaeb8e083a306e9b747c8a65b168abae9c.json | Remove default_formula from MPIDependency.
Closes Homebrew/homebrew#19966. | Library/Homebrew/requirements/mpi_dependency.rb | @@ -9,8 +9,6 @@ class MPIDependency < Requirement
fatal true
- default_formula 'open-mpi'
-
env :userpaths
def initialize *lang_list | false |
Other | Homebrew | brew | 187b9c9d593be13b137da7fb675764f57b03a8db.json | doctor: simplify trailing slash checks | Library/Homebrew/cmd/doctor.rb | @@ -41,14 +41,10 @@ def get_mounts path=nil
class Checks
############# HELPERS
- def remove_trailing_slash s
- (s[s.length-1] == '/') ? s[0,s.length-1] : s
- end
-
def paths
@paths ||= ENV['PATH'].split(':').collect do |p|
begin
- remove_trailing_slash(File.expand_path(p))
+ File.e... | false |
Other | Homebrew | brew | 6a020239d14d5a5d8a8853f8d619b0d4b6b1b57a.json | doctor: extract helper from stray file checks | Library/Homebrew/cmd/doctor.rb | @@ -97,91 +97,73 @@ def check_for_macgpg2
end unless File.exist? '/usr/local/MacGPG2/share/gnupg/VERSION'
end
-def check_for_stray_dylibs
- unbrewed_dylibs = Dir['/usr/local/lib/*.dylib'].select { |f| File.file? f and not File.symlink? f }
+def __check_stray_files(pattern, white_list, message)
+ files = Dir[pat... | false |
Other | Homebrew | brew | aec45a6ee66c28f0be7c8d1d608596676fe65550.json | correct an indent | Library/Homebrew/patches.rb | @@ -42,7 +42,7 @@ def download!
private
def external_patches
- @patches.select{|p| p.external?}
+ @patches.select{|p| p.external?}
end
# Collects the urls and output names of all external patches | false |
Other | Homebrew | brew | 46d2b2165ab1f559e52d4b24cb86d96505a7f4f4.json | Allow brew log on deleted formulae.
Closes Homebrew/homebrew#19995. | Library/Homebrew/cmd/log.rb | @@ -4,9 +4,14 @@ def log
cd HOMEBREW_REPOSITORY
exec "git", "log", *ARGV.options_only
else
- path = ARGV.formulae.first.path.realpath
+ begin
+ path = ARGV.formulae.first.path.realpath
+ rescue FormulaUnavailableError
+ # Maybe the formula was deleted
+ path = HOME... | false |
Other | Homebrew | brew | b2ff6e934bad87aaa4a8f4f7d3bc66fa87e8e72b.json | Use implicit begin | Library/Homebrew/utils.rb | @@ -260,16 +260,14 @@ def nostdout
module GitHub extend self
def open url, headers={}, &block
- begin
- default_headers = {'User-Agent' => HOMEBREW_USER_AGENT}
- default_headers['Authorization'] = "token #{HOMEBREW_GITHUB_API_TOKEN}" if HOMEBREW_GITHUB_API_TOKEN
- Kernel.open(url, default_header... | false |
Other | Homebrew | brew | 471502bc06e8dde06618b30885d21d10c53528e5.json | Remove unnecessary rescue-all exception handling
Signed-off-by: Jack Nagel <jacknagel@gmail.com> | Library/Contributions/cmd/brew-ls-taps.rb | @@ -1,16 +1,13 @@
require 'vendor/multi_json'
GitHub.open "https://api.github.com/legacy/repos/search/homebrew" do |f|
- begin
- MultiJson.decode(f.read)["repositories"].each do |repo|
- if repo['name'] =~ /^homebrew-(\S+)$/
- puts tap = if repo['username'] == "Homebrew"
- "homebrew/#{$1}"
... | true |
Other | Homebrew | brew | 471502bc06e8dde06618b30885d21d10c53528e5.json | Remove unnecessary rescue-all exception handling
Signed-off-by: Jack Nagel <jacknagel@gmail.com> | Library/Homebrew/cmd/search.rb | @@ -64,16 +64,13 @@ def search_tap user, repo, rx
results = []
GitHub.open "https://api.github.com/repos/#{user}/homebrew-#{repo}/git/trees/HEAD?recursive=1" do |f|
- begin
- user.downcase! if user == "Homebrew" # special handling for the Homebrew organization
- MultiJson.decode(f.read)["... | true |
Other | Homebrew | brew | 471502bc06e8dde06618b30885d21d10c53528e5.json | Remove unnecessary rescue-all exception handling
Signed-off-by: Jack Nagel <jacknagel@gmail.com> | Library/Homebrew/utils.rb | @@ -286,13 +286,10 @@ def issues_for_formula name
uri = URI.parse("https://api.github.com/legacy/issues/search/mxcl/homebrew/open/#{name}")
- open uri do |f|
- begin
- MultiJson.decode(f.read)['issues'].each do |issue|
- # don't include issues that just refer to the tool in their body
-... | true |
Other | Homebrew | brew | 0bf35a05a9140cf5da59f236927a07cd689fd123.json | Favor equality check over nil check | Library/Homebrew/keg_fix_install_names.rb | @@ -8,7 +8,7 @@ def fix_install_names
bad_names.each do |bad_name|
new_name = fixed_name(file, bad_name)
- unless new_name.nil?
+ unless new_name == bad_name
install_name_tool("-change", bad_name, new_name, file)
end
end
@@ -61,7 +61... | false |
Other | Homebrew | brew | 0e81c4de9cbb503fc3cc87cba865c5cef6ccb350.json | Formula: move pin methods somewhere less intrusive | Library/Homebrew/formula.rb | @@ -98,22 +98,6 @@ def installed?
(dir = installed_prefix).directory? && dir.children.length > 0
end
- def pinnable?
- @pin.pinnable?
- end
-
- def pinned?
- @pin.pinned?
- end
-
- def pin
- @pin.pin
- end
-
- def unpin
- @pin.unpin
- end
-
def linked_keg
Pathname.new("#{HOMEBREW_L... | false |
Other | Homebrew | brew | 6e3cb9f735165ecdda5bcc3d6cd656fa29872c5a.json | Add gcc 4.0 to CompilerSelector compiler queue | Library/Homebrew/compilers.rb | @@ -46,7 +46,7 @@ def initialize(f, old_compiler)
@f = f
@old_compiler = old_compiler
@compilers = CompilerQueue.new
- %w{clang llvm gcc}.map(&:to_sym).each do |cc|
+ %w{clang llvm gcc gcc_4_0}.map(&:to_sym).each do |cc|
unless MacOS.send("#{cc}_build_version").nil?
@compilers << Co... | false |
Other | Homebrew | brew | 4fdbb2d685d1c20e84d1d31bc50f638aa1a800e1.json | CompilerSelector: raise when no compatible compiler
This replaces the old behaviour of falling back to the original
compiler with no messaging.
Fixes Homebrew/homebrew#19170.
Fixes mistydemeo/tigerbrew#45. | Library/Homebrew/build.rb | @@ -115,7 +115,11 @@ def install f
end
if f.fails_with? ENV.compiler
- ENV.send CompilerSelector.new(f, ENV.compiler).compiler
+ begin
+ ENV.send CompilerSelector.new(f, ENV.compiler).compiler
+ rescue CompilerSelectionError => e
+ raise e.message
+ end
end
f.brew do | true |
Other | Homebrew | brew | 4fdbb2d685d1c20e84d1d31bc50f638aa1a800e1.json | CompilerSelector: raise when no compatible compiler
This replaces the old behaviour of falling back to the original
compiler with no messaging.
Fixes Homebrew/homebrew#19170.
Fixes mistydemeo/tigerbrew#45. | Library/Homebrew/compilers.rb | @@ -53,11 +53,18 @@ def initialize(f, old_compiler)
end
end
+ # Attempts to select an appropriate alternate compiler, but
+ # if none can be found raises CompilerError instead
def compiler
begin
cc = @compilers.pop
end while @f.fails_with?(cc)
- cc.nil? ? @old_compiler : cc.name
+
+ ... | true |
Other | Homebrew | brew | 4fdbb2d685d1c20e84d1d31bc50f638aa1a800e1.json | CompilerSelector: raise when no compatible compiler
This replaces the old behaviour of falling back to the original
compiler with no messaging.
Fixes Homebrew/homebrew#19170.
Fixes mistydemeo/tigerbrew#45. | Library/Homebrew/exceptions.rb | @@ -160,6 +160,26 @@ def dump
end
end
+# raised by CompilerSelector if the formula fails with all of
+# the compilers available on the user's system
+class CompilerSelectionError < StandardError
+ def message
+ if MacOS.version > :tiger then <<-EOS.undent
+ This formula cannot be built with any available... | true |
Other | Homebrew | brew | 4fdbb2d685d1c20e84d1d31bc50f638aa1a800e1.json | CompilerSelector: raise when no compatible compiler
This replaces the old behaviour of falling back to the original
compiler with no messaging.
Fixes Homebrew/homebrew#19170.
Fixes mistydemeo/tigerbrew#45. | Library/Homebrew/test/test_compiler_selector.rb | @@ -31,7 +31,7 @@ def actual_cc
def test_all_compiler_failures
@f << :clang << :llvm << :gcc
- assert_equal @cc, actual_cc
+ assert_raise(CompilerSelectionError) { actual_cc }
end
def test_no_compiler_failures
@@ -77,13 +77,13 @@ def test_older_clang_precedence
def test_missing_gcc
MacOS... | true |
Other | Homebrew | brew | c9ce32d0f1ac550a25153b376c6584e5d7004a85.json | Simplify implementation of ARGV.flag? and .switch? | Library/Homebrew/extend/ARGV.rb | @@ -135,22 +135,17 @@ def build_from_source?
end
def flag? flag
- options_only.each do |arg|
- return true if arg == flag
- next if arg[1..1] == '-'
- return true if arg.include? flag[2..2]
+ options_only.any? do |arg|
+ arg == flag || arg[1..1] != '-' && arg.include?(flag[2..2])
... | false |
Other | Homebrew | brew | 863d2b253a4c4be255e309b18d4fd14ad94155c1.json | Add test for ARGV.flag? | Library/Homebrew/test/test_ARGV.rb | @@ -38,6 +38,16 @@ def test_switch?
%w{b ns bar --bar -n}.each { |s| assert !@argv.switch?(s) }
end
+ def test_flag?
+ @argv << "--foo" << "-bq" << "--bar"
+ assert @argv.flag?("--foo")
+ assert @argv.flag?("--bar")
+ assert @argv.flag?("--baz")
+ assert @argv.flag?("--qux")
+ assert !@argv... | false |
Other | Homebrew | brew | a10cda77be6e730b45db1f77adffe5a578336b2a.json | upgrade: use a method rather than a boolean flag | Library/Homebrew/cmd/upgrade.rb | @@ -18,10 +18,8 @@ def upgrade
if ARGV.named.empty?
require 'cmd/outdated'
- upgrade_pinned = false
outdated = Homebrew.outdated_brews
else
- upgrade_pinned = true
outdated = ARGV.formulae.select do |f|
if f.installed?
onoe "#{f}-#{f.installed_version} alre... | false |
Other | Homebrew | brew | a3312d24a3457d3613ded1ad3db0dc7c794e8c2f.json | Use subdirs to avoid checking for .DS_Store | Library/Homebrew/formula.rb | @@ -529,8 +529,7 @@ def to_hash
end
if rack.directory?
- rack.children.each do |keg|
- next if keg.basename.to_s == '.DS_Store'
+ rack.subdirs.each do |keg|
tab = Tab.for_keg keg
hsh["installed"] << { | false |
Other | Homebrew | brew | 460e8055923068b4438de2137f34320fb1173010.json | Formula: remove specs accessor
This information is only used by the downloader, no need to expose it. | Library/Homebrew/formula.rb | @@ -91,7 +91,6 @@ def validate_attributes(*attrs)
def url; active_spec.url; end
def version; active_spec.version; end
- def specs; active_spec.specs; end
def mirrors; active_spec.mirrors; end
# if the dir is there, but it's empty we consider it not installed | false |
Other | Homebrew | brew | daef74aa27b8316865a44484fefd2d7c424c7342.json | Adjust semantics of Formula#fetch
It doesn't really make logical sense that this method returns both the
fetched path (or sometimes nil!) and the downloader, so just return the
path (again, or nil!) and callers that want the downloader can ask for
it separately. | Library/Homebrew/cmd/fetch.rb | @@ -25,7 +25,7 @@ def already_fetched? f
def fetch_formula f
f.cached_download.rmtree if already_fetched?(f) && ARGV.force?
- download, _ = f.fetch
+ download = f.fetch
# FIXME why are strategies returning different types?
return unless download.is_a? Pathname | true |
Other | Homebrew | brew | daef74aa27b8316865a44484fefd2d7c424c7342.json | Adjust semantics of Formula#fetch
It doesn't really make logical sense that this method returns both the
fetched path (or sometimes nil!) and the downloader, so just return the
path (again, or nil!) and callers that want the downloader can ask for
it separately. | Library/Homebrew/formula.rb | @@ -618,7 +618,7 @@ def system cmd, *args
def fetch
# Ensure the cache exists
HOMEBREW_CACHE.mkpath
- return downloader.fetch, downloader
+ downloader.fetch
end
# For FormulaInstaller.
@@ -643,8 +643,8 @@ def test_defined?
private
def stage
- fetched, downloader = fetch
- verify... | true |
Other | Homebrew | brew | daef74aa27b8316865a44484fefd2d7c424c7342.json | Adjust semantics of Formula#fetch
It doesn't really make logical sense that this method returns both the
fetched path (or sometimes nil!) and the downloader, so just return the
path (again, or nil!) and callers that want the downloader can ask for
it separately. | Library/Homebrew/formula_installer.rb | @@ -406,8 +406,8 @@ def clean
end
def pour
- fetched, downloader = f.fetch
- f.verify_download_integrity fetched unless downloader.local_bottle_path
+ fetched, downloader = f.fetch, f.downloader
+ f.verify_download_integrity(fetched) unless downloader.local_bottle_path
HOMEBREW_CELLAR.cd do
... | true |
Other | Homebrew | brew | db0c93dbae352a3e4ab83e31d360919f1bc3b3d7.json | fetch: use concat rather than << and flatten | Library/Homebrew/cmd/fetch.rb | @@ -10,10 +10,9 @@ def fetch
bucket = []
ARGV.formulae.each do |f|
bucket << f
- bucket << f.recursive_dependencies.map(&:to_formula)
+ bucket.concat f.recursive_dependencies.map(&:to_formula)
end
-
- bucket = bucket.flatten.uniq
+ bucket.uniq!
else
buck... | false |
Other | Homebrew | brew | 903d640d38c4d71fd986d154b0cfc9208321e279.json | Simplify uninstall --force | Library/Homebrew/cmd/uninstall.rb | @@ -26,10 +26,7 @@ def uninstall
if rack.directory?
puts "Uninstalling #{name}..."
- rack.subdirs.map { |d| Keg.new(d) }.each do |keg|
- keg.unlink
- keg.rmtree
- end
+ rack.subdirs.each { |d| Keg.new(d).unlink }
rack.rmtree
end
... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.