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
4bbefc12e36bb3cbe661983f7533110a0f85758e.json
Eliminate boolean argument to Version.new
Library/Homebrew/version.rb
@@ -155,26 +155,30 @@ def <=>(other) StringToken::PATTERN ) + class FromURL < Version + def detected_from_url? + true + end + end + def self.detect(url, specs={}) if specs.has_key?(:tag) - new(specs[:tag][/((?:\d+\.)*\d+)/, 1], true) + FromURL.new(specs[:tag][/((?:\d+\.)*\d+)/, 1]) else - parse(url) + FromURL.parse(url) end end - def initialize(val, detected=false) + def initialize(val) if val.respond_to?(:to_str) @version = val.to_str else raise TypeError, "Version value must be a string" end - - @detected_from_url = detected end def detected_from_url? - @detected_from_url + false end def head? @@ -236,7 +240,7 @@ def tokenize def self.parse spec version = _parse(spec) - new(version, true) unless version.nil? + new(version) unless version.nil? end def self._parse spec
false
Other
Homebrew
brew
35793f0e0cf855a687176e44ad8e564605de925f.json
Let Version.parse instantiate subclasses
Library/Homebrew/version.rb
@@ -236,7 +236,7 @@ def tokenize def self.parse spec version = _parse(spec) - Version.new(version, true) unless version.nil? + new(version, true) unless version.nil? end def self._parse spec
false
Other
Homebrew
brew
dcad08339e8cc2723cb5b4095528d48bc3a802ac.json
Fix syntax error
Library/Homebrew/cmd/edit.rb
@@ -16,9 +16,9 @@ def edit if editor == "mate" or editor == "subl" # If the user is using TextMate or Sublime Text, # give a nice project view instead. - exec_editor, HOMEBREW_REPOSITORY+"bin/brew", - HOMEBREW_REPOSITORY+'README.md', - HOMEBREW_REPOSITORY+".gitignore", + exec_editor HOMEBREW_REPOSITORY+"bin/brew", + HOMEBREW_REPOSITORY+'README.md', + HOMEBREW_REPOSITORY+".gitignore", *library_folders else exec_editor HOMEBREW_REPOSITORY
false
Other
Homebrew
brew
eec4feccaa06ab909ffc02fcec7d63a3e23fdd2d.json
Include selected spec in Formula#inspect
Library/Homebrew/formula.rb
@@ -436,7 +436,9 @@ def to_s end def inspect - "#<#{self.class.name}: #{path}>" + s = "#<Formula #{name} (" + s << if head? then "head" elsif devel? then "devel" else "stable" end + s << ") #{path}>" end # Standard parameters for CMake builds.
false
Other
Homebrew
brew
8535c037ac8e6e8bff50db271de5e2d9c9370890.json
Remove unused assignment
Library/Homebrew/download_strategy.rb
@@ -380,7 +380,6 @@ class LocalBottleDownloadStrategy < AbstractFileDownloadStrategy attr_reader :cached_location def initialize(formula) - @name = name @cached_location = formula.local_bottle_path end
false
Other
Homebrew
brew
683e209b10e897199595696f9c86a9568fd7bc6c.json
Remove unused argument
Library/Homebrew/formula_versions.rb
@@ -54,7 +54,7 @@ def version_at_revision(rev) formula_at_revision(rev) { |f| f.version } end - def formula_at_revision rev, &block + def formula_at_revision(rev) FileUtils.mktemp(f.name) do path = Pathname.pwd.join("#{f.name}.rb") path.write file_contents_at_revision(rev)
false
Other
Homebrew
brew
bd334c55a00d006168c767ea0442df7d6a1954ea.json
brew.rb: return exit code from internal commands.
Library/brew.rb
@@ -133,6 +133,7 @@ def require? path if internal_cmd Homebrew.send cmd.to_s.gsub('-', '_').downcase + exit 1 if Homebrew.failed? elsif which "brew-#{cmd}" %w[CACHE CELLAR LIBRARY_PATH PREFIX REPOSITORY].each do |e| ENV["HOMEBREW_#{e}"] = Object.const_get("HOMEBREW_#{e}").to_s
false
Other
Homebrew
brew
fc2818b7a54dadcf0c35965ef1f07219da3fc4a7.json
Use more https in urls and updated some lost links Closes Homebrew/homebrew#35531. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Library/Homebrew/blacklist.rb
@@ -15,7 +15,7 @@ def blacklisted? name Installing TeX from source is weird and gross, requires a lot of patches, and only builds 32-bit (and thus can't use Homebrew deps on Snow Leopard.) - We recommend using a MacTeX distribution: http://www.tug.org/mactex/ + We recommend using a MacTeX distribution: https://www.tug.org/mactex/ EOS when 'pip' then <<-EOS.undent Homebrew provides pip via: `brew install python`. However you will then @@ -78,8 +78,8 @@ def blacklisted? name brew install typesafe-activator You can read more about this change at: - http://www.playframework.com/documentation/2.3.x/Migration23 - http://www.playframework.com/documentation/2.3.x/Highlights23 + https://www.playframework.com/documentation/2.3.x/Migration23 + https://www.playframework.com/documentation/2.3.x/Highlights23 EOS when 'haskell-platform' then <<-EOS.undent We no longer package haskell-platform. Consider installing ghc
true
Other
Homebrew
brew
fc2818b7a54dadcf0c35965ef1f07219da3fc4a7.json
Use more https in urls and updated some lost links Closes Homebrew/homebrew#35531. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Library/Homebrew/cmd/aspell-dictionaries.rb
@@ -5,7 +5,7 @@ module Homebrew def aspell_dictionaries dict_url = "http://ftpmirror.gnu.org/aspell/dict" - dict_mirror = "http://ftp.gnu.org/gnu/aspell/dict" + dict_mirror = "https://ftp.gnu.org/gnu/aspell/dict" languages = {} open("#{dict_url}/0index.html") do |content|
true
Other
Homebrew
brew
fc2818b7a54dadcf0c35965ef1f07219da3fc4a7.json
Use more https in urls and updated some lost links Closes Homebrew/homebrew#35531. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Library/Homebrew/cmd/create.rb
@@ -10,7 +10,7 @@ def create # Allow searching MacPorts or Fink. if ARGV.include? '--macports' - exec_browser "http://www.macports.org/ports.php?by=name&substr=#{ARGV.next}" + exec_browser "https://www.macports.org/ports.php?by=name&substr=#{ARGV.next}" elsif ARGV.include? '--fink' exec_browser "http://pdb.finkproject.org/pdb/browse.php?summary=#{ARGV.next}" end
true
Other
Homebrew
brew
fc2818b7a54dadcf0c35965ef1f07219da3fc4a7.json
Use more https in urls and updated some lost links Closes Homebrew/homebrew#35531. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Library/Homebrew/cmd/doctor.rb
@@ -86,7 +86,7 @@ def check_path_for_trailing_slashes end # Installing MacGPG2 interferes with Homebrew in a big way -# http://sourceforge.net/projects/macgpg2/files/ +# https://github.com/GPGTools/MacGPG2 def check_for_macgpg2 return if File.exist? '/usr/local/MacGPG2/share/gnupg/VERSION' @@ -1081,8 +1081,8 @@ def check_for_pydistutils_cfg_in_home if File.exist? "#{ENV['HOME']}/.pydistutils.cfg" then <<-EOS.undent A .pydistutils.cfg file was found in $HOME, which may cause Python builds to fail. See: - http://bugs.python.org/issue6138 - http://bugs.python.org/issue4655 + https://bugs.python.org/issue6138 + https://bugs.python.org/issue4655 EOS end end
true
Other
Homebrew
brew
fc2818b7a54dadcf0c35965ef1f07219da3fc4a7.json
Use more https in urls and updated some lost links Closes Homebrew/homebrew#35531. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Library/Homebrew/cmd/search.rb
@@ -9,11 +9,11 @@ module Homebrew def search if ARGV.include? '--macports' - exec_browser "http://www.macports.org/ports.php?by=name&substr=#{ARGV.next}" + exec_browser "https://www.macports.org/ports.php?by=name&substr=#{ARGV.next}" elsif ARGV.include? '--fink' exec_browser "http://pdb.finkproject.org/pdb/browse.php?summary=#{ARGV.next}" elsif ARGV.include? '--debian' - exec_browser "http://packages.debian.org/search?keywords=#{ARGV.next}&searchon=names&suite=all&section=all" + exec_browser "https://packages.debian.org/search?keywords=#{ARGV.next}&searchon=names&suite=all&section=all" elsif ARGV.include? '--opensuse' exec_browser "http://software.opensuse.org/search?q=#{ARGV.next}" elsif ARGV.include? '--fedora'
true
Other
Homebrew
brew
fc2818b7a54dadcf0c35965ef1f07219da3fc4a7.json
Use more https in urls and updated some lost links Closes Homebrew/homebrew#35531. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Library/Homebrew/download_strategy.rb
@@ -285,7 +285,7 @@ def ext # We need a Pathname because we've monkeypatched extname to support double # extensions (e.g. tar.gz). # We can't use basename_without_params, because given a URL like - # http://example.com/download.php?file=foo-1.0.tar.gz + # https://example.com/download.php?file=foo-1.0.tar.gz # the extension we want is ".tar.gz", not ".php". Pathname.new(@url).extname[/[^?]+/] end @@ -526,7 +526,7 @@ def stage dst = Dir.getwd cached_location.cd do - # http://stackoverflow.com/questions/160608/how-to-do-a-git-export-like-svn-export + # https://stackoverflow.com/questions/160608/how-to-do-a-git-export-like-svn-export safe_system 'git', 'checkout-index', '-a', '-f', "--prefix=#{dst}/" checkout_submodules(dst) if submodules? end
true
Other
Homebrew
brew
fc2818b7a54dadcf0c35965ef1f07219da3fc4a7.json
Use more https in urls and updated some lost links Closes Homebrew/homebrew#35531. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Library/Homebrew/extend/ENV/shared.rb
@@ -140,7 +140,7 @@ def determine_cc end # Snow Leopard defines an NCURSES value the opposite of most distros - # See: http://bugs.python.org/issue6848 + # See: https://bugs.python.org/issue6848 # Currently only used by aalib in core def ncurses_define append 'CPPFLAGS', "-DNCURSES_OPAQUE=0"
true
Other
Homebrew
brew
fc2818b7a54dadcf0c35965ef1f07219da3fc4a7.json
Use more https in urls and updated some lost links Closes Homebrew/homebrew#35531. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Library/Homebrew/os/mac.rb
@@ -136,9 +136,9 @@ def clear_version_cache end # See these issues for some history: - # http://github.com/Homebrew/homebrew/issues/13 - # http://github.com/Homebrew/homebrew/issues/41 - # http://github.com/Homebrew/homebrew/issues/48 + # https://github.com/Homebrew/homebrew/issues/13 + # https://github.com/Homebrew/homebrew/issues/41 + # https://github.com/Homebrew/homebrew/issues/48 def macports_or_fink paths = []
true
Other
Homebrew
brew
fc2818b7a54dadcf0c35965ef1f07219da3fc4a7.json
Use more https in urls and updated some lost links Closes Homebrew/homebrew#35531. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Library/Homebrew/os/mac/xcode.rb
@@ -53,7 +53,7 @@ def toolchain_path # Ask Spotlight where Xcode is. If the user didn't install the # helper tools and installed Xcode in a non-conventional place, this - # is our only option. See: http://superuser.com/questions/390757 + # is our only option. See: https://superuser.com/questions/390757 def bundle_path MacOS.app_with_bundle_id(V4_BUNDLE_ID, V3_BUNDLE_ID) end
true
Other
Homebrew
brew
fc2818b7a54dadcf0c35965ef1f07219da3fc4a7.json
Use more https in urls and updated some lost links Closes Homebrew/homebrew#35531. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Library/Homebrew/os/mac/xquartz.rb
@@ -42,8 +42,8 @@ def detect_version end end - # http://xquartz.macosforge.org/trac/wiki - # http://xquartz.macosforge.org/trac/wiki/Releases + # https://xquartz.macosforge.org/trac/wiki + # https://xquartz.macosforge.org/trac/wiki/Releases def latest_version case MacOS.version when "10.5"
true
Other
Homebrew
brew
fc2818b7a54dadcf0c35965ef1f07219da3fc4a7.json
Use more https in urls and updated some lost links Closes Homebrew/homebrew#35531. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Library/Homebrew/requirements.rb
@@ -61,7 +61,7 @@ class PostgresqlDependency < Requirement class TeXDependency < Requirement fatal true cask "mactex" - download "http://www.tug.org/mactex/" + download "https://www.tug.org/mactex/" satisfy { which('tex') || which('latex') }
true
Other
Homebrew
brew
fc2818b7a54dadcf0c35965ef1f07219da3fc4a7.json
Use more https in urls and updated some lost links Closes Homebrew/homebrew#35531. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Library/Homebrew/requirements/mpi_dependency.rb
@@ -50,7 +50,7 @@ def mpi_wrapper_works? compiler env do # Set environment variables to help configure scripts find MPI compilers. # Variable names taken from: - # http://www.gnu.org/software/autoconf-archive/ax_mpi.html + # https://www.gnu.org/software/autoconf-archive/ax_mpi.html @lang_list.each do |lang| compiler = 'mpi' + lang.to_s mpi_path = which compiler
true
Other
Homebrew
brew
fc2818b7a54dadcf0c35965ef1f07219da3fc4a7.json
Use more https in urls and updated some lost links Closes Homebrew/homebrew#35531. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Library/Homebrew/version.rb
@@ -301,7 +301,7 @@ def self._parse spec m = /_((?:\d+\.)+\d+[abc]?)[.]orig$/.match(stem) return m.captures.first unless m.nil? - # e.g. http://www.openssl.org/source/openssl-0.9.8s.tar.gz + # e.g. https://www.openssl.org/source/openssl-0.9.8s.tar.gz m = /-v?([^-]+)/.match(stem) return m.captures.first unless m.nil?
true
Other
Homebrew
brew
9e8103cf38f10a4240f0a796bbecdb635dbc74d4.json
Add Homebrew.install_gem_setup_path! function. This uses the logic from tests.rb in man.rb too so that this can be shared in a few places.
Library/Homebrew/cmd/man.rb
@@ -13,7 +13,7 @@ def man end end - which("ronn") || odie("You need to \"gem install ronn\" and put it in your path.") + Homebrew.install_gem_setup_path! "ronn" if ARGV.include?("--server") || ARGV.include?("-s") puts "Man page test server: http://localhost:1207/"
true
Other
Homebrew
brew
9e8103cf38f10a4240f0a796bbecdb635dbc74d4.json
Add Homebrew.install_gem_setup_path! function. This uses the logic from tests.rb in man.rb too so that this can be shared in a few places.
Library/Homebrew/cmd/tests.rb
@@ -1,12 +1,8 @@ module Homebrew def tests - (HOMEBREW_LIBRARY/'Homebrew/test').cd do - ENV['TESTOPTS'] = '-v' if ARGV.verbose? - quiet_system("gem", "list", "--installed", "bundler") || \ - system("gem", "install", "--no-ri", "--no-rdoc", - "--user-install", "bundler") - require 'rubygems' - ENV["PATH"] = "#{Gem.user_dir}/bin:#{ENV["PATH"]}" + (HOMEBREW_LIBRARY/"Homebrew/test").cd do + ENV["TESTOPTS"] = "-v" if ARGV.verbose? + Homebrew.install_gem_setup_path! "bundler" quiet_system("bundle", "check") || \ system("bundle", "install", "--path", "vendor/bundle") system "bundle", "exec", "rake", "test"
true
Other
Homebrew
brew
9e8103cf38f10a4240f0a796bbecdb635dbc74d4.json
Add Homebrew.install_gem_setup_path! function. This uses the logic from tests.rb in man.rb too so that this can be shared in a few places.
Library/Homebrew/utils.rb
@@ -119,6 +119,14 @@ def self.git_head def self.git_last_commit HOMEBREW_REPOSITORY.cd { `git show -s --format="%cr" HEAD 2>/dev/null`.chuzzle } end + + def self.install_gem_setup_path! gem + return if quiet_system "gem", "list", "--installed", gem + system "gem", "install", "--no-ri", "--no-rdoc", + "--user-install", gem + require "rubygems" + ENV["PATH"] = "#{Gem.user_dir}/bin:#{ENV["PATH"]}" + end end def with_system_path
true
Other
Homebrew
brew
1e96c6fec4b449f1357744404d0cc62125db6888.json
formula_versions: ignore another exception.
Library/Homebrew/formula_versions.rb
@@ -4,7 +4,7 @@ class FormulaVersions IGNORED_EXCEPTIONS = [ ArgumentError, NameError, SyntaxError, TypeError, FormulaSpecificationError, FormulaValidationError, - ErrorDuringExecution, + ErrorDuringExecution, LoadError, ] attr_reader :f
false
Other
Homebrew
brew
26a2e4c4d38f111ab89093c12e3532529fc8da0b.json
Avoid formula lookup when we know it will fail Formulary.loader_for cannot raise exceptions, as canonical_name must work for nonexistent formulae. However, we can skip the constant lookup and a redundant file existence check by returning a loader that raises immediately in #get_formula.
Library/Homebrew/formulary.rb
@@ -165,6 +165,16 @@ def get_formula(spec) end end + class NullLoader < FormulaLoader + def initialize(name) + @name = name + end + + def get_formula(spec) + raise FormulaUnavailableError.new(name) + end + end + # Return a Formula instance for the given reference. # `ref` is string containing: # * a formula name @@ -208,6 +218,6 @@ def self.loader_for(ref) return FormulaLoader.new(ref, possible_cached_formula) end - return FormulaLoader.new(ref, Formula.path(ref)) + return NullLoader.new(ref) end end
false
Other
Homebrew
brew
5bf92cd7ca76a4996941f9dc80a251dad2a22d86.json
Check file existence instead of rescuing LoadError
Library/Homebrew/formulary.rb
@@ -72,11 +72,8 @@ def klass def load_file STDERR.puts "#{$0} (#{self.class.name}): loading #{path}" if ARGV.debug? - begin - require(path) - rescue LoadError => e - raise FormulaUnavailableError, name, e.backtrace - end + raise FormulaUnavailableError.new(name) unless path.file? + require(path) end end
false
Other
Homebrew
brew
1de21b7f0003aa731ec3fc147237c9d5a19a41c4.json
Use block-form of File.open
Library/Homebrew/formula.rb
@@ -652,8 +652,7 @@ def system cmd, *args logfn = "#{logd}/%02d.%s" % [@exec_count, File.basename(cmd).split(' ').first] mkdir_p(logd) - log = File.open(logfn, "w") - begin + File.open(logfn, "w") do |log| log.puts Time.now, "", cmd, args, "" log.flush @@ -698,8 +697,6 @@ def system cmd, *args raise BuildError.new(self, cmd, args, env) end - ensure - log.close end end
false
Other
Homebrew
brew
8b51cf019d56c6ab5ab03c7bb4cf504eb7659c93.json
Move exception text into exception object
Library/Homebrew/download_strategy.rb
@@ -184,12 +184,7 @@ def fetch had_incomplete_download = false retry else - if @url =~ %r[^file://] - msg = "File does not exist: #{@url.sub(%r[^file://], "")}" - else - msg = "Download failed: #{@url}" - end - raise CurlDownloadStrategyError, msg + raise CurlDownloadStrategyError.new(@url) end end ignore_interrupts { temporary_path.rename(cached_location) }
true
Other
Homebrew
brew
8b51cf019d56c6ab5ab03c7bb4cf504eb7659c93.json
Move exception text into exception object
Library/Homebrew/exceptions.rb
@@ -208,7 +208,16 @@ def initialize(resource, cause) end # raised in CurlDownloadStrategy.fetch -class CurlDownloadStrategyError < RuntimeError; end +class CurlDownloadStrategyError < RuntimeError + def initialize(url) + case url + when %r[^file://(.+)] + super "File does not exist: #{$1}" + else + super "Download failed: #{url}" + end + end +end # raised by safe_system in utils.rb class ErrorDuringExecution < RuntimeError
true
Other
Homebrew
brew
912a586d15daaa9daf4c4831dc5cc9022acc2b62.json
Preserve backtrace for download errors
Library/Homebrew/exceptions.rb
@@ -198,11 +198,12 @@ def initialize(formula) # Raised in Resource.fetch class DownloadError < RuntimeError - def initialize(resource, e) + def initialize(resource, cause) super <<-EOS.undent Failed to download resource #{resource.download_name.inspect} - #{e.message} + #{cause.message} EOS + set_backtrace(cause.backtrace) end end
false
Other
Homebrew
brew
a9556651022a92ae8134b1efbfa67831d5eb2e5e.json
Preserve backtrace from original exception
Library/Homebrew/extend/ENV/super.rb
@@ -119,7 +119,7 @@ def determine_path when "gcc-4.2" begin apple_gcc42 = Formulary.factory('apple-gcc42') - rescue Exception # in --debug, catch bare exceptions too + rescue FormulaUnavailableError end paths << apple_gcc42.opt_bin.to_s if apple_gcc42 when GNU_GCC_REGEXP
true
Other
Homebrew
brew
a9556651022a92ae8134b1efbfa67831d5eb2e5e.json
Preserve backtrace from original exception
Library/Homebrew/formulary.rb
@@ -55,8 +55,8 @@ def get_formula(spec) def klass begin have_klass = Formulary.formula_class_defined? class_name - rescue NameError - raise FormulaUnavailableError.new(name) + rescue NameError => e + raise FormulaUnavailableError, name, e.backtrace end load_file unless have_klass @@ -78,9 +78,8 @@ def load_file # This is a programming error in an existing formula, and should not # have a "no such formula" message. raise - rescue LoadError, NameError - raise if ARGV.debug? # let's see the REAL error - raise FormulaUnavailableError.new(name) + rescue LoadError, NameError => e + raise FormulaUnavailableError, name, e.backtrace end end end @@ -174,8 +173,8 @@ def initialize tapped_name def get_formula(spec) super - rescue FormulaUnavailableError - raise TapFormulaUnavailableError.new(tapped_name) + rescue FormulaUnavailableError => e + raise TapFormulaUnavailableError, tapped_name, e.backtrace end end
true
Other
Homebrew
brew
633f29af5d3c96efb79c513375a8914ee0a0c163.json
Remove duplicated logic from FromUrlLoader
Library/Homebrew/formulary.rb
@@ -143,23 +143,10 @@ def initialize url super formula, HOMEBREW_CACHE_FORMULA/File.basename(uri.path) end - # Downloads the formula's .rb file - def fetch - begin - have_klass = Formulary.formula_class_defined? class_name - rescue NameError - raise FormulaUnavailableError.new(name) - end - - unless have_klass - HOMEBREW_CACHE_FORMULA.mkpath - FileUtils.rm path.to_s, :force => true - curl url, '-o', path.to_s - end - end - - def get_formula(spec) - fetch + def load_file + HOMEBREW_CACHE_FORMULA.mkpath + FileUtils.rm_f(path) + curl url, "-o", path super end end
false
Other
Homebrew
brew
b3d44da9e3ca226829c64421e09fbbbbd6fe09bc.json
TapDependency: add tap accessor.
Library/Homebrew/dependency.rb
@@ -132,8 +132,11 @@ def merge_repeats(all) end class TapDependency < Dependency + attr_reader :tap + def initialize(name, tags=[], env_proc=DEFAULT_ENV_PROC, option_name=name) - super(name, tags, env_proc, name.split("/").last) + @tap, _, option_name = option_name.rpartition "/" + super(name, tags, env_proc, option_name) end def installed?
false
Other
Homebrew
brew
e651e7662aec9ffdb864e883d54b9204b60181a4.json
Use formula helper in tests
Library/Homebrew/test/test_formula.rb
@@ -148,7 +148,7 @@ def test_class_naming end def test_formula_spec_integration - f = Class.new(Formula) do + f = formula do homepage 'http://example.com' url 'http://example.com/test-0.1.tbz' mirror 'http://example.org/test-0.1.tbz' @@ -161,7 +161,7 @@ def test_formula_spec_integration mirror 'http://example.org/test-0.2.tbz' sha256 TEST_SHA256 end - end.new("test", Pathname.new(__FILE__).expand_path, :stable) + end assert_equal 'http://example.com', f.homepage assert_version_equal '0.1', f.version
true
Other
Homebrew
brew
e651e7662aec9ffdb864e883d54b9204b60181a4.json
Use formula helper in tests
Library/Homebrew/test/test_formula_validation.rb
@@ -8,7 +8,7 @@ def assert_invalid(attr, &block) end def test_cant_override_brew - e = assert_raises(RuntimeError) { Class.new(Formula) { def brew; end } } + e = assert_raises(RuntimeError) { formula { def brew; end } } assert_match %r{You cannot override Formula#brew}, e.message end
true
Other
Homebrew
brew
d57fe3ededa2d438bc9134b17f4bd082fde53610.json
search: add homebrew-x11 to default taps
Library/Homebrew/cmd/search.rb
@@ -76,6 +76,7 @@ def search %w{Homebrew binary}, %w{Homebrew python}, %w{Homebrew php}, + %w{Homebrew x11}, %w{Caskroom cask}, ]
false
Other
Homebrew
brew
88208af8e488fe202fd5cb6b96a9f508ca635d5e.json
requirement: add cask and download attributes. Print out the message pointing to the Cask and/or download location too.a
Library/Homebrew/requirement.rb
@@ -9,17 +9,42 @@ class Requirement include Dependable - attr_reader :tags, :name + attr_reader :tags, :name, :cask, :download alias_method :option_name, :name def initialize(tags=[]) + @cask ||= self.class.cask + @download ||= self.class.download + tags.each do |tag| + next unless tag.is_a? Hash + @cask ||= tag[:cask] + @download ||= tag[:download] + end @tags = tags @tags << :build if self.class.build @name ||= infer_name end # The message to show when the requirement is not met. - def message; "" end + def message + s = "" + if cask + s += <<-EOS.undent + + You can install with Homebrew Cask: + brew install Caskroom/cask/#{cask} + EOS + end + + if download + s += <<-EOS.undent + + You can download from: + #{download} + EOS + end + s + end # Overriding #satisfied? is deprecated. # Pass a block or boolean to the satisfy DSL method instead. @@ -110,6 +135,7 @@ class << self attr_reader :env_proc attr_rw :fatal, :default_formula + attr_rw :cask, :download # build is deprecated, use `depends_on <requirement> => :build` instead attr_rw :build
false
Other
Homebrew
brew
7f29dc13b8ee9ca3a1f28100e9ba6335ba81cf37.json
Drop pointless subclass in test
Library/Homebrew/test/test_formula.rb
@@ -42,7 +42,7 @@ def test_installed? end def test_installed_prefix - f = Class.new(TestBall).new + f = TestBall.new assert_equal f.prefix, f.installed_prefix end
false
Other
Homebrew
brew
3c9bee268bde9675e8091068750a89bb35d4b2f2.json
Preserve signature of #initialize in tests
Library/Homebrew/test/test_formula.rb
@@ -161,11 +161,7 @@ def test_formula_spec_integration mirror 'http://example.org/test-0.2.tbz' sha256 TEST_SHA256 end - - def initialize - super "test", Pathname.new(__FILE__).expand_path, :stable - end - end.new + end.new("test", Pathname.new(__FILE__).expand_path, :stable) assert_equal 'http://example.com', f.homepage assert_version_equal '0.1', f.version
true
Other
Homebrew
brew
3c9bee268bde9675e8091068750a89bb35d4b2f2.json
Preserve signature of #initialize in tests
Library/Homebrew/test/test_formula_install.rb
@@ -54,10 +54,7 @@ def test_script_install f = Class.new(ScriptFileFormula) do url "file://#{File.expand_path(__FILE__)}" version "1" - def initialize - super "test_script_formula", Pathname.new(__FILE__).expand_path, :stable - end - end.new + end.new("test_script_formula", Pathname.new(__FILE__).expand_path, :stable) temporary_install(f) { assert_equal 1, f.bin.children.length } end
true
Other
Homebrew
brew
728a7c62598af32b7d544293ea61988ebb809ebb.json
Remove dead code
Library/Homebrew/test/test_formula.rb
@@ -162,8 +162,6 @@ def test_formula_spec_integration sha256 TEST_SHA256 end - bottle { sha1 TEST_SHA1 => bottle_tag } - def initialize super "test", Pathname.new(__FILE__).expand_path, :stable end
false
Other
Homebrew
brew
c4f7217811bc0f471ad0b4a51506b7ed377991b9.json
audit (strict): add require formula check.
Library/Homebrew/cmd/audit.rb
@@ -41,6 +41,7 @@ def initialize path @text = path.open("rb", &:read) end + def without_patch @text.split("\n__END__").first end @@ -565,6 +566,10 @@ def audit_line(line, lineno) good_quotes = bad_quotes.gsub "'", "\"" problem "use double-quotes for `#{good_quotes}` instead of `#{bad_quotes}`" end + + if line =~ /(require ["']formula["'])/ + problem "`#{$1}` is now unnecessary" + end end end
false
Other
Homebrew
brew
9bd8229ba252d9c360b51092db27d84b60db00bc.json
tap_migrations: add missed x3270 formula
Library/Homebrew/tap_migrations.rb
@@ -148,6 +148,7 @@ "viewglob" => "homebrew/x11", "wkhtmltopdf" => "homebrew/boneyard", "wmctrl" => "homebrew/x11", + "x3270" => "homebrew/x11", "xchat" => "homebrew/x11", "xclip" => "homebrew/x11", "xdotool" => "homebrew/x11",
false
Other
Homebrew
brew
b3a15ad6ef106fca4be0c53c53cc5b9961c21139.json
test-bot: use audit --strict on added formulae.
Library/Homebrew/cmd/test-bot.rb
@@ -234,6 +234,15 @@ def single_commit? start_revision, end_revision git("rev-list", "--count", "#{start_revision}..#{end_revision}").to_i == 1 end + def diff_formulae start_revision, end_revision, path, filter + git( + "diff-tree", "-r", "--name-only", "--diff-filter=#{filter}", + start_revision, end_revision, "--", path + ).lines.map do |line| + File.basename(line.chomp, ".rb") + end + end + @category = __method__ @start_branch = current_branch @@ -299,12 +308,9 @@ def single_commit? start_revision, end_revision formula_path = "Library/Formula" end - git( - "diff-tree", "-r", "--name-only", "--diff-filter=AM", - diff_start_sha1, diff_end_sha1, "--", formula_path - ).each_line do |line| - @formulae << File.basename(line.chomp, ".rb") - end + @added_formulae = diff_formulae(diff_start_sha1, diff_end_sha1, formula_path, "A") + @modified_formula = diff_formulae(diff_start_sha1, diff_end_sha1, formula_path, "M") + @formulae += @added_formulae + @modified_formula end def skip formula_name @@ -410,7 +416,9 @@ def formula formula_name ENV["HOMEBREW_DEVELOPER"] = "1" test "brew", "install", *install_args install_passed = steps.last.passed? - test "brew", "audit", formula_name + audit_args = [formula_name] + audit_args << "--strict" if @added_formulae.include? formula_name + test "brew", "audit", *audit_args if install_passed unless ARGV.include? '--no-bottle' bottle_args = ["--rb", formula_name] @@ -442,7 +450,7 @@ def formula formula_name test "brew", "fetch", "--retry", "--devel", *formula_fetch_options test "brew", "install", "--devel", "--verbose", formula_name devel_install_passed = steps.last.passed? - test "brew", "audit", "--devel", formula_name + test "brew", "audit", "--devel", *audit_args if devel_install_passed test "brew", "test", "--devel", "--verbose", formula_name if formula.test_defined? test "brew", "uninstall", "--devel", "--force", formula_name
false
Other
Homebrew
brew
fca32ee7ccb0804473989e36475f3bf838b3867e.json
audit: check options when in strict mode.
Library/Homebrew/cmd/audit.rb
@@ -168,6 +168,15 @@ def audit_conflicts end end + def audit_options + formula.options.each do |o| + next unless @strict + if o.name !~ /with(out)?-/ && o.name != "c++11" && o.name != "universal" + problem "Options should begin with with/without. Migrate '--#{o.name}' with `deprecated_option`." + end + end + end + def audit_urls homepage = formula.homepage @@ -553,6 +562,7 @@ def audit audit_urls audit_deps audit_conflicts + audit_options audit_patches audit_text text.without_patch.split("\n").each_with_index { |line, lineno| audit_line(line, lineno+1) }
false
Other
Homebrew
brew
24f183dd12064b9dfd729fda58dee0938fa078f6.json
audit: add strict mode, argument.
Library/Homebrew/cmd/audit.rb
@@ -17,8 +17,10 @@ def audit ARGV.formulae end + strict = ARGV.include? "--strict" + ff.each do |f| - fa = FormulaAuditor.new f + fa = FormulaAuditor.new(f, :strict => strict) fa.audit unless fa.problems.empty? @@ -76,8 +78,9 @@ class FormulaAuditor swig ] - def initialize(formula) + def initialize(formula, options={}) @formula = formula + @strict = !!options[:strict] @problems = [] @text = FormulaText.new(formula.path) @specs = %w{stable devel head}.map { |s| formula.send(s) }.compact
false
Other
Homebrew
brew
a1ba5a5da6ee62aab11c628b7d427091f8356b42.json
Migrate some formula with hard-X11 dependencies. We have the homebrew-x11 tap for this reason so let's migrate everything without any reverse dependencies. Ideally I'd also like to migrate everything that's :recommended and the GTK formulae through there too (or to a dedicated homebrew-gtk).
Library/Homebrew/tap_migrations.rb
@@ -5,74 +5,157 @@ "apple-gcc42" => "homebrew/dupes", "appledoc" => "homebrew/boneyard", "appswitch" => "homebrew/binary", + "atari++" => "homebrew/x11", "authexec" => "homebrew/boneyard", "aws-iam-tools" => "homebrew/boneyard", "blackbox" => "homebrew/boneyard", + "bochs" => "homebrew/x11", "boost149" => "homebrew/versions", "cantera" => "homebrew/science", + "cardpeek" => "homebrew/x11", "catdoc" => "homebrew/boneyard", "clam" => "homebrew/boneyard", "cloudfoundry-cli" => "pivotal/tap", + "clusterit" => "homebrew/x11", "cmucl" => "homebrew/binary", "comparepdf" => "homebrew/boneyard", "connect" => "homebrew/boneyard", + "curlftpfs" => "homebrew/x11", + "cwm" => "homebrew/x11", "dart" => "dart-lang/dart", + "ddd" => "homebrew/x11", "denyhosts" => "homebrew/boneyard", + "dmenu" => "homebrew/x11", "dotwrp" => "homebrew/science", "drizzle" => "homebrew/boneyard", "drush" => "homebrew/php", "dsniff" => "homebrew/boneyard", + "dwm" => "homebrew/x11", + "dzen2" => "homebrew/x11", + "easy-tag" => "homebrew/x11", "electric-fence" => "homebrew/boneyard", "fceux" => "homebrew/games", + "feh" => "homebrew/x11", + "fox" => "homebrew/x11", + "freeglut" => "homebrew/x11", + "freerdp" => "homebrew/x11", + "fsv" => "homebrew/x11", + "geany" => "homebrew/x11", + "geda-gaf" => "homebrew/x11", + "geeqie" => "homebrew/x11", + "geomview" => "homebrew/x11", + "gerbv" => "homebrew/x11", + "ggobi" => "homebrew/x11", + "giblib" => "homebrew/x11", + "gkrellm" => "homebrew/x11", + "glade" => "homebrew/x11", + "gle" => "homebrew/x11", + "gnumeric" => "homebrew/x11", "gnunet" => "homebrew/boneyard", + "gobby" => "homebrew/x11", + "gpredict" => "homebrew/x11", + "grace" => "homebrew/x11", "grads" => "homebrew/binary", "gromacs" => "homebrew/science", + "gsmartcontrol" => "homebrew/x11", + "gtk-chtheme" => "homebrew/x11", + "gtksourceviewmm" => "homebrew/x11", + "gtksourceviewmm3" => "homebrew/x11", + "gtkwave" => "homebrew/x11", + "gupnp-tools" => "homebrew/x11", + "hatari" => "homebrew/x11", "helios" => "spotify/public", + "hexchat" => "homebrew/x11", "hllib" => "homebrew/boneyard", "hugs98" => "homebrew/boneyard", "hwloc" => "homebrew/science", + "imake" => "homebrew/x11", + "inkscape" => "homebrew/x11", "ipopt" => "homebrew/science", + "iptux" => "homebrew/x11", "itsol" => "homebrew/science", "iulib" => "homebrew/boneyard", "jscoverage" => "homebrew/boneyard", "jsl" => "homebrew/binary", "jstalk" => "homebrew/boneyard", "justniffer" => "homebrew/boneyard", "kerl" => "homebrew/headonly", + "kernagic" => "homebrew/x11", "kismet" => "homebrew/boneyard", + "klavaro" => "homebrew/x11", "libdlna" => "homebrew/boneyard", "libgtextutils" => "homebrew/science", "librets" => "homebrew/boneyard", "libspotify" => "homebrew/binary", "lmutil" => "homebrew/binary", + "meld" => "homebrew/x11", + "mesalib-glw" => "homebrew/x11", "mess" => "homebrew/games", "metalua" => "homebrew/boneyard", + "mit-scheme" => "homebrew/x11", "mlkit" => "homebrew/boneyard", "mlton" => "homebrew/boneyard", + "morse" => "homebrew/x11", "mpio" => "homebrew/boneyard", + "mscgen" => "homebrew/x11", "msgpack-rpc" => "homebrew/boneyard", + "mupdf" => "homebrew/x11", "mydumper" => "homebrew/boneyard", "nlopt" => "homebrew/science", "octave" => "homebrew/science", "opencv" => "homebrew/science", "openfst" => "homebrew/science", "opengrm-ngram" => "homebrew/science", "pan" => "homebrew/boneyard", + "pari" => "homebrew/x11", + "pcb" => "homebrew/x11", + "pdf2image" => "homebrew/x11", + "pdf2svg" => "homebrew/x11", + "pgplot" => "homebrew/x11", + "pixie" => "homebrew/x11", "pjsip" => "homebrew/boneyard", "pocl" => "homebrew/science", + "prooftree" => "homebrew/x11", + "py3cairo" => "homebrew/x11", + "pyxplot" => "homebrew/x11", "qfits" => "homebrew/boneyard", "qrupdate" => "homebrew/science", + "rdesktop" => "homebrew/x11", + "rxvt-unicode" => "homebrew/x11", "salt" => "homebrew/science", + "scantailor" => "homebrew/x11", "shark" => "homebrew/boneyard", "slicot" => "homebrew/science", + "smartsim" => "homebrew/x11", "solfege" => "homebrew/boneyard", + "sptk" => "homebrew/x11", "sundials" => "homebrew/science", + "swi-prolog" => "homebrew/x11", + "sxiv" => "homebrew/x11", + "sylpheed" => "homebrew/x11", "syslog-ng" => "homebrew/boneyard", + "tabbed" => "homebrew/x11", + "terminator" => "homebrew/x11", "tetgen" => "homebrew/science", "texmacs" => "homebrew/boneyard", + "tiger-vnc" => "homebrew/x11", "tmap" => "homebrew/boneyard", + "transmission-remote-gtk" => "homebrew/x11", "ume" => "homebrew/games", + "upnp-router-control" => "homebrew/x11", "urweb" => "homebrew/boneyard", "ushare" => "homebrew/boneyard", + "viewglob" => "homebrew/x11", "wkhtmltopdf" => "homebrew/boneyard", + "wmctrl" => "homebrew/x11", + "xchat" => "homebrew/x11", + "xclip" => "homebrew/x11", + "xdotool" => "homebrew/x11", + "xdu" => "homebrew/x11", + "xournal" => "homebrew/x11", + "xpa" => "homebrew/x11", + "xpdf" => "homebrew/x11", + "xplot" => "homebrew/x11", + "xspringies" => "homebrew/x11", + "yarp" => "homebrew/x11", }
false
Other
Homebrew
brew
f22aeb14f613d4e9257e0e7e451d5004e59e4d06.json
tap-readme: tweak the format.
Library/Homebrew/cmd/tap-readme.rb
@@ -1,30 +1,27 @@ module Homebrew def tap_readme name = ARGV.first - raise "A name is required" if name.nil? + titleized_name = name.dup + titleized_name[0] = titleized_name[0].upcase + template = <<-EOS.undent - Homebrew-#{name} - =========#{'=' * name.size} + # Homebrew #{titleized_name} - How do I install these formulae? - -------------------------------- - Just `brew tap homebrew/#{name}` and then `brew install <formula>`. + ## How do I install these formulae? + `brew install homebrew/#{name}/<formula>` - If the formula conflicts with one from Homebrew/homebrew or another tap, you can `brew install homebrew/#{name}/<formula>`. + Or `brew tap homebrew/#{name}` and then `brew install <formula>`. - You can also install via URL: + Or install via URL (which will not receive updates): ``` brew install https://raw.githubusercontent.com/Homebrew/homebrew-#{name}/master/<formula>.rb ``` - Docs - ---- - `brew help`, `man brew`, or the Homebrew [docs][]. - - [docs]:https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/README.md#readme + ## Documentation + `brew help`, `man brew` or check [Homebrew's documentation](https://github.com/Homebrew/homebrew/tree/master/share/doc/homebrew#readme). EOS puts template if ARGV.verbose?
false
Other
Homebrew
brew
0b8cf49386a6cd6c5cefe26ff150422d12edcff1.json
Remove unnecessary code from debugger
Library/Homebrew/build.rb
@@ -109,10 +109,7 @@ def install end end - if ARGV.debug? - formula.extend(Debrew::Formula) - formula.resources.each { |r| r.extend(Debrew::Resource) } - end + formula.extend(Debrew::Formula) if ARGV.debug? formula.brew do formula.patch
true
Other
Homebrew
brew
0b8cf49386a6cd6c5cefe26ff150422d12edcff1.json
Remove unnecessary code from debugger
Library/Homebrew/debrew.rb
@@ -30,19 +30,6 @@ def test end end - module Resource - def unpack(target=nil) - return super if target - super do - begin - yield self - rescue Exception => e - Debrew.debug(e) - end - end - end - end - class Menu Entry = Struct.new(:name, :action)
true
Other
Homebrew
brew
d2d7516cc04ec31f105eda64f87b79db316bcb2f.json
Allow debugging patching failures Closes Homebrew/homebrew#33056.
Library/Homebrew/debrew.rb
@@ -21,6 +21,10 @@ def install Debrew.debrew { super } end + def patch + Debrew.debrew { super } + end + def test Debrew.debrew { super } end
true
Other
Homebrew
brew
d2d7516cc04ec31f105eda64f87b79db316bcb2f.json
Allow debugging patching failures Closes Homebrew/homebrew#33056.
Library/Homebrew/patch.rb
@@ -128,7 +128,7 @@ def apply resource.unpack do # Assumption: the only file in the staging directory is the patch patchfile = Pathname.pwd.children.first - safe_system "/usr/bin/patch", "-g", "0", "-f", "-d", dir, "-#{strip}", "-i", patchfile + dir.cd { safe_system "/usr/bin/patch", "-g", "0", "-f", "-#{strip}", "-i", patchfile } end end
true
Other
Homebrew
brew
051658db6552882a4306b9a4240137b9def8db17.json
Remove unnecessary require from test
Library/Homebrew/test/test_formula.rb
@@ -189,7 +189,6 @@ def test_factory path.dirname.mkpath File.open(path, 'w') do |f| f << %{ - require 'formula' class #{Formulary.class_s(name)} < Formula url 'foo-1.0' end
false
Other
Homebrew
brew
8575034f192d0c85bb97c2ad70533c9ed93a60c5.json
Unroll validation loop
Library/Homebrew/formula.rb
@@ -93,7 +93,7 @@ def initialize(name, path, spec) set_spec :head @active_spec = determine_active_spec(spec) - validate_attributes :url, :name, :version + validate_attributes! @pkg_version = PkgVersion.new(version, revision) @build = active_spec.build @pin = FormulaPin.new(self) @@ -114,11 +114,18 @@ def determine_active_spec(requested) spec or raise FormulaSpecificationError, "formulae require at least a URL" end - def validate_attributes(*attrs) - attrs.each do |attr| - if (value = send(attr).to_s).empty? || value =~ /\s/ - raise FormulaValidationError.new(attr, value) - end + def validate_attributes! + if name.nil? || name.empty? || name =~ /\s/ + raise FormulaValidationError.new(:name, name) + end + + if url.nil? || url.empty? || url =~ /\s/ + raise FormulaValidationError.new(:url, url) + end + + val = version.respond_to?(:to_str) ? version.to_str : version + if val.nil? || val.empty? || val =~ /\s/ + raise FormulaValidationError.new(:version, val) end end
true
Other
Homebrew
brew
8575034f192d0c85bb97c2ad70533c9ed93a60c5.json
Unroll validation loop
Library/Homebrew/test/test_formula_validation.rb
@@ -44,6 +44,13 @@ def test_validates_version version "" end end + + assert_invalid :version do + formula do + url "foo" + version nil + end + end end def test_devel_only_valid
true
Other
Homebrew
brew
c50fdbd139439576318460d12c98ba007f28becd.json
Implement GithubGistFormula in a more natural way
Library/Homebrew/formula_specialties.rb
@@ -9,10 +9,9 @@ def install # See browser for an example class GithubGistFormula < ScriptFileFormula - def initialize(*) - url = self.class.stable.url - self.class.stable.version(File.basename(File.dirname(url))[0,6]) + def self.url(val) super + version File.basename(File.dirname(val))[0, 6] end end
false
Other
Homebrew
brew
7afe1ed67aa2509791705cf6d54ecfe771c61862.json
requirements: recommend casks where available. Also, tweak the XQuartz requirement to not show 0.0.0 versions being required. Closes Homebrew/homebrew#35254. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Library/Homebrew/requirements.rb
@@ -73,7 +73,10 @@ def message; <<-EOS.undent A LaTeX distribution is required for Homebrew to install this formula. - You can install MacTeX distribution from: + You can install MacTeX distribution with: + brew cask install mactex + + Or from: http://www.tug.org/mactex/ Make sure that "/usr/texbin", or the location you installed it to, is in @@ -136,10 +139,11 @@ def message <<-EOS.undent Java#{version_string} is required to install this formula. - You can install Java from: - http://www.oracle.com/technetwork/java/javase/downloads/index.html + You can install the Java Development Kit (JDK) with: + brew cask install java - Make sure you install both the JRE and JDK. + Or from: + http://www.oracle.com/technetwork/java/javase/downloads/index.html EOS end end
true
Other
Homebrew
brew
7afe1ed67aa2509791705cf6d54ecfe771c61862.json
requirements: recommend casks where available. Also, tweak the XQuartz requirement to not show 0.0.0 versions being required. Closes Homebrew/homebrew#35254. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Library/Homebrew/requirements/x11_dependency.rb
@@ -12,8 +12,10 @@ def initialize(name="x11", tags=[]) @name = name if /(\d\.)+\d/ === tags.first @min_version = Version.new(tags.shift) + @min_version_string = " #{@min_version}" else @min_version = Version.new("0.0.0") + @min_version_string = "" end super(tags) end @@ -23,8 +25,10 @@ def initialize(name="x11", tags=[]) end def message; <<-EOS.undent - Unsatisfied dependency: XQuartz #{@min_version} - Homebrew does not package XQuartz. Installers may be found at: + You can install XQuartz#{@min_version_string} with: + brew cask install xquartz + + Or from: https://xquartz.macosforge.org EOS end
true
Other
Homebrew
brew
f9917768a9cfd136c80e807bb4e5e6b32bd35097.json
test-bot: fix use of select!.
Library/Homebrew/cmd/test-bot.rb
@@ -354,8 +354,8 @@ def formula formula_name changed_dependences = dependencies - unchanged_dependencies dependents = `brew uses #{formula_name}`.split("\n") - testable_dependents = dependents.map {|d| Formulary.factory(d)} - testable_dependents.select! {|d| d.test_defined? && d.stable.bottled? } + dependents = dependents.map {|d| Formulary.factory(d)} + testable_dependents = dependents.select {|d| d.test_defined? && d.stable.bottled? } uninstalled_testable_dependents = testable_dependents.reject {|d| d.installed? } testable_dependents.map! &:name uninstalled_testable_dependents.map! &:name
false
Other
Homebrew
brew
73ff7395839dee412f70c010f739210a8fd2a63a.json
Convert dependencies to formulas for name matching Dependency names are prefixed with the tap location, therefore dependency names do not match formula names. We convert dependencies into formulas to ensure proper name checking. Closes Homebrew/homebrew#35058. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Library/Homebrew/cmd/uses.rb
@@ -15,10 +15,10 @@ def uses uses = formulae.select do |f| used_formulae.all? do |ff| if recursive - f.recursive_dependencies.any? { |dep| dep.name == ff.name } || + f.recursive_dependencies.any? { |dep| dep.to_formula.name == ff.name } || f.recursive_requirements.any? { |req| req.name == ff.name } else - f.deps.any? { |dep| dep.name == ff.name } || + f.deps.any? { |dep| dep.to_formula.name == ff.name } || f.requirements.any? { |req| req.name == ff.name } end end
false
Other
Homebrew
brew
62addcfce8d942eaa96f48f80b8b82ad7d934853.json
uninstall: improve grammar for multiple version message
Library/Homebrew/cmd/uninstall.rb
@@ -15,8 +15,9 @@ def uninstall rack = keg/".." if rack.directory? - versions = rack.subdirs.map(&:basename).join(", ") - puts "#{keg.name} #{versions} are still installed." + versions = rack.subdirs.map(&:basename) + verb = versions.length == 1 ? "is" : "are" + puts "#{keg.name} #{versions.join(", ")} #{verb} still installed." puts "Remove them all with `brew uninstall --force #{keg.name}`." end end
false
Other
Homebrew
brew
d97daa7c1b2203be02c69124bc7b3ae5f2b50f99.json
Fix references to url
Library/Homebrew/download_strategy.rb
@@ -713,7 +713,7 @@ def repo_valid? end def clone_repo - safe_system hgpath, "clone", url, cached_location + safe_system hgpath, "clone", @url, cached_location end def update @@ -746,7 +746,7 @@ def repo_valid? def clone_repo # "lightweight" means history-less - safe_system bzrpath, "checkout", "--lightweight", url, cached_location + safe_system bzrpath, "checkout", "--lightweight", @url, cached_location end def update @@ -774,7 +774,7 @@ def cache_tag end def clone_repo - safe_system fossilpath, "clone", url, cached_location + safe_system fossilpath, "clone", @url, cached_location end def update
false
Other
Homebrew
brew
867a87b50afda7fa6d8c81a37eb8ff1f898e5cf6.json
Move url munging to initialize
Library/Homebrew/download_strategy.rb
@@ -639,6 +639,11 @@ def checkout_submodules(dst) end class CVSDownloadStrategy < VCSDownloadStrategy + def initialize(name, resource) + super + @url = @url.sub(%r[^cvs://], "") + end + def stage cp_r Dir[cached_location+"{.}"], Dir.pwd end @@ -671,14 +676,19 @@ def update end def split_url(in_url) - parts=in_url.sub(%r[^cvs://], '').split(/:/) + parts = in_url.split(/:/) mod=parts.pop url=parts.join(':') [ mod, url ] end end class MercurialDownloadStrategy < VCSDownloadStrategy + def initialize(name, resource) + super + @url = @url.sub(%r[^hg://], "") + end + def stage super @@ -703,7 +713,6 @@ def repo_valid? end def clone_repo - url = @url.sub(%r[^hg://], "") safe_system hgpath, "clone", url, cached_location end @@ -713,6 +722,11 @@ def update end class BazaarDownloadStrategy < VCSDownloadStrategy + def initialize(name, resource) + super + @url = @url.sub(%r[^bzr://], "") + end + def stage # The export command doesn't work on checkouts # See https://bugs.launchpad.net/bzr/+bug/897511 @@ -731,7 +745,6 @@ def repo_valid? end def clone_repo - url = @url.sub(%r[^bzr://], "") # "lightweight" means history-less safe_system bzrpath, "checkout", "--lightweight", url, cached_location end @@ -742,6 +755,11 @@ def update end class FossilDownloadStrategy < VCSDownloadStrategy + def initialize(name, resource) + super + @url = @url.sub(%r[^fossil://], "") + end + def stage super args = [fossilpath, "open", cached_location] @@ -756,7 +774,6 @@ def cache_tag end def clone_repo - url = @url.sub(%r[^fossil://], "") safe_system fossilpath, "clone", url, cached_location end
false
Other
Homebrew
brew
8c0928ccca77fbc6d32178d21370ce764c2eee5d.json
Use quiet_system to avoid the shell
Library/Homebrew/cmd/cleanup.rb
@@ -112,7 +112,7 @@ def cleanup_lockfiles end def rm_DS_Store - system "find #{HOMEBREW_PREFIX} -name .DS_Store -delete 2>/dev/null" + quiet_system "find", HOMEBREW_PREFIX.to_s, "-name", ".DS_Store", "-delete" end end
false
Other
Homebrew
brew
a70a80511146ec35d9da82f678a0d36efe5c72d4.json
Capitalize descriptions of --HEAD, --devel Closes Homebrew/homebrew#35027. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Library/Homebrew/cmd/options.rb
@@ -29,7 +29,7 @@ def dump_options_for_formula f f.options.sort_by(&:flag).each do |opt| puts "#{opt.flag}\n\t#{opt.description}" end - puts "--devel\n\tinstall development version #{f.devel.version}" if f.devel - puts "--HEAD\n\tinstall HEAD version" if f.head + puts "--devel\n\tInstall development version #{f.devel.version}" if f.devel + puts "--HEAD\n\tInstall HEAD version" if f.head end end
false
Other
Homebrew
brew
dc1f58dead922ceb5efae8c5cff6a1f67219f436.json
unsigned_kext: use binary and cask options now.
Library/Homebrew/requirements/unsigned_kext_requirement.rb
@@ -5,12 +5,35 @@ class UnsignedKextRequirement < Requirement satisfy { MacOS.version < :yosemite } + def initialize(tags=[]) + tags.each do |tag| + next unless tag.is_a? Hash + @binary ||= tag[:binary] + @cask ||= tag[:cask] + end + super + end + def message - <<-EOS.undent - OS X Mavericks or older is required for this package. - OS X Yosemite introduced a strict unsigned kext ban which breaks this package. - You should remove this package from your system and attempt to find upstream - binaries to use instead. + s = <<-EOS.undent + Building this formula from source isn't possible due to OS X + Yosemite and above's strict unsigned kext ban. EOS + + if @cask + s += <<-EOS.undent + + You can install from Homebrew Cask: + brew install Caskroom/cask/#{@cask} + EOS + end + + if @binary + s += <<-EOS.undent + + You can use the upstream binary: + #{@binary} + EOS + end end end
false
Other
Homebrew
brew
007926d7a6aaec1a5ab8614a1f8d4ad70497908c.json
Correct external command docs
share/doc/homebrew/External-Commands.md
@@ -10,9 +10,7 @@ without modifying Homebrew's internals. ## COMMAND TYPES External commands come in two flavors: Ruby commands and shell scripts. -In both cases, the command file should be `chmod +x` (executable) and live somewhere in `$PATH`. - -Internally, Homebrew finds commands with `which`(1). +In both cases, the command file should be executable (`chmod +x`) and live somewhere in `$PATH`. ### RUBY COMMANDS An external command `extcmd` implemented as a Ruby command should be named `brew-extcmd.rb`. The command is executed by doing a `require` on the full pathname. As the command is `require`d, it has full access to the Homebrew "environment", i.e. all global variables and modules that any internal command has access to. @@ -115,5 +113,3 @@ These commands have been contributed by Homebrew users but are not included in t ## SEE ALSO Homebrew Docs: <https://github.com/Homebrew/homebrew/tree/master/share/doc/homebrew> - -`brew`(1), `which`(1), `grep`(1), [`ronn`(1)](http://rtomayko.github.com/ronn/)
false
Other
Homebrew
brew
56e82c941efa6827a6095630bebbdcc5ad631ff7.json
mach: improve otool failure handling.
Library/Homebrew/mach.rb
@@ -155,7 +155,10 @@ def initialize(path) def parse_otool_L_output ENV["HOMEBREW_MACH_O_FILE"] = path.expand_path.to_s libs = `#{MacOS.locate("otool")} -L "$HOMEBREW_MACH_O_FILE"`.split("\n") - return nil, [] if libs.empty? + unless $?.success? + raise ErrorDuringExecution.new(MacOS.locate("otool"), + ["-L", ENV["HOMEBREW_MACH_O_FILE"]]) + end libs.shift # first line is the filename
false
Other
Homebrew
brew
02e5f8ed6b9618023e8adb372f8431e63e9666ba.json
mach: handle empty otool output.
Library/Homebrew/mach.rb
@@ -155,6 +155,7 @@ def initialize(path) def parse_otool_L_output ENV["HOMEBREW_MACH_O_FILE"] = path.expand_path.to_s libs = `#{MacOS.locate("otool")} -L "$HOMEBREW_MACH_O_FILE"`.split("\n") + return nil, [] if libs.empty? libs.shift # first line is the filename
false
Other
Homebrew
brew
65a7a631ea32306cdc39a28fc30076395c183f25.json
Language::Python.setup_install: add deprecation warning
Library/Homebrew/language/python.rb
@@ -54,6 +54,13 @@ def self.in_sys_path? python, path # deprecated; use system "python", *setup_install_args(prefix) instead def self.setup_install python, prefix, *args + opoo <<-EOS.undent + Language::Python.setup_install is deprecated. + If you are a formula author, please use + system "python", *Language::Python.setup_install_args(prefix) + instead. + EOS + # force-import setuptools, which monkey-patches distutils, to make # sure that we always call a setuptools setup.py. trick borrowed from pip: # https://github.com/pypa/pip/blob/043af83/pip/req/req_install.py#L743-L780
false
Other
Homebrew
brew
fe16f36f3c19a29c5edfec4483d14b09cefdc175.json
Formula#exec_cmd: recognize setuptools shim and refurbish args
Library/Homebrew/formula.rb
@@ -661,8 +661,12 @@ def exec_cmd(cmd, args, out, logfn) # Turn on argument filtering in the superenv compiler wrapper. # We should probably have a better mechanism for this than adding # special cases to this method. - if cmd == "python" && %w[setup.py build.py].include?(args.first) - ENV.refurbish_args + if cmd == "python" + setup_py_in_args = %w[setup.py build.py].include?(args.first) + setuptools_shim_in_args = args.any? { |a| a.start_with? "import setuptools" } + if setup_py_in_args || setuptools_shim_in_args + ENV.refurbish_args + end end $stdout.reopen(out)
false
Other
Homebrew
brew
720f13d8d588156dc85229af3c3820c5bf0f1362.json
Cookbook: Fix the link for squashing-instructions Closes Homebrew/homebrew#34859. Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
share/doc/homebrew/Formula-Cookbook.md
@@ -366,7 +366,7 @@ Now, please open a Pull Request (on your github repo page) for new and updated b * One formula per commit; one commit per formula * Keep merge commits out of the request -* If you have any merge or mixup commits, please [squash](http://www.gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html) them. +* If you have any merge or mixup commits, please [squash](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html) them. If a commit touches multiple files, or isn’t one logical bug fix, or a file is touched in multiple commits, we’ll probably ask you to `rebase` and `squash` your commits. For this reason, you should avoid pushing to your `master` branch. Note, after rebase and/or squash, you'll need to push with `--force` to your remote.
false
Other
Homebrew
brew
0909b12eb907c550a24a7641e29dcb2a8d58fd77.json
Prefer cached_location over tarball_path
Library/Homebrew/download_strategy.rb
@@ -156,12 +156,12 @@ def initialize(name, resource) super @mirrors = resource.mirrors.dup @tarball_path = HOMEBREW_CACHE.join("#{name}-#{resource.version}#{ext}") - @temporary_path = Pathname.new("#{tarball_path}.incomplete") + @temporary_path = Pathname.new("#{cached_location}.incomplete") end def fetch ohai "Downloading #{@url}" - unless tarball_path.exist? + unless cached_location.exist? had_incomplete_download = temporary_path.exist? begin _fetch @@ -182,9 +182,9 @@ def fetch raise CurlDownloadStrategyError, msg end end - ignore_interrupts { temporary_path.rename(tarball_path) } + ignore_interrupts { temporary_path.rename(cached_location) } else - puts "Already downloaded: #{tarball_path}" + puts "Already downloaded: #{cached_location}" end rescue CurlDownloadStrategyError raise if mirrors.empty? @@ -194,32 +194,32 @@ def fetch end def stage - case tarball_path.compression_type + case cached_location.compression_type when :zip - with_system_path { quiet_safe_system 'unzip', {:quiet_flag => '-qq'}, tarball_path } + with_system_path { quiet_safe_system 'unzip', {:quiet_flag => '-qq'}, cached_location } chdir when :gzip_only with_system_path { buffered_write("gunzip") } when :bzip2_only with_system_path { buffered_write("bunzip2") } when :gzip, :bzip2, :compress, :tar # Assume these are also tarred - with_system_path { safe_system 'tar', 'xf', tarball_path } + with_system_path { safe_system 'tar', 'xf', cached_location } chdir when :xz - with_system_path { safe_system "#{xzpath} -dc \"#{tarball_path}\" | tar xf -" } + with_system_path { safe_system "#{xzpath} -dc \"#{cached_location}\" | tar xf -" } chdir when :lzip - with_system_path { safe_system "#{lzippath} -dc \"#{tarball_path}\" | tar xf -" } + with_system_path { safe_system "#{lzippath} -dc \"#{cached_location}\" | tar xf -" } chdir when :xar - safe_system "/usr/bin/xar", "-xf", tarball_path + safe_system "/usr/bin/xar", "-xf", cached_location when :rar - quiet_safe_system 'unrar', 'x', {:quiet_flag => '-inul'}, tarball_path + quiet_safe_system 'unrar', 'x', {:quiet_flag => '-inul'}, cached_location when :p7zip - safe_system '7zr', 'x', tarball_path + safe_system '7zr', 'x', cached_location else - cp tarball_path, basename_without_params + cp cached_location, basename_without_params end end @@ -260,9 +260,9 @@ def chdir # file regardless of the current working directory, so we need to write it to # the correct location ourselves. def buffered_write(tool) - target = File.basename(basename_without_params, tarball_path.extname) + target = File.basename(basename_without_params, cached_location.extname) - Utils.popen_read(tool, "-f", tarball_path.to_s, "-c") do |pipe| + Utils.popen_read(tool, "-f", cached_location.to_s, "-c") do |pipe| File.open(target, "wb") do |f| buf = "" f.write(buf) while pipe.read(1024, buf) @@ -340,7 +340,7 @@ def _fetch # Useful for installing jars. class NoUnzipCurlDownloadStrategy < CurlDownloadStrategy def stage - cp tarball_path, basename_without_params + cp cached_location, basename_without_params end end @@ -362,7 +362,7 @@ def curl(*args) end def stage - ohai "Pouring #{tarball_path.basename}" + ohai "Pouring #{cached_location.basename}" super end end @@ -375,7 +375,7 @@ def initialize formula end def stage - ohai "Pouring #{tarball_path.basename}" + ohai "Pouring #{cached_location.basename}" super end end
false
Other
Homebrew
brew
3e1cc70fb4301a94dbf4c12b4b5a7660efac5f41.json
Move tool path methods to AbstractDownloadStrategy
Library/Homebrew/download_strategy.rb
@@ -37,6 +37,49 @@ def fetch; end def stage; end def cached_location; end def clear_cache; end + + private + + def xzpath + "#{HOMEBREW_PREFIX}/opt/xz/bin/xz" + end + + def lzippath + "#{HOMEBREW_PREFIX}/opt/lzip/bin/lzip" + end + + def cvspath + @cvspath ||= %W[ + /usr/bin/cvs + #{HOMEBREW_PREFIX}/bin/cvs + #{HOMEBREW_PREFIX}/opt/cvs/bin/cvs + #{which("cvs")} + ].find { |p| File.executable? p } + end + + def hgpath + @hgpath ||= %W[ + #{which("hg")} + #{HOMEBREW_PREFIX}/bin/hg + #{HOMEBREW_PREFIX}/opt/mercurial/bin/hg + ].find { |p| File.executable? p } + end + + def bzrpath + @bzrpath ||= %W[ + #{which("bzr")} + #{HOMEBREW_PREFIX}/bin/bzr + #{HOMEBREW_PREFIX}/opt/bazaar/bin/bzr + ].find { |p| File.executable? p } + end + + def fossilpath + @fossilpath ||= %W[ + #{which("fossil")} + #{HOMEBREW_PREFIX}/bin/fossil + #{HOMEBREW_PREFIX}/opt/fossil/bin/fossil + ].find { |p| File.executable? p } + end end class VCSDownloadStrategy < AbstractDownloadStrategy @@ -217,14 +260,6 @@ def curl(*args) super end - def xzpath - "#{HOMEBREW_PREFIX}/opt/xz/bin/xz" - end - - def lzippath - "#{HOMEBREW_PREFIX}/opt/lzip/bin/lzip" - end - def chdir entries = Dir['*'] case entries.length @@ -637,15 +672,6 @@ def split_url(in_url) url=parts.join(':') [ mod, url ] end - - def cvspath - @path ||= %W[ - /usr/bin/cvs - #{HOMEBREW_PREFIX}/bin/cvs - #{HOMEBREW_PREFIX}/opt/cvs/bin/cvs - #{which("cvs")} - ].find { |p| File.executable? p } - end end class MercurialDownloadStrategy < VCSDownloadStrategy @@ -680,14 +706,6 @@ def clone_repo def update cached_location.cd { quiet_safe_system hgpath, "pull", "--update" } end - - def hgpath - @path ||= %W[ - #{which("hg")} - #{HOMEBREW_PREFIX}/bin/hg - #{HOMEBREW_PREFIX}/opt/mercurial/bin/hg - ].find { |p| File.executable? p } - end end class BazaarDownloadStrategy < VCSDownloadStrategy @@ -717,13 +735,6 @@ def clone_repo def update cached_location.cd { quiet_safe_system bzrpath, "update" } end - - def bzrpath - @path ||= %W[ - #{which("bzr")} - #{HOMEBREW_PREFIX}/bin/bzr - ].find { |p| File.executable? p } - end end class FossilDownloadStrategy < VCSDownloadStrategy @@ -749,12 +760,6 @@ def update safe_system fossilpath, "pull", "-R", cached_location end - def fossilpath - @path ||= %W[ - #{which("fossil")} - #{HOMEBREW_PREFIX}/bin/fossil - ].find { |p| File.executable? p } - end end class DownloadStrategyDetector
false
Other
Homebrew
brew
bec5e0671f5560544680db6585f147a3d83ac91a.json
Use quiet_safe_system to silence CVS checkouts
Library/Homebrew/download_strategy.rb
@@ -622,8 +622,8 @@ def clone_repo mod, url = split_url(@url) HOMEBREW_CACHE.cd do - safe_system cvspath, "-d", url, "login" - safe_system cvspath, "-d", url, "checkout", "-d", cache_filename, mod + quiet_safe_system cvspath, { :quiet_flag => "-Q" }, "-d", url, "login" + quiet_safe_system cvspath, { :quiet_flag => "-Q" }, "-d", url, "checkout", "-d", cache_filename, mod end end
false
Other
Homebrew
brew
ddf6f51776c59edf07c5b06f8b8892d4660870be.json
Prefer cached_location method over @clone ivar
Library/Homebrew/download_strategy.rb
@@ -384,19 +384,19 @@ def initialize(name, resource) end def fetch - clear_cache unless @url.chomp("/") == repo_url or quiet_system "svn", "switch", @url, @clone + clear_cache unless @url.chomp("/") == repo_url or quiet_system "svn", "switch", @url, cached_location super end def stage super - quiet_safe_system "svn", "export", "--force", @clone, Dir.pwd + quiet_safe_system "svn", "export", "--force", cached_location, Dir.pwd end private def repo_url - `svn info '#{@clone}' 2>/dev/null`.strip[/^URL: (.+)$/, 1] + `svn info '#{cached_location}' 2>/dev/null`.strip[/^URL: (.+)$/, 1] end def shell_quote str @@ -436,23 +436,23 @@ def cache_tag end def repo_valid? - @clone.join(".svn").directory? + cached_location.join(".svn").directory? end def clone_repo case @ref_type when :revision - fetch_repo @clone, @url, @ref + fetch_repo cached_location, @url, @ref when :revisions # nil is OK for main_revision, as fetch_repo will then get latest main_revision = @ref[:trunk] - fetch_repo @clone, @url, main_revision, true + fetch_repo cached_location, @url, main_revision, true get_externals do |external_name, external_url| - fetch_repo @clone+external_name, external_url, @ref[external_name], true + fetch_repo cached_location+external_name, external_url, @ref[external_name], true end else - fetch_repo @clone, @url + fetch_repo cached_location, @url end end alias_method :update, :clone_repo @@ -487,7 +487,7 @@ def stage super dst = Dir.getwd - @clone.cd do + cached_location.cd do # http://stackoverflow.com/questions/160608/how-to-do-a-git-export-like-svn-export safe_system 'git', 'checkout-index', '-a', '-f', "--prefix=#{dst}/" checkout_submodules(dst) if submodules? @@ -501,7 +501,7 @@ def cache_tag end def update - @clone.cd do + cached_location.cd do config_repo update_repo checkout @@ -519,7 +519,7 @@ def support_depth? end def git_dir - @clone.join(".git") + cached_location.join(".git") end def has_ref? @@ -531,7 +531,7 @@ def repo_valid? end def submodules? - @clone.join(".gitmodules").exist? + cached_location.join(".gitmodules").exist? end def clone_args @@ -542,7 +542,7 @@ def clone_args when :branch, :tag then args << '--branch' << @ref end - args << @url << @clone + args << @url << cached_location end def refspec @@ -566,7 +566,7 @@ def update_repo def clone_repo safe_system 'git', *clone_args - @clone.cd { update_submodules } if submodules? + cached_location.cd { update_submodules } if submodules? end def checkout @@ -591,15 +591,15 @@ def update_submodules end def checkout_submodules(dst) - escaped_clone_path = @clone.to_s.gsub(/\//, '\/') + escaped_clone_path = cached_location.to_s.gsub(/\//, '\/') sub_cmd = "git checkout-index -a -f --prefix=#{dst}/${toplevel/#{escaped_clone_path}/}/$path/" quiet_safe_system "git", "submodule", "foreach", "--recursive", sub_cmd end end class CVSDownloadStrategy < VCSDownloadStrategy def stage - FileUtils.cp_r Dir[@clone+"{.}"], Dir.pwd + FileUtils.cp_r Dir[cached_location+"{.}"], Dir.pwd end private @@ -609,7 +609,7 @@ def cache_tag end def repo_valid? - @clone.join("CVS").directory? + cached_location.join("CVS").directory? end def clone_repo @@ -626,7 +626,7 @@ def clone_repo end def update - @clone.cd { quiet_safe_system cvspath, { :quiet_flag => "-Q" }, "up" } + cached_location.cd { quiet_safe_system cvspath, { :quiet_flag => "-Q" }, "up" } end def split_url(in_url) @@ -651,7 +651,7 @@ def stage super dst = Dir.getwd - @clone.cd do + cached_location.cd do if @ref_type and @ref safe_system hgpath, 'archive', '--subrepos', '-y', '-r', @ref, '-t', 'files', dst else @@ -667,16 +667,16 @@ def cache_tag end def repo_valid? - @clone.join(".hg").directory? + cached_location.join(".hg").directory? end def clone_repo url = @url.sub(%r[^hg://], "") - safe_system hgpath, "clone", url, @clone + safe_system hgpath, "clone", url, cached_location end def update - @clone.cd { quiet_safe_system hgpath, "pull", "--update" } + cached_location.cd { quiet_safe_system hgpath, "pull", "--update" } end def hgpath @@ -692,7 +692,7 @@ class BazaarDownloadStrategy < VCSDownloadStrategy def stage # The export command doesn't work on checkouts # See https://bugs.launchpad.net/bzr/+bug/897511 - FileUtils.cp_r Dir[@clone+"{.}"], Dir.pwd + FileUtils.cp_r Dir[cached_location+"{.}"], Dir.pwd FileUtils.rm_r ".bzr" end @@ -703,17 +703,17 @@ def cache_tag end def repo_valid? - @clone.join(".bzr").directory? + cached_location.join(".bzr").directory? end def clone_repo url = @url.sub(%r[^bzr://], "") # "lightweight" means history-less - safe_system bzrpath, "checkout", "--lightweight", url, @clone + safe_system bzrpath, "checkout", "--lightweight", url, cached_location end def update - @clone.cd { quiet_safe_system bzrpath, "update" } + cached_location.cd { quiet_safe_system bzrpath, "update" } end def bzrpath @@ -727,7 +727,7 @@ def bzrpath class FossilDownloadStrategy < VCSDownloadStrategy def stage super - args = [fossilpath, "open", @clone] + args = [fossilpath, "open", cached_location] args << @ref if @ref_type && @ref safe_system(*args) end @@ -740,11 +740,11 @@ def cache_tag def clone_repo url = @url.sub(%r[^fossil://], "") - safe_system fossilpath, "clone", url, @clone + safe_system fossilpath, "clone", url, cached_location end def update - safe_system fossilpath, "pull", "-R", @clone + safe_system fossilpath, "pull", "-R", cached_location end def fossilpath
false
Other
Homebrew
brew
585ddb5428bf79dd25a65c76346160e3367a7bcf.json
Remove type checks
Library/Homebrew/requirements.rb
@@ -16,13 +16,13 @@ class XcodeDependency < Requirement satisfy(:build_env => false) { xcode_installed_version } def initialize(tags) - @version = tags.each {|t| break tags.delete(t) if t.is_a? String } + @version = tags.find { |t| tags.delete(t) if /(\d\.)+\d/ === t } super end def xcode_installed_version return false unless MacOS::Xcode.installed? - return true unless @version.is_a? String + return true unless @version MacOS::Xcode.version >= @version end
false
Other
Homebrew
brew
e7497e33c0b02c0290721be7075b0c0473459d65.json
formula.rb: add install method. Mostly for links in API documentation.
Library/Homebrew/formula.rb
@@ -574,6 +574,9 @@ def test_fixtures(file) protected + def install + end + # Pretty titles the command and buffers stdout/stderr # Throws if there's an error def system cmd, *args
false
Other
Homebrew
brew
8560ad3ad01c7cbda18d1df81e85926f996dd449.json
Use quiet_safe_system to silence submodule updates
Library/Homebrew/download_strategy.rb
@@ -589,7 +589,7 @@ def reset end def update_submodules - safe_system 'git', 'submodule', 'update', '--init', '--recursive' + quiet_safe_system "git", "submodule", "update", "--init", "--recursive" end def checkout_submodules(dst)
false
Other
Homebrew
brew
5d811c519beee45edac5387e92f1f2bee4f72452.json
Use quiet_safe_system to silence bzr updates
Library/Homebrew/download_strategy.rb
@@ -715,7 +715,7 @@ def clone_repo end def update - @clone.cd { safe_system bzrpath, 'update' } + @clone.cd { quiet_safe_system bzrpath, "update" } end def bzrpath
false
Other
Homebrew
brew
37c08393dbd482c4cfc37a0ec346564f8532257b.json
Use quiet_safe_system to silence CVS updates
Library/Homebrew/download_strategy.rb
@@ -628,7 +628,7 @@ def clone_repo end def update - @clone.cd { safe_system cvspath, "up" } + @clone.cd { quiet_safe_system cvspath, { :quiet_flag => "-Q" }, "up" } end def split_url(in_url)
false
Other
Homebrew
brew
7e844cad1c23e0785fca22345e187c3a7c21b270.json
Simplify fossil checkouts
Library/Homebrew/download_strategy.rb
@@ -729,8 +729,9 @@ def bzrpath class FossilDownloadStrategy < VCSDownloadStrategy def stage super - safe_system fossilpath, "open", @clone - safe_system fossilpath, "checkout", @ref if @ref_type && @ref + args = [fossilpath, "open", @clone] + args << @ref if @ref_type && @ref + safe_system(*args) end private
false
Other
Homebrew
brew
df25be78b58a94506985ca812971e41da879239e.json
Demote FIXME to a normal comment
Library/Homebrew/download_strategy.rb
@@ -686,7 +686,7 @@ def hgpath class BazaarDownloadStrategy < VCSDownloadStrategy def stage - # FIXME: The export command doesn't work on checkouts + # The export command doesn't work on checkouts # See https://bugs.launchpad.net/bzr/+bug/897511 FileUtils.cp_r Dir[@clone+"{.}"], Dir.pwd FileUtils.rm_r ".bzr"
false
Other
Homebrew
brew
4026e035add50aaf5627587e5b59ea149f3b57fd.json
Use start_with? instead of a regexp
Library/Homebrew/download_strategy.rb
@@ -364,7 +364,7 @@ def _fetch class SubversionDownloadStrategy < VCSDownloadStrategy def initialize(name, resource) super - @url = @url.sub(/^svn\+/, "") if @url =~ %r[^svn\+http://] + @url = @url.sub(/^svn\+/, "") if @url.start_with?("svn+http://") end def repo_url
false
Other
Homebrew
brew
01dc112b607d2c4707c8835be9b122109088fd75.json
Move SVN URL munging to initialize
Library/Homebrew/download_strategy.rb
@@ -362,12 +362,16 @@ def _fetch end class SubversionDownloadStrategy < VCSDownloadStrategy + def initialize(name, resource) + super + @url = @url.sub(/^svn\+/, "") if @url =~ %r[^svn\+http://] + end + def repo_url `svn info '#{@clone}' 2>/dev/null`.strip[/^URL: (.+)$/, 1] end def fetch - @url = @url.sub(/^svn\+/, '') if @url =~ %r[^svn\+http://] ohai "Checking out #{@url}" clear_cache unless @url.chomp("/") == repo_url or quiet_system 'svn', 'switch', @url, @clone
false
Other
Homebrew
brew
3a20562d6ea4f109526c41373f848114d79a3b00.json
Add clone_repo to remaining VCS strategies
Library/Homebrew/download_strategy.rb
@@ -72,6 +72,9 @@ def repo_valid? true end + def clone_repo + end + def extract_ref(specs) key = REF_TYPES.find { |type| specs.key?(type) } return key, specs[key] @@ -586,20 +589,15 @@ class CVSDownloadStrategy < VCSDownloadStrategy def fetch ohai "Checking out #{@url}" - # URL of cvs cvs://:pserver:anoncvs@www.gccxml.org:/cvsroot/GCC_XML:gccxml - # will become: - # cvs -d :pserver:anoncvs@www.gccxml.org:/cvsroot/GCC_XML login - # cvs -d :pserver:anoncvs@www.gccxml.org:/cvsroot/GCC_XML co gccxml - mod, url = split_url(@url) - - unless @clone.exist? - HOMEBREW_CACHE.cd do - safe_system cvspath, '-d', url, 'login' - safe_system cvspath, '-d', url, 'checkout', '-d', cache_filename, mod - end - else + if @clone.exist? && repo_valid? puts "Updating #{@clone}" - @clone.cd { safe_system cvspath, 'up' } + @clone.cd { safe_system cvspath, "up" } + elsif @clone.exist? + puts "Removing invalid CVS repo from cache" + clear_cache + clone_repo + else + clone_repo end end @@ -617,6 +615,19 @@ def repo_valid? @clone.join("CVS").directory? end + def clone_repo + # URL of cvs cvs://:pserver:anoncvs@www.gccxml.org:/cvsroot/GCC_XML:gccxml + # will become: + # cvs -d :pserver:anoncvs@www.gccxml.org:/cvsroot/GCC_XML login + # cvs -d :pserver:anoncvs@www.gccxml.org:/cvsroot/GCC_XML co gccxml + mod, url = split_url(@url) + + HOMEBREW_CACHE.cd do + safe_system cvspath, "-d", url, "login" + safe_system cvspath, "-d", url, "checkout", "-d", cache_filename, mod + end + end + def split_url(in_url) parts=in_url.sub(%r[^cvs://], '').split(/:/) mod=parts.pop @@ -650,11 +661,6 @@ def fetch end end - def clone_repo - url = @url.sub(%r[^hg://], '') - safe_system hgpath, 'clone', url, @clone - end - def stage dst = Dir.getwd @clone.cd do @@ -677,6 +683,11 @@ def repo_valid? @clone.join(".hg").directory? end + def clone_repo + url = @url.sub(%r[^hg://], "") + safe_system hgpath, "clone", url, @clone + end + def hgpath @path ||= %W[ #{which("hg")} @@ -702,12 +713,6 @@ def fetch end end - def clone_repo - url = @url.sub(%r[^bzr://], '') - # 'lightweight' means history-less - safe_system bzrpath, 'checkout', '--lightweight', url, @clone - end - def stage # FIXME: The export command doesn't work on checkouts # See https://bugs.launchpad.net/bzr/+bug/897511 @@ -725,6 +730,12 @@ def repo_valid? @clone.join(".bzr").directory? end + def clone_repo + url = @url.sub(%r[^bzr://], "") + # "lightweight" means history-less + safe_system bzrpath, "checkout", "--lightweight", url, @clone + end + def bzrpath @path ||= %W[ #{which("bzr")} @@ -736,12 +747,16 @@ def bzrpath class FossilDownloadStrategy < VCSDownloadStrategy def fetch ohai "Cloning #{@url}" - unless @clone.exist? - url=@url.sub(%r[^fossil://], '') - safe_system fossilpath, 'clone', url, @clone - else + + if @clone.exist? && repo_valid? puts "Updating #{@clone}" - safe_system fossilpath, 'pull', '-R', @clone + safe_system fossilpath, "pull", "-R", @clone + elsif @clone.exist? + puts "Removing invalid fossil repo from cache" + clear_cache + clone_repo + else + clone_repo end end @@ -764,6 +779,11 @@ def repo_valid? true end + def clone_repo + url = @url.sub(%r[^fossil://], "") + safe_system fossilpath, "clone", url, @clone + end + def fossilpath @path ||= %W[ #{which("fossil")}
false
Other
Homebrew
brew
566d6b3a462c740913852d889f39d6f6824d8c88.json
CurlDownloadStrategy: initialize attributes in initializer The downloader is instantiated on-demand, so we no longer need the lazy initialization here.
Library/Homebrew/download_strategy.rb
@@ -73,16 +73,13 @@ def head? end class CurlDownloadStrategy < AbstractDownloadStrategy - def mirrors - @mirrors ||= resource.mirrors.dup - end - - def tarball_path - @tarball_path ||= Pathname.new("#{HOMEBREW_CACHE}/#{name}-#{resource.version}#{ext}") - end + attr_reader :mirrors, :tarball_path, :temporary_path - def temporary_path - @temporary_path ||= Pathname.new("#{tarball_path}.incomplete") + def initialize(name, resource) + super + @mirrors = resource.mirrors.dup + @tarball_path = HOMEBREW_CACHE.join("#{name}-#{resource.version}#{ext}") + @temporary_path = Pathname.new("#{tarball_path}.incomplete") end def cached_location
false
Other
Homebrew
brew
72c21fe991a840f70830aa050b0c9741b016af43.json
Simplify bsdmake wrapper, take 2
Library/ENV/4.3/bsdmake
@@ -1,7 +1,3 @@ #!/bin/bash export HOMEBREW_CCCFG="O$HOMEBREW_CCCFG" -pwd="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -bsd="$pwd/../../../bin/bsdmake" -# bsdmake used to be keg-only: support users who don't run brew doctor -[ -x "$bsd" ] || bsd="$(${HOMEBREW_BREW_FILE} --prefix bsdmake)/bin/bsdmake" -exec "$bsd" "$@" +exec xcrun bsdmake "$@"
false
Other
Homebrew
brew
fed9c9a9bec870929c2a646e97096c277ae148f8.json
Simplify bsdmake wrapper Since bsdmake is always specified as a dependency, our xcrun wrapper will always be able to find it, so we can get rid of this wrapper.
Library/ENV/4.3/bsdmake
@@ -1,7 +0,0 @@ -#!/bin/bash -export HOMEBREW_CCCFG="O$HOMEBREW_CCCFG" -pwd="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -bsd="$pwd/../../../bin/bsdmake" -# bsdmake used to be keg-only: support users who don't run brew doctor -[ -x "$bsd" ] || bsd="$(${HOMEBREW_BREW_FILE} --prefix bsdmake)/bin/bsdmake" -exec "$bsd" "$@"
true
Other
Homebrew
brew
fed9c9a9bec870929c2a646e97096c277ae148f8.json
Simplify bsdmake wrapper Since bsdmake is always specified as a dependency, our xcrun wrapper will always be able to find it, so we can get rid of this wrapper.
Library/ENV/4.3/bsdmake
@@ -0,0 +1 @@ +make \ No newline at end of file
true
Other
Homebrew
brew
fed9c9a9bec870929c2a646e97096c277ae148f8.json
Simplify bsdmake wrapper Since bsdmake is always specified as a dependency, our xcrun wrapper will always be able to find it, so we can get rid of this wrapper.
Library/ENV/4.3/make
@@ -1,3 +1,3 @@ #!/bin/bash export HOMEBREW_CCCFG="O$HOMEBREW_CCCFG" -exec xcrun make "$@" +exec xcrun "${0##*/}" "$@"
true
Other
Homebrew
brew
03159dd831c652f81ea02eff63d3aae02c5c07a9.json
Remove unused entries from test/.gitignore
Library/Homebrew/test/.gitignore
@@ -1,5 +1,3 @@ /.bundle/ /bin/ -/coverage -/prof /vendor/
false
Other
Homebrew
brew
dd3d8a9060bc17377fcd8c79a8c3ba6019a34ea0.json
Use better assertions
Library/Homebrew/test/test_language_module_dependency.rb
@@ -22,7 +22,7 @@ def test_differing_module_and_import_name import_name = "bar" l = LanguageModuleDependency.new(:python, mod_name, import_name) assert_includes l.message, mod_name - assert l.the_test.one? { |c| c.include?(import_name) } + assert_includes l.the_test, "import #{import_name}" end def test_bad_perl_deps
true
Other
Homebrew
brew
dd3d8a9060bc17377fcd8c79a8c3ba6019a34ea0.json
Use better assertions
Library/Homebrew/test/test_software_spec.rb
@@ -74,7 +74,7 @@ def test_option_description_defaults_to_empty_string def test_deprecated_option @spec.deprecated_option('foo' => 'bar') - assert @spec.deprecated_options.any? + refute_empty @spec.deprecated_options assert_equal "foo", @spec.deprecated_options.first.old assert_equal "bar", @spec.deprecated_options.first.current end
true
Other
Homebrew
brew
b89bacb9c94e85386571c7045490b54a98f51411.json
caveats: handle non-Homebrew plists. Mentioned in Homebrew/homebrew#34484.
Library/Homebrew/caveats.rb
@@ -108,7 +108,11 @@ def plist_caveats destination = f.plist_startup ? '/Library/LaunchDaemons' \ : '~/Library/LaunchAgents' - plist_filename = f.plist_path.basename + plist_filename = if f.plist + f.plist_path.basename + else + File.basename Dir["#{keg.to_path}/*.plist"].first + end plist_link = "#{destination}/#{plist_filename}" plist_domain = f.plist_path.basename('.plist') destination_path = Pathname.new File.expand_path destination
false
Other
Homebrew
brew
6017811397b7ee0797fe452309e37fb5018689a5.json
doctor: handle non-extent methods passed as arguments
Library/Homebrew/cmd/doctor.rb
@@ -1207,7 +1207,13 @@ def doctor first_warning = true methods.each do |method| - out = checks.send(method) + begin + out = checks.send(method) + rescue NoMethodError + Homebrew.failed = true + puts "No check available by the name: #{method}" + next + end unless out.nil? or out.empty? if first_warning puts <<-EOS.undent
false
Other
Homebrew
brew
00f064410660463f00bcd58d1683e05ab9bfc83c.json
test-bot: improve tap building. - allow using (UPSTREAM_)GIT_URL to find the tap name - push bottles to a remote based on the tap name
Library/Homebrew/cmd/test-bot.rb
@@ -546,6 +546,13 @@ def run def test_bot tap = ARGV.value('tap') + git_url = ENV['UPSTREAM_GIT_URL'] || ENV['GIT_URL'] + if !tap && git_url + # Also can get tap from Jenkins GIT_URL. + /([\w-]+\/homebrew-[\w-]+)/ =~ git_url + tap = $1 + end + if Pathname.pwd == HOMEBREW_PREFIX and ARGV.include? "--cleanup" odie 'cannot use --cleanup from HOMEBREW_PREFIX as it will delete all output.' end @@ -603,7 +610,9 @@ def test_bot ENV["GIT_AUTHOR_EMAIL"] = ENV["GIT_COMMITTER_EMAIL"] safe_system "brew", "bottle", "--merge", "--write", *Dir["*.bottle.rb"] - remote = "git@github.com:BrewTestBot/homebrew.git" + remote_repo = tap ? tap.gsub("/", "-") : "homebrew" + + remote = "git@github.com:BrewTestBot/#{remote_repo}.git" tag = pr ? "pr-#{pr}" : "testing-#{number}" safe_system "git", "push", "--force", remote, "master:master", ":refs/tags/#{tag}"
false
Other
Homebrew
brew
14c4c2fd67e9a68e0a717b7a959e5607186c2b84.json
SUPPORTERS.md: update a link. Closes Homebrew/homebrew#34350. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
SUPPORTERS.md
@@ -442,7 +442,7 @@ These wonderful people supported our Kickstarter by giving us £10 or more: * Jakub Suder * [Jason Garber](http://sixtwothree.org) * [Alejandro Caceres](http://punkspider.hyperiongray.com) -* [Slobodan Miskovic](http://www.taskforce-1.com) +* [Slobodan Miskovic](https://miskovic.ca) * [Kurt Ostergaard](http://KurtOstergaard.com) * [Simply Business](http://www.simplybusiness.co.uk/) * Tate Johnson
false
Other
Homebrew
brew
dc79f803b1a5b0436a3375999bc10403c3edb513.json
Remove unnecessary array allocations These classes are never instantiated with arguments, so we can get rid of the unnecessary array splatting.
Library/Homebrew/dependencies.rb
@@ -1,8 +1,8 @@ class Dependencies include Enumerable - def initialize(*args) - @deps = Array.new(*args) + def initialize + @deps = [] end def each(*args, &block) @@ -60,8 +60,8 @@ def inspect class Requirements include Enumerable - def initialize(*args) - @reqs = Set.new(*args) + def initialize + @reqs = Set.new end def each(*args, &block)
false