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 | daf8c26108bd34dfbcad05f321f0edb61fba13b3.json | cleanup: use Pathname#rmtree instead of FileUtils | Library/Homebrew/cmd/cleanup.rb | @@ -42,7 +42,7 @@ def cleanup_formula f
puts "Would remove: #{keg}"
else
puts "Removing: #{keg}..."
- rm_rf keg
+ keg.rmtree
end
else
opoo "Skipping (old) #{keg} due to it being linked" | false |
Other | Homebrew | brew | bf8bf2e1d11bf7758229990d9d8914164afd528e.json | cleanup: remove redundant condition
If f.installed? is true, f.rack.directory? will always be true as well. | Library/Homebrew/cmd/cleanup.rb | @@ -33,7 +33,7 @@ def cleanup_all
end
def cleanup_formula f
- if f.installed? and f.rack.directory?
+ if f.installed?
f.rack.children.each do |keg|
if File.directory? keg and f.version > Keg.new(keg).version
if f.can_cleanup? | false |
Other | Homebrew | brew | 132e6a3a8eff2b1887f7d59ddce3806098e7cbde.json | audit: fix version audit for Version subclasses
The version isn't redundant if a subclass of Version is specified. | Library/Homebrew/cmd/audit.rb | @@ -273,7 +273,7 @@ def audit_specs
else
version_text = s.version unless s.version.detected_from_url?
version_url = Version.parse(s.url)
- if version_url.to_s == version_text.to_s
+ if version_url.to_s == version_text.to_s && s.version.instance_of?(Version)
problem "#{s... | false |
Other | Homebrew | brew | e0c4fd5b720192cfeb06ba8bfffbc58113057bc1.json | test_keg: reduce noise by including FileUtils | Library/Homebrew/test/test_keg.rb | @@ -4,6 +4,8 @@
require 'stringio'
class LinkTests < Test::Unit::TestCase
+ include FileUtils
+
def setup
@formula = TestBall.new
shutup do
@@ -17,7 +19,7 @@ def setup
@old_stdout = $stdout
$stdout = StringIO.new
- FileUtils.mkpath HOMEBREW_PREFIX/"bin"
+ mkpath HOMEBREW_PREFIX/"bin"... | false |
Other | Homebrew | brew | 46f8be1d9ed12aa54cd472f2ae70aef7c6e35e6b.json | Use Hash#each_value rather than discarding key | Library/Homebrew/cmd/doctor.rb | @@ -869,7 +869,7 @@ def check_tmpdir
def check_missing_deps
return unless HOMEBREW_CELLAR.exist?
s = Set.new
- Homebrew.missing_deps(Formula.installed).each do |_, deps|
+ Homebrew.missing_deps(Formula.installed).each_value do |deps|
s.merge deps
end
| false |
Other | Homebrew | brew | 1bf8fbfe9a9eba0796a76f5831b675316098a033.json | info: simplify keg listing | Library/Homebrew/cmd/info.rb | @@ -106,9 +106,7 @@ def info_formula f
puts "Conflicts with: #{conflicts*', '}" unless conflicts.empty?
if f.rack.directory?
- kegs = f.rack.children
- kegs.reject! {|keg| keg.basename.to_s == '.DS_Store' }
- kegs = kegs.map {|keg| Keg.new(keg) }.sort_by {|keg| keg.version }
+ kegs = f.r... | false |
Other | Homebrew | brew | e02d6f2500fc81f98645d16b614ae83a76713a78.json | info: improve dependency listing | Library/Homebrew/cmd/info.rb | @@ -102,8 +102,7 @@ def info_formula f
puts
end
- puts "Depends on: #{f.deps*', '}" unless f.deps.empty?
- conflicts = f.conflicts.map { |c| c.formula }.sort
+ conflicts = f.conflicts.map(&:formula).sort!
puts "Conflicts with: #{conflicts*', '}" unless conflicts.empty?
if f.rack.direc... | false |
Other | Homebrew | brew | 2d93935e6a4a303d4c67c9007e02bb5ba73f2644.json | Add type accessors to Dependencies | Library/Homebrew/dependable.rb | @@ -15,6 +15,10 @@ def recommended?
tags.include? :recommended
end
+ def required?
+ !build? && !optional? && !recommended?
+ end
+
def options
Options.coerce(tags - RESERVED_TAGS)
end | true |
Other | Homebrew | brew | 2d93935e6a4a303d4c67c9007e02bb5ba73f2644.json | Add type accessors to Dependencies | Library/Homebrew/dependencies.rb | @@ -26,4 +26,24 @@ def to_a
@deps
end
alias_method :to_ary, :to_a
+
+ def optional
+ select(&:optional?)
+ end
+
+ def recommended
+ select(&:recommended?)
+ end
+
+ def build
+ select(&:build?)
+ end
+
+ def required
+ select(&:required?)
+ end
+
+ def default
+ build + required + re... | true |
Other | Homebrew | brew | 2d93935e6a4a303d4c67c9007e02bb5ba73f2644.json | Add type accessors to Dependencies | Library/Homebrew/test/test_dependencies.rb | @@ -45,4 +45,18 @@ def test_to_ary
@deps << dep
assert_equal [dep], @deps.to_ary
end
+
+ def test_type_helpers
+ foo = Dependency.new("foo")
+ bar = Dependency.new("bar", [:optional])
+ baz = Dependency.new("baz", [:build])
+ qux = Dependency.new("qux", [:recommended])
+ quux = Dependency.n... | true |
Other | Homebrew | brew | 290a93ea758488486e02ff063a28b57117501c07.json | Remove ancient global methods from compat | Library/Homebrew/compat/compatibility.rb | @@ -1,56 +1,7 @@
-## Compatibility layer introduced in 0.8 (refactor)
-
-# maybe never used by anyone, but alas it must continue to exist
-def versions_of(keg_name)
- `/bin/ls #{HOMEBREW_CELLAR}/#{keg_name}`.collect { |version| version.strip }.reverse
-end
-
-def dump_config
- require 'cmd/--config'
- Homebrew.__con... | false |
Other | Homebrew | brew | ba93e6d3630c6007290567f160a9a16bc17253c5.json | Overwrite broken symlinks with --overwrite
Closes Homebrew/homebrew#19480.
Signed-off-by: Misty De Meo <mistydemeo@gmail.com> | Library/Homebrew/extend/pathname.rb | @@ -264,7 +264,20 @@ def make_relative_symlink src
raise <<-EOS.undent
Could not symlink file: #{src.expand_path}
Target #{self} already exists. You may need to delete it.
- To force the link and delete this file, do:
+ To force the link and overwrite all other... | true |
Other | Homebrew | brew | ba93e6d3630c6007290567f160a9a16bc17253c5.json | Overwrite broken symlinks with --overwrite
Closes Homebrew/homebrew#19480.
Signed-off-by: Misty De Meo <mistydemeo@gmail.com> | Library/Homebrew/keg.rb | @@ -194,14 +194,14 @@ def make_relative_symlink dst, src, mode=OpenStruct.new
puts "Skipping; already exists: #{dst}" if ARGV.verbose?
# cf. git-clean -n: list files to delete, don't really link or delete
elsif mode.dry_run and mode.overwrite
- puts dst if dst.exist?
+ puts dst if dst.exist? ... | true |
Other | Homebrew | brew | ba93e6d3630c6007290567f160a9a16bc17253c5.json | Overwrite broken symlinks with --overwrite
Closes Homebrew/homebrew#19480.
Signed-off-by: Misty De Meo <mistydemeo@gmail.com> | Library/Homebrew/test/test_keg.rb | @@ -61,6 +61,15 @@ def test_link_overwrite
assert_equal 3, @keg.link(mode)
end
+ def test_link_overwrite_broken_symlinks
+ FileUtils.cd HOMEBREW_PREFIX/"bin" do
+ FileUtils.ln_s "nowhere", "helloworld"
+ end
+ mode = OpenStruct.new
+ mode.overwrite = true
+ assert_equal 3, @keg.link(mode)... | true |
Other | Homebrew | brew | 5bf652ecddff309934184f781059f677c7ff3a6f.json | Avoid extra array allocations | Library/Homebrew/options.rb | @@ -106,13 +106,16 @@ def self.coerce(arg)
when self then arg
when Option then new << arg
when Array
- opts = arg.map do |_arg|
- case _arg
- when /^-[^-]+$/ then _arg[1..-1].split(//)
- else _arg
+ opts = new
+ arg.each do |a|
+ case a
+ when /^-[^-]+$/
... | true |
Other | Homebrew | brew | 5bf652ecddff309934184f781059f677c7ff3a6f.json | Avoid extra array allocations | Library/Homebrew/version.rb | @@ -97,7 +97,7 @@ def to_s
protected
def to_a
- @array ||= @version.scan(/\d+|[a-zA-Z]+/).map { |e| VersionElement.new(e) }
+ @array ||= @version.scan(/\d+|[a-zA-Z]+/).map! { |e| VersionElement.new(e) }
end
def self.parse spec | true |
Other | Homebrew | brew | b32202033881d93849f4c44a837389e8a9d450ef.json | Reduce allocations in dependency construction
By always passing around a single, unnested array rather than splatting
and then defensively flattening and compacting things, we can avoid
allocating a bunch of unnecessary arrays. This gives a performance boost
of roughly 4% when enumerating 2500 formulae, and has the si... | Library/Homebrew/dependency.rb | @@ -6,9 +6,9 @@ class Dependency
attr_reader :name, :tags
- def initialize(name, *tags)
+ def initialize(name, tags=[])
@name = name
- @tags = tags.flatten.compact
+ @tags = tags
end
def to_s | true |
Other | Homebrew | brew | b32202033881d93849f4c44a837389e8a9d450ef.json | Reduce allocations in dependency construction
By always passing around a single, unnested array rather than splatting
and then defensively flattening and compacting things, we can avoid
allocating a bunch of unnecessary arrays. This gives a performance boost
of roughly 4% when enumerating 2500 formulae, and has the si... | Library/Homebrew/dependency_collector.rb | @@ -38,87 +38,89 @@ def add(spec)
end
def build(spec)
- spec, tag = case spec
- when Hash then spec.shift
- else spec
- end
+ spec, tags = case spec
+ when Hash then spec.shift
+ else spec
+ end
- parse_spec(... | true |
Other | Homebrew | brew | b32202033881d93849f4c44a837389e8a9d450ef.json | Reduce allocations in dependency construction
By always passing around a single, unnested array rather than splatting
and then defensively flattening and compacting things, we can avoid
allocating a bunch of unnecessary arrays. This gives a performance boost
of roughly 4% when enumerating 2500 formulae, and has the si... | Library/Homebrew/requirement.rb | @@ -10,8 +10,8 @@ class Requirement
attr_reader :tags, :name
- def initialize(*tags)
- @tags = tags.flatten.compact
+ def initialize(tags=[])
+ @tags = tags
@tags << :build if self.class.build
@name ||= infer_name
end | true |
Other | Homebrew | brew | b32202033881d93849f4c44a837389e8a9d450ef.json | Reduce allocations in dependency construction
By always passing around a single, unnested array rather than splatting
and then defensively flattening and compacting things, we can avoid
allocating a bunch of unnecessary arrays. This gives a performance boost
of roughly 4% when enumerating 2500 formulae, and has the si... | Library/Homebrew/requirements/language_module_dependency.rb | @@ -7,7 +7,7 @@ def initialize language, module_name, import_name=module_name
@language = language
@module_name = module_name
@import_name = import_name
- super
+ super([language, module_name, import_name])
end
satisfy { quiet_system(*the_test) } | true |
Other | Homebrew | brew | b32202033881d93849f4c44a837389e8a9d450ef.json | Reduce allocations in dependency construction
By always passing around a single, unnested array rather than splatting
and then defensively flattening and compacting things, we can avoid
allocating a bunch of unnecessary arrays. This gives a performance boost
of roughly 4% when enumerating 2500 formulae, and has the si... | Library/Homebrew/requirements/x11_dependency.rb | @@ -9,8 +9,7 @@ class X11Dependency < Requirement
env { ENV.x11 }
- def initialize(name="x11", *tags)
- tags.flatten!
+ def initialize(name="x11", tags=[])
@name = name
@min_version = tags.shift if /(\d\.)+\d/ === tags.first
super(tags)
@@ -66,19 +65,19 @@ def defines_const?(const)
e... | true |
Other | Homebrew | brew | b32202033881d93849f4c44a837389e8a9d450ef.json | Reduce allocations in dependency construction
By always passing around a single, unnested array rather than splatting
and then defensively flattening and compacting things, we can avoid
allocating a bunch of unnecessary arrays. This gives a performance boost
of roughly 4% when enumerating 2500 formulae, and has the si... | Library/Homebrew/test/test_comparableset.rb | @@ -17,25 +17,25 @@ def test_merging_multiple_dependencies
def test_comparison_prefers_larger
@set << X11Dependency.new
- @set << X11Dependency.new('x11', '2.6')
+ @set << X11Dependency.new('x11', %w{2.6})
assert_equal 1, @set.count
- assert_equal [X11Dependency.new('x11', '2.6')], @set.to_a
+ ... | true |
Other | Homebrew | brew | b32202033881d93849f4c44a837389e8a9d450ef.json | Reduce allocations in dependency construction
By always passing around a single, unnested array rather than splatting
and then defensively flattening and compacting things, we can avoid
allocating a bunch of unnecessary arrays. This gives a performance boost
of roughly 4% when enumerating 2500 formulae, and has the si... | Library/Homebrew/test/test_dependency.rb | @@ -20,7 +20,7 @@ def test_interrogation
class DependencyTests < Test::Unit::TestCase
def test_accepts_single_tag
- dep = Dependency.new("foo", "bar")
+ dep = Dependency.new("foo", %w{bar})
assert_equal %w{bar}, dep.tags
end
@@ -30,7 +30,7 @@ def test_accepts_multiple_tags
end
def test_pre... | true |
Other | Homebrew | brew | b32202033881d93849f4c44a837389e8a9d450ef.json | Reduce allocations in dependency construction
By always passing around a single, unnested array rather than splatting
and then defensively flattening and compacting things, we can avoid
allocating a bunch of unnecessary arrays. This gives a performance boost
of roughly 4% when enumerating 2500 formulae, and has the si... | Library/Homebrew/test/test_dependency_collector.rb | @@ -30,7 +30,7 @@ def test_add_returns_created_dep
end
def test_dependency_tags
- assert Dependency.new('foo', :build).build?
+ assert Dependency.new('foo', [:build]).build?
assert Dependency.new('foo', [:build, :optional]).optional?
assert Dependency.new('foo', [:universal]).options.include? '-... | true |
Other | Homebrew | brew | b32202033881d93849f4c44a837389e8a9d450ef.json | Reduce allocations in dependency construction
By always passing around a single, unnested array rather than splatting
and then defensively flattening and compacting things, we can avoid
allocating a bunch of unnecessary arrays. This gives a performance boost
of roughly 4% when enumerating 2500 formulae, and has the si... | Library/Homebrew/test/test_requirement.rb | @@ -3,27 +3,23 @@
class RequirementTests < Test::Unit::TestCase
def test_accepts_single_tag
- dep = Requirement.new("bar")
+ dep = Requirement.new(%w{bar})
assert_equal %w{bar}, dep.tags
end
def test_accepts_multiple_tags
dep = Requirement.new(%w{bar baz})
assert_equal %w{bar baz}.sor... | true |
Other | Homebrew | brew | 666b48e39127e650681f4e24068787c309de5ee4.json | Check Requirement before Dependency
It's much more likely that an instance of Requirement is passed. | Library/Homebrew/dependency_collector.rb | @@ -54,7 +54,7 @@ def parse_spec spec, tag
parse_string_spec(spec, tag)
when Symbol
parse_symbol_spec(spec, tag)
- when Dependency, Requirement
+ when Requirement, Dependency
spec
when Class
parse_class_spec(spec, tag) | false |
Other | Homebrew | brew | 9ec3102e57e73c4f5b204f4c370cc51a423ced98.json | Formula: fix to_hash output for bottles | Library/Homebrew/formula.rb | @@ -509,7 +509,7 @@ def to_hash
"homepage" => homepage,
"versions" => {
"stable" => (stable.version.to_s if stable),
- "bottle" => bottle || false,
+ "bottle" => bottle ? true : false,
"devel" => (devel.version.to_s if devel),
"head" => (head.version.to_s if head)
... | false |
Other | Homebrew | brew | 1c12c8b7a22fb9b4dd4b3cff0f3071711e7d6e2d.json | Add frameworks helper to formula | Library/Homebrew/formula.rb | @@ -165,6 +165,7 @@ def man8; man+'man8' end
def sbin; prefix+'sbin' end
def share; prefix+'share' end
+ def frameworks; prefix+'Frameworks' end
def kext_prefix; prefix+'Library/Extensions' end
# configuration needs to be preserved past upgrades | false |
Other | Homebrew | brew | c479c680b8e3fb022d8d5cb93d00a1eff5666af8.json | brew-test-bot: fix output handling. | Library/Contributions/cmd/brew-test-bot.rb | @@ -61,20 +61,20 @@ def self.run test, command, puts_output_on_success = false
step.puts_command
command = "#{step.command} &>#{step.log_file_path}"
-
- output = nil
if command.start_with? 'git '
Dir.chdir step.repository do
- output = `#{command}`
+ `#{command}`
end
... | false |
Other | Homebrew | brew | a70c44993f52f731f84fde3471ff805249851a97.json | brew-test-bot: handle empty log files. | Library/Contributions/cmd/brew-test-bot.rb | @@ -70,7 +70,7 @@ def self.run test, command, puts_output_on_success = false
else
output = `#{command}`
end
- output = IO.read(step.log_file_path)
+ output = IO.read(step.log_file_path) rescue nil
success = $?.success?
step.status = success ? :passed : :failed | false |
Other | Homebrew | brew | afd2dde47495d04bc9aeafc32fe8b39515f6563e.json | --env: show HOMEBREW_CC in superenv
Closes Homebrew/homebrew#18247. | Library/Homebrew/cmd/--env.rb | @@ -19,7 +19,10 @@ def __env
end
def build_env_keys env
- %w[ CC CXX LD CFLAGS CXXFLAGS CPPFLAGS LDFLAGS SDKROOT MAKEFLAGS
+ %w[
+ CC CXX LD
+ HOMEBREW_CC
+ CFLAGS CXXFLAGS CPPFLAGS LDFLAGS SDKROOT MAKEFLAGS
CMAKE_PREFIX_PATH CMAKE_INCLUDE_PATH CMAKE_LIBRARY_PATH CMAKE_FRAMEWORK_PATH... | false |
Other | Homebrew | brew | 070758689b2872051a56e9d01f582ab4d32b8f83.json | Update HOMEBREW_DEBUG in man page.
Closes Homebrew/homebrew#17344. | Library/Contributions/manpages/brew.1.md | @@ -435,7 +435,7 @@ can take several different forms:
If set, Homebrew will pass `--verbose` when invoking `curl`(1).
* HOMEBREW\_DEBUG:
- If set, Homebrew always assumes `--debug` when running commands.
+ If set, any commands that can emit debugging information will do so.
* HOMEBREW\_DEBUG\_INSTA... | true |
Other | Homebrew | brew | 070758689b2872051a56e9d01f582ab4d32b8f83.json | Update HOMEBREW_DEBUG in man page.
Closes Homebrew/homebrew#17344. | share/man/man1/brew.1 | @@ -478,7 +478,7 @@ If set, Homebrew will pass \fB\-\-verbose\fR when invoking \fBcurl\fR(1)\.
.
.TP
HOMEBREW_DEBUG
-If set, Homebrew always assumes \fB\-\-debug\fR when running commands\.
+If set, any commands that can emit debugging information will do so\.
.
.TP
HOMEBREW_DEBUG_INSTALL | true |
Other | Homebrew | brew | 0bfcad4cd330fcbcbbad49c951e883730fb50ce4.json | completion: avoid unnecessary `brew` invocations | Library/Contributions/brew_bash_completion.sh | @@ -60,13 +60,14 @@ __brewcomp ()
__brew_complete_formulae ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
- local ff=$(\ls $(brew --repository)/Library/Formula 2>/dev/null | sed 's/\.rb//g')
- local af=$(\ls $(brew --repository)/Library/Aliases 2>/dev/null | sed 's/\.rb//g')
+ local lib=$(brew --repository)... | false |
Other | Homebrew | brew | b163ed03e9b7406ceefd88033943ff28d0ff7ebd.json | info: try blacklist for unknown formula names
Closes Homebrew/homebrew#17399. | Library/Homebrew/cmd/info.rb | @@ -2,6 +2,7 @@
require 'tab'
require 'keg'
require 'caveats'
+require 'blacklist'
module Homebrew extend self
def info
@@ -29,7 +30,15 @@ def print_info
elsif valid_url ARGV[0]
info_formula Formula.factory(ARGV.shift)
else
- ARGV.formulae.each{ |f| info_formula f }
+ ARGV.named.each... | false |
Other | Homebrew | brew | 364c5c34733a3b941e2310f1d4b2899075ee303d.json | Combine GitHub version regexes | Library/Homebrew/version.rb | @@ -118,20 +118,12 @@ def self._parse spec
spec.stem
end
- # GitHub tarballs, e.g. v1.2.3
- m = %r[github.com/.+/(?:zip|tar)ball/v?((\d+\.)+\d+)$].match(spec_s)
- return m.captures.first unless m.nil?
-
+ # GitHub tarballs
+ # e.g. https://github.com/foo/bar/tarball/v1.2.3
# e.g. https... | false |
Other | Homebrew | brew | 62db042277dbd60d8b6ff74416e84c053a62b781.json | audit: fix interpolation check
Fixes Homebrew/homebrew#19363. | Library/Homebrew/cmd/audit.rb | @@ -331,7 +331,7 @@ def audit_text
end
# Check for string interpolation of single values.
- if text =~ /(system|inreplace|gsub!|change_make_var!) .* ['"]#\{(\w+(\.\w+)?)\}['"]/
+ if text =~ /(system|inreplace|gsub!|change_make_var!).*[ ,]"#\{([\w.]+)\}"/
problem "Don't need to interpolate \"#{$... | false |
Other | Homebrew | brew | b7066b6e74c5ee2d6d0029e4f988134cdb1e7a77.json | Add a couple more version tests | Library/Homebrew/test/test_versions.rb | @@ -265,4 +265,12 @@ def test_wwwoffle_version
def test_synergy_version
assert_version_detected '1.3.6p2', 'http://synergy.googlecode.com/files/synergy-1.3.6p2-MacOSX-Universal.zip'
end
+
+ def test_fontforge_version
+ assert_version_detected '20120731', 'http://downloads.sourceforge.net/project/fontforg... | false |
Other | Homebrew | brew | 4f45077fdee34243f2506ce6328a6d16f8330019.json | Remove global methods from formulae
Removes any global methods from formulae, and moves #kext_prefix (which
seems to be at least somewhat abstractable) into the Formula class. The
only formula with global methods is now aspell; it (and its generating
script in contrib) has been changed to prefix that method with
`aspe... | Library/Contributions/cmd/brew-aspell-dictionaries | @@ -40,7 +40,7 @@ EOF
done
cat <<EOF >> $brew_formulae_tmp_file
-def available_languages
+def aspell_available_languages
%w(${langs})
end
# END generated with `basename $0` | true |
Other | Homebrew | brew | 4f45077fdee34243f2506ce6328a6d16f8330019.json | Remove global methods from formulae
Removes any global methods from formulae, and moves #kext_prefix (which
seems to be at least somewhat abstractable) into the Formula class. The
only formula with global methods is now aspell; it (and its generating
script in contrib) has been changed to prefix that method with
`aspe... | Library/Homebrew/formula.rb | @@ -165,6 +165,8 @@ def man8; man+'man8' end
def sbin; prefix+'sbin' end
def share; prefix+'share' end
+ def kext_prefix; prefix+'Library/Extensions' end
+
# configuration needs to be preserved past upgrades
def etc; HOMEBREW_PREFIX+'etc' end
# generally we don't want var stuff insi... | true |
Other | Homebrew | brew | 1e2cb0fd650a5b5990d82541251585425b2d62fe.json | SUPPORTERS.md: turn names into links.
Closes Homebrew/homebrew#19324. | SUPPORTERS.md | @@ -11,181 +11,181 @@ until then.
These wonderful people supported our Kickstarter by giving us £10 or more:
* Simon Rascovsky
-* silsha (http://felixarndt.de)
-* Martin Kopischke (http://martin.kopischke.net)
-* John Kary (http://johnkary.net)
-* David M. Carr (http://david.carrclan.us)
-* Dale Tournemille (http:/... | false |
Other | Homebrew | brew | 49682e854d10e99e799e7aeefd1ec08e2ebcf56b.json | Avoid expensive Pathname concatenation | Library/Homebrew/download_strategy.rb | @@ -37,13 +37,13 @@ def initialize name, package
super
if name.to_s.empty? || name == '__UNKNOWN__'
- @tarball_path = HOMEBREW_CACHE + File.basename(@url)
+ @tarball_path = Pathname.new("#{HOMEBREW_CACHE}/#{File.basename(@url)}")
else
- @tarball_path = HOMEBREW_CACHE + "#{name}-#{package... | true |
Other | Homebrew | brew | 49682e854d10e99e799e7aeefd1ec08e2ebcf56b.json | Avoid expensive Pathname concatenation | Library/Homebrew/formula.rb | @@ -116,16 +116,16 @@ def unpin
end
def linked_keg
- HOMEBREW_REPOSITORY/'Library/LinkedKegs'/name
+ Pathname.new("#{HOMEBREW_LIBRARY}/LinkedKegs/#{name}")
end
def installed_prefix
devel_prefix = unless devel.nil?
- HOMEBREW_CELLAR/name/devel.version
+ Pathname.new("#{HOMEBREW_CELLA... | true |
Other | Homebrew | brew | 49682e854d10e99e799e7aeefd1ec08e2ebcf56b.json | Avoid expensive Pathname concatenation | Library/Homebrew/os/mac/xcode.rb | @@ -33,15 +33,15 @@ def latest_version
def prefix
@prefix ||= begin
path = Pathname.new(folder)
- if path.absolute? and (path/'usr/bin/make').executable?
+ if path.absolute? and File.executable? "#{path}/usr/bin/make"
path
elsif File.executable? '/Developer/usr/bin/make'
... | true |
Other | Homebrew | brew | 49682e854d10e99e799e7aeefd1ec08e2ebcf56b.json | Avoid expensive Pathname concatenation | Library/Homebrew/os/mac/xquartz.rb | @@ -70,27 +70,27 @@ def installed?
# Confusingly, executables (e.g. config scripts) are only found under
# /opt/X11/bin or /usr/X11/bin in all cases.
def bin
- prefix/'bin'
+ Pathname.new("#{prefix}/bin")
end
def include
@include ||= if use_sdk?
- MacOS.sdk_path/'usr/X11/include'
+ ... | true |
Other | Homebrew | brew | 010a1461f7fd02f14b9cfe9bd3c9018fddcb4431.json | Avoid repeated interpolation here too | Library/Homebrew/cmd/doctor.rb | @@ -204,7 +204,7 @@ def check_for_broken_symlinks
Keg::PRUNEABLE_DIRECTORIES.each do |d|
next unless d.directory?
d.find do |pn|
- broken_symlinks << pn if pn.symlink? and pn.readlink.expand_path.to_s =~ /^#{HOMEBREW_PREFIX}/ and not pn.exist?
+ broken_symlinks << pn if pn.symlink? and pn.readlin... | false |
Other | Homebrew | brew | 1bad199776c5225cf685cd5443041cb8c303ef0c.json | Avoid slow operations in FormulaPin#initialize
A FormulaPin object is created every time Formula is instantiated, so
don't do filesystem operations or Pathname concatenation eagerly. | Library/Homebrew/formula_pin.rb | @@ -6,13 +6,16 @@ class FormulaPin
def initialize(formula)
@formula = formula
@name = formula.name
- HOMEBREW_PINNED.mkdir unless HOMEBREW_PINNED.exist?
- @path = HOMEBREW_PINNED+@name
+ end
+
+ def path
+ HOMEBREW_PINNED+@name
end
def pin_at(version)
+ HOMEBREW_PINNED.mkpath unless H... | false |
Other | Homebrew | brew | 3c73cc28e0bf12d54f344135b35c5af8feaf0a77.json | Optimization: avoid repeated interpolation in regexp
Benchmark.bm do |b|
b.report("before") do
100_000.times { /(\.#{MacOS.cat}\.bottle\.(\d+\.)?tar\.gz)$/ }
end
b.report("after ") do
100_000.times { /(\.#{MacOS.cat}\.bottle\.(\d+\.)?tar\.gz)$/o }
end
end
user system total r... | Library/Homebrew/bottles.rb | @@ -63,7 +63,7 @@ def bottle_suffix revision=nil
end
def bottle_native_regex
- /(\.#{MacOS.cat}\.bottle\.(\d+\.)?tar\.gz)$/
+ /(\.#{MacOS.cat}\.bottle\.(\d+\.)?tar\.gz)$/o
end
def bottle_regex | false |
Other | Homebrew | brew | c8f2d41fe412f34fc6e5358b6a8be14df5e65db0.json | Remove extra require | Library/Homebrew/test/test_updater.rb | @@ -1,7 +1,4 @@
-abort if ARGV.include? "--skip-update"
-
require 'testing_env'
-require 'formula'
require 'cmd/update'
require 'yaml'
| false |
Other | Homebrew | brew | e5eaa6696c7580682365063501d62ae27108f566.json | Remove obsolete tests
This behavior is now tested at more appropriate levels in
test_software_spec, test_formula_spec_selection, and
test_formula_validation. | Library/Homebrew/test/test_formula.rb | @@ -67,12 +67,34 @@ def test_mirror_support
f.downloader.instance_variable_get(:@url)
end
- def test_formula_specs
- f = SpecTestBall.new
+ def test_formula_spec_integration
+ f = Class.new(Formula) do
+ homepage 'http://example.com'
+ url 'file:///foo.com/testball-0.1.tbz'
+ mirror '... | true |
Other | Homebrew | brew | e5eaa6696c7580682365063501d62ae27108f566.json | Remove obsolete tests
This behavior is now tested at more appropriate levels in
test_software_spec, test_formula_spec_selection, and
test_formula_validation. | Library/Homebrew/test/test_formula_spec_selection.rb | @@ -10,6 +10,10 @@ def assert_spec_selected(spec)
assert_equal @_f.send(spec), @_f.active_spec
end
+ def assert_spec_unset(spec)
+ assert_nil @_f.send(spec)
+ end
+
def test_selects_head_when_requested
ARGV.stubs(:build_head?).returns(true)
@@ -96,4 +100,48 @@ def test_selects_head_when_exclusi... | true |
Other | Homebrew | brew | e5eaa6696c7580682365063501d62ae27108f566.json | Remove obsolete tests
This behavior is now tested at more appropriate levels in
test_software_spec, test_formula_spec_selection, and
test_formula_validation. | Library/Homebrew/test/test_software_spec.rb | @@ -23,7 +23,7 @@ def test_url_with_specs
assert_equal({ :branch => 'master' }, @spec.specs)
end
- def test_url_with_custom_download_strategy
+ def test_url_with_custom_download_strategy_class
strategy = Class.new(AbstractDownloadStrategy)
@spec.url('foo', :using => strategy)
assert_equal 'fo... | true |
Other | Homebrew | brew | e5eaa6696c7580682365063501d62ae27108f566.json | Remove obsolete tests
This behavior is now tested at more appropriate levels in
test_software_spec, test_formula_spec_selection, and
test_formula_validation. | Library/Homebrew/test/testball.rb | @@ -29,163 +29,3 @@ def install
system "./configure"
end
end
-
-class SpecTestBall < Formula
- homepage 'http://example.com'
- url 'file:///foo.com/testball-0.1.tbz'
- mirror 'file:///foo.org/testball-0.1.tbz'
- sha1 '482e737739d946b7c8cbaf127d9ee9c148b999f5'
-
- head 'https://github.com/mxcl/homebrew.git... | true |
Other | Homebrew | brew | 00bcc5e8ad854f1ab1113dccac1f279116897cf8.json | Make a specific assertion in this test | Library/Homebrew/test/test_formula_validation.rb | @@ -12,9 +12,8 @@ def assert_invalid(attr, &block)
end
def test_cant_override_brew
- assert_raises(RuntimeError) do
- Class.new(Formula) { def brew; end }
- end
+ e = assert_raises(RuntimeError) { Class.new(Formula) { def brew; end } }
+ assert_equal "You cannot override Formula#brew", e.messag... | false |
Other | Homebrew | brew | a05bb488073cc8974d263576ca61706c76e110d0.json | Raise a useful exception for incomplete formulae | Library/Homebrew/formula.rb | @@ -73,9 +73,11 @@ def determine_active_spec
when @head && ARGV.build_head? then @head # --HEAD
when @devel && ARGV.build_devel? then @devel # --devel
when @bottle && install_bottle?(self) then @bottle # bottle available
+ when @stable then @stable
when ... | true |
Other | Homebrew | brew | a05bb488073cc8974d263576ca61706c76e110d0.json | Raise a useful exception for incomplete formulae | Library/Homebrew/test/test_formula_validation.rb | @@ -77,4 +77,9 @@ def test_head_only_valid
end
end
end
+
+ def test_empty_formula_invalid
+ e = assert_raises(RuntimeError) { formula {} }
+ assert_equal "Formulae require at least a URL", e.message
+ end
end | true |
Other | Homebrew | brew | 25c0ecfd63270939aef8102e11afea161915f8c2.json | Add tests for formula spec selection
These tests document the relative precedence of the stable, bottle,
devel, and head specifications, and the conditions that can influence
which is selected (e.g. command-line flags). | Library/Homebrew/test/test_bottles.rb | @@ -1,22 +0,0 @@
-require 'testing_env'
-require 'test/testball'
-
-class BottleTests < Test::Unit::TestCase
- def test_bottle_spec_selection
- f = SnowLeopardBottleSpecTestBall.new
-
- assert_equal case MacOS.cat
- when :snow_leopard then f.bottle
- else f.stable
- end, f.active_spec
-
- f = L... | true |
Other | Homebrew | brew | 25c0ecfd63270939aef8102e11afea161915f8c2.json | Add tests for formula spec selection
These tests document the relative precedence of the stable, bottle,
devel, and head specifications, and the conditions that can influence
which is selected (e.g. command-line flags). | Library/Homebrew/test/test_formula_spec_selection.rb | @@ -0,0 +1,99 @@
+require 'testing_env'
+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
+
+ def test_selects_he... | true |
Other | Homebrew | brew | 291977d823f7080c33339f3c91c102f1d5ea4b24.json | Run `tap --repair` as part of `prune`
And by extension, `cleanup`.
Fixes Homebrew/homebrew#18658. | Library/Homebrew/cmd/prune.rb | @@ -1,4 +1,5 @@
require 'keg'
+require 'cmd/tap'
module Homebrew extend self
# $n and $d are used by the ObserverPathnameExtension to keep track of
@@ -28,6 +29,8 @@ def prune
dirs.sort.reverse_each{ |d| d.rmdir_if_possible }
+ repair_taps
+
if $n == 0 and $d == 0
puts "Nothing pruned" if... | false |
Other | Homebrew | brew | da9078aa51676b03dc8979e8c7f235880a0e2559.json | Add tap --repair to bash completion script
Closes Homebrew/homebrew#19113.
Signed-off-by: Jack Nagel <jacknagel@gmail.com> | Library/Contributions/brew_bash_completion.sh | @@ -92,6 +92,18 @@ __brew_complete_tapped ()
__brewcomp "$(\ls $(brew --repository)/Library/Taps 2>/dev/null | sed 's/-/\//g')"
}
+_brew_complete_tap ()
+{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ case "$cur" in
+ --*)
+ __brewcomp "--repair"
+ return
+ ;;
+ esac
+ __brew_co... | false |
Other | Homebrew | brew | 951b09b1c51e8aded1b4b8d7e9e2c5523dee350c.json | link: eliminate naked rescue | Library/Homebrew/cmd/link.rb | @@ -42,8 +42,7 @@ def link
puts "Note that doing so can interfere with building software."
next
end
- rescue
- # Nothing to see here
+ rescue FormulaUnavailableError
end
keg.lock do | false |
Other | Homebrew | brew | bd4aaac96b1f08d59a8e208095ac56ff446608df.json | Check existence rather than rescue exceptions | Library/Homebrew/formula.rb | @@ -80,7 +80,7 @@ def mirrors; @active_spec.mirrors; end
# if the dir is there, but it's empty we consider it not installed
def installed?
- installed_prefix.children.length > 0 rescue false
+ (dir = installed_prefix).directory? && dir.children.length > 0
end
def pinable? | true |
Other | Homebrew | brew | bd4aaac96b1f08d59a8e208095ac56ff446608df.json | Check existence rather than rescue exceptions | Library/Homebrew/test/test_formula.rb | @@ -14,6 +14,22 @@ def test_prefix
assert_kind_of Pathname, f.prefix
end
+ def test_installed?
+ f = TestBall.new
+ f.stubs(:installed_prefix).returns(stub(:directory? => false))
+ assert !f.installed?
+
+ f.stubs(:installed_prefix).returns(
+ stub(:directory? => true, :children => [])
+ ... | true |
Other | Homebrew | brew | 67844c9012a8692d7435862b67a9c791a56abe01.json | Simplify these tests | Library/Homebrew/test/test_bucket.rb | @@ -1,23 +1,6 @@
require 'testing_env'
require 'test/testball'
-class MockFormula < Formula
- def initialize url
- @stable = SoftwareSpec.new(url)
- super 'test'
- end
-end
-
-class TestZip < Formula
- def initialize
- @homepage = 'http://example.com/'
- zip=HOMEBREW_CACHE.parent+'test-0.1.zip'
- ... | false |
Other | Homebrew | brew | 8bfc6e024df4e72c234eef616db8a96b34819285.json | Add an alias to gmake in superenv
I had a luarock explicitly look ONLY for gmake, FFS.
This should be safe. | Library/ENV/4.3/gmake | @@ -0,0 +1 @@
+make
\ No newline at end of file | false |
Other | Homebrew | brew | b681ed42006ed92565ab97c8a4dee8fa4f8c0be7.json | SubversionDownloadStrategy: fix pathname concatenation
Fixes Homebrew/homebrew#19066. | Library/Homebrew/download_strategy.rb | @@ -216,7 +216,7 @@ def initialize name, package
@co = HOMEBREW_CACHE + "#{name}--svn"
end
- @co << "-HEAD" if ARGV.build_head?
+ @co + "-HEAD" if ARGV.build_head?
end
def cached_location | false |
Other | Homebrew | brew | 646102c31118144545127b7ed70512de753d1d40.json | Fix argument order in test_comparableset | Library/Homebrew/test/test_comparableset.rb | @@ -10,23 +10,23 @@ def setup
def test_merging_multiple_dependencies
@set << X11Dependency.new
@set << X11Dependency.new
- assert_equal @set.count, 1
+ assert_equal 1, @set.count
@set << Requirement.new
- assert_equal @set.count, 2
+ assert_equal 2, @set.count
end
def test_comparis... | false |
Other | Homebrew | brew | d07defa7c11449a776ab9f5c63f437c576806195.json | Fix specs in TestBall | Library/Homebrew/test/test_bucket.rb | @@ -61,7 +61,12 @@ def test_brew_h
shutup do
assert_nothing_raised do
- f=TestBallWithRealPath.new
+ f = Class.new(TestBall) do
+ def initialize(*)
+ super
+ @path = Pathname.new(__FILE__)
+ end
+ end.new
Homebrew.info_formula f
... | true |
Other | Homebrew | brew | d07defa7c11449a776ab9f5c63f437c576806195.json | Fix specs in TestBall | Library/Homebrew/test/test_formula.rb | @@ -13,12 +13,9 @@ class FormulaTests < Test::Unit::TestCase
include VersionAssertions
def test_prefix
- shutup do
- TestBall.new.brew do |f|
- assert_equal File.expand_path(f.prefix), (HOMEBREW_CELLAR+f.name+'0.1').to_s
- assert_kind_of Pathname, f.prefix
- end
- end
+ f = Test... | true |
Other | Homebrew | brew | d07defa7c11449a776ab9f5c63f437c576806195.json | Fix specs in TestBall | Library/Homebrew/test/test_versions.rb | @@ -3,14 +3,6 @@
require 'test/testball'
require 'version'
-class TestBadVersion < TestBall
- def initialize name=nil
- @stable = SoftwareSpec.new
- @stable.version "versions can't have spaces"
- super 'testbadversion'
- end
-end
-
class VersionComparisonTests < Test::Unit::TestCase
include VersionAs... | true |
Other | Homebrew | brew | d07defa7c11449a776ab9f5c63f437c576806195.json | Fix specs in TestBall | Library/Homebrew/test/testball.rb | @@ -1,10 +1,13 @@
require 'formula'
class TestBall < Formula
- def initialize name=nil
+ def initialize(*)
@homepage = 'http://example.com/'
- @stable ||= SoftwareSpec.new
- @stable.url "file:///#{TEST_FOLDER}/tarballs/testball-0.1.tbz"
+ self.class.instance_eval do
+ @stable ||= SoftwareSpec.n... | true |
Other | Homebrew | brew | 9dda9339ad600e652d80aa41cc9809509454eda7.json | Remove dead code
This is initialized in #initialize. | Library/Homebrew/formula_support.rb | @@ -60,7 +60,6 @@ def version val=nil
end
def mirror val
- @mirrors ||= []
@mirrors << val
end
end | false |
Other | Homebrew | brew | 9013b3a0c9c35411ae8c788ab5e104735a99fde2.json | Define RUBY_PATH for tests | Library/Homebrew/global.rb | @@ -63,9 +63,8 @@ def mkpath
HOMEBREW_LOGS = Pathname.new('~/Library/Logs/Homebrew/').expand_path
-RUBY_CONFIG = RbConfig::CONFIG
-RUBY_BIN = Pathname.new("#{RUBY_CONFIG['bindir']}")
-RUBY_PATH = RUBY_BIN/RUBY_CONFIG['ruby_install_name'] + RUBY_CONFIG['EXEEXT']
+RUBY_BIN = Pathname.new("#{RbConfig::CONFIG['bindir'... | true |
Other | Homebrew | brew | 9013b3a0c9c35411ae8c788ab5e104735a99fde2.json | Define RUBY_PATH for tests | Library/Homebrew/test/testing_env.rb | @@ -12,6 +12,7 @@
require 'extend/string'
require 'exceptions'
require 'utils'
+require 'rbconfig'
# Constants normally defined in global.rb
HOMEBREW_PREFIX = Pathname.new('/private/tmp/testbrew/prefix')
@@ -26,6 +27,9 @@
HOMEBREW_CURL_ARGS = '-fsLA'
HOMEBREW_VERSION = '0.9-test'
+RUBY_BIN =... | true |
Other | Homebrew | brew | 9db0e68eb60b7634eb26f9b734e7b1e47cc3f2ba.json | Unify indentation of access modifiers
These are class method calls, not some special keyword, and should be
indented as such (also all standard Ruby indenters do this). | Library/Homebrew/cmd/list.rb | @@ -23,7 +23,7 @@ def list
end
end
-private
+ private
def list_unbrewed
dirs = HOMEBREW_PREFIX.children.select{ |pn| pn.directory? }.map{ |pn| pn.basename.to_s } | true |
Other | Homebrew | brew | 9db0e68eb60b7634eb26f9b734e7b1e47cc3f2ba.json | Unify indentation of access modifiers
These are class method calls, not some special keyword, and should be
indented as such (also all standard Ruby indenters do this). | Library/Homebrew/dependency_collector.rb | @@ -45,7 +45,7 @@ def build(spec)
parse_spec(spec, tag)
end
-private
+ private
def parse_spec spec, tag
case spec | true |
Other | Homebrew | brew | 9db0e68eb60b7634eb26f9b734e7b1e47cc3f2ba.json | Unify indentation of access modifiers
These are class method calls, not some special keyword, and should be
indented as such (also all standard Ruby indenters do this). | Library/Homebrew/download_strategy.rb | @@ -122,7 +122,8 @@ def stage
end
end
-private
+ private
+
def chdir
entries=Dir['*']
case entries.length
@@ -493,7 +494,8 @@ def stage
end
end
-private
+ private
+
def split_url(in_url)
parts=in_url.sub(%r[^cvs://], '').split(/:/)
mod=parts.pop | true |
Other | Homebrew | brew | 9db0e68eb60b7634eb26f9b734e7b1e47cc3f2ba.json | Unify indentation of access modifiers
These are class method calls, not some special keyword, and should be
indented as such (also all standard Ruby indenters do this). | Library/Homebrew/formula.rb | @@ -528,7 +528,7 @@ def to_hash
end
-protected
+ protected
# Pretty titles the command and buffers stdout/stderr
# Throws if there's an error
@@ -593,7 +593,7 @@ def system cmd, *args
end if removed_ENV_variables
end
-public
+ public
# For brew-fetch and others.
def fetch
@@ -621,7 +6... | true |
Other | Homebrew | brew | 9db0e68eb60b7634eb26f9b734e7b1e47cc3f2ba.json | Unify indentation of access modifiers
These are class method calls, not some special keyword, and should be
indented as such (also all standard Ruby indenters do this). | Library/Homebrew/keg.rb | @@ -171,7 +171,8 @@ def optlink
from.make_relative_symlink(self)
end
-protected
+ protected
+
def resolve_any_conflicts dst
# if it isn't a directory then a severe conflict is about to happen. Let
# it, and the exception that is generated will message to the user about | true |
Other | Homebrew | brew | 9db0e68eb60b7634eb26f9b734e7b1e47cc3f2ba.json | Unify indentation of access modifiers
These are class method calls, not some special keyword, and should be
indented as such (also all standard Ruby indenters do this). | Library/Homebrew/metafiles.rb | @@ -20,7 +20,7 @@ def should_list? file
not include? file
end
-private
+ private
def include? p
p = p.to_s # Might be a pathname | true |
Other | Homebrew | brew | 9db0e68eb60b7634eb26f9b734e7b1e47cc3f2ba.json | Unify indentation of access modifiers
These are class method calls, not some special keyword, and should be
indented as such (also all standard Ruby indenters do this). | Library/Homebrew/patches.rb | @@ -39,7 +39,7 @@ def download!
external_patches.each{|p| p.stage!}
end
-private
+ private
def external_patches
@patches.select{|p| p.external?}
@@ -112,7 +112,7 @@ def curl_args
[@url, '-o', @patch_filename]
end
-private
+ private
# Detect compression type from the downloaded patc... | true |
Other | Homebrew | brew | d6b5e4f2ed856badb572eea2bbc76d2335ec58ab.json | audit: rescue only FormulaUnavailableError | Library/Homebrew/cmd/audit.rb | @@ -130,7 +130,7 @@ def audit_deps
f.deps.each do |dep|
begin
dep_f = dep.to_formula
- rescue
+ rescue FormulaUnavailableError
problem "Can't find dependency #{dep.name.inspect}."
end
| false |
Other | Homebrew | brew | 89bb6664c48c54c3ff281d5b497b8d84143f5549.json | Replace literal paths to ruby with RUBY_PATH | Library/Homebrew/cmd/--config.rb | @@ -107,7 +107,7 @@ def dump_build_config
puts "OS X: #{MACOS_FULL_VERSION}-#{kernel}"
puts "Xcode: #{xcode}" if xcode
puts "CLT: #{clt}" if clt
- puts "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby:\n #{RUBY_VERSION}-#{RUBY_PATCHLEVEL}" if RUBY_VERSION.to_f != 1.8
+ puts "#{... | false |
Other | Homebrew | brew | 64ef95e6761c4afb167fe1e3c6cd8eb4550b1c17.json | Add Kickstarter supporters file. | .gitignore | @@ -3,6 +3,7 @@
!/Library/
!/CONTRIBUTING.md
!/README.md
+!/SUPPORTERS.md
!/bin
/bin/*
!/bin/brew | true |
Other | Homebrew | brew | 64ef95e6761c4afb167fe1e3c6cd8eb4550b1c17.json | Add Kickstarter supporters file. | SUPPORTERS.md | @@ -0,0 +1,382 @@
+# Kickstarter Supporters
+
+This file contains a list of the awesome people who gave £5 or more to
+[our Kickstarter](http://www.kickstarter.com/projects/homebrew/brew-test-bot).
+
+This list is still incomplete as we need addresses for everyone who receives
+a physical reward. Kickstarter recommend... | true |
Other | Homebrew | brew | aa58a404eda3eb4ef1e0f09df8509fba3da5c851.json | Fix another handful of warnings | Library/Homebrew/cmd/bottle.rb | @@ -11,7 +11,6 @@ def keg_contains string, keg
def bottle_formula f
unless f.installed?
return ofail "Formula not installed: #{f.name}"
- return
end
unless built_as_bottle? f | true |
Other | Homebrew | brew | aa58a404eda3eb4ef1e0f09df8509fba3da5c851.json | Fix another handful of warnings | Library/Homebrew/cmd/edit.rb | @@ -38,7 +38,7 @@ def edit
raise FormulaUnavailableError, path.basename('.rb').to_s unless path.file?
end
end
- exec_editor *paths
+ exec_editor(*paths)
end
end
| true |
Other | Homebrew | brew | aa58a404eda3eb4ef1e0f09df8509fba3da5c851.json | Fix another handful of warnings | Library/Homebrew/cmd/home.rb | @@ -3,7 +3,7 @@ def home
if ARGV.named.empty?
exec_browser HOMEBREW_WWW
else
- exec_browser *ARGV.formulae.map{ |f| f.homepage }
+ exec_browser(*ARGV.formulae.map(&:homepage))
end
end
end | true |
Other | Homebrew | brew | aa58a404eda3eb4ef1e0f09df8509fba3da5c851.json | Fix another handful of warnings | Library/Homebrew/cmd/link.rb | @@ -67,7 +67,7 @@ def self.puts str
end
end
- puts_capture.instance_eval &block
+ puts_capture.instance_eval(&block)
ensure
puts unless $did_puts | true |
Other | Homebrew | brew | aa58a404eda3eb4ef1e0f09df8509fba3da5c851.json | Fix another handful of warnings | Library/Homebrew/cmd/uninstall.rb | @@ -12,7 +12,7 @@ def uninstall
keg.unlink
keg.uninstall
rm_opt_link keg.fname
- unpin keg.fname
+ rm_pin keg.fname
end
end
else
@@ -49,7 +49,7 @@ def rm_opt_link name
optlink.unlink if optlink.symlink?
end
- def unpin name
+ def rm_pin... | true |
Other | Homebrew | brew | aa58a404eda3eb4ef1e0f09df8509fba3da5c851.json | Fix another handful of warnings | Library/Homebrew/superenv.rb | @@ -246,6 +246,7 @@ def make_jobs
# This should be a safe hack to prevent that exception cropping up.
# Main consqeuence of this is that ENV['CFLAGS'] is never nil even when it
# is which can break if checks, but we don't do such a check in our code.
+ alias_method :"old_[]", :[]
def [] key
if has_key... | true |
Other | Homebrew | brew | 8234ac22e9c797a6f50ff9bf496bf789fa7bf901.json | FormulaLock: fix uninitialized ivar | Library/Homebrew/formula_lock.rb | @@ -4,6 +4,7 @@ class FormulaLock
def initialize(name)
@name = name
@path = LOCKDIR.join("#{@name}.brewing")
+ @lockfile = nil
end
def lock | false |
Other | Homebrew | brew | 62a0b3f18dc8c52cce89943c82d1a232552e2493.json | Use #grep where it will suffice | Library/Homebrew/cmd/audit.rb | @@ -195,7 +195,7 @@ def audit_urls
urls = [(f.stable.url rescue nil), (f.devel.url rescue nil), (f.head.url rescue nil)].compact
# Check GNU urls; doesn't apply to mirrors
- urls.select { |u| u =~ %r[^(https?|ftp)://(?!alpha).+/gnu/] }.each do |u|
+ urls.grep(%r[^(https?|ftp)://(?!alpha).+/gnu/]).each... | true |
Other | Homebrew | brew | 62a0b3f18dc8c52cce89943c82d1a232552e2493.json | Use #grep where it will suffice | Library/Homebrew/cmd/doctor.rb | @@ -1095,7 +1095,7 @@ def doctor
checks = Checks.new
if ARGV.include? '--list-checks'
- checks.methods.select { |m| m =~ /^check_/ }.sort.each { |m| puts m }
+ checks.methods.grep(/^check_/).sort.each { |m| puts m }
exit
end
@@ -1106,7 +1106,7 @@ def doctor
checks.methods.sort... | true |
Other | Homebrew | brew | 62d25f9c8bb8f0471394bc6dad5d82abb163e1cb.json | Remove obsolete comment about download_strategy
The canonical way to select a custom download strategy is to pass
:using => StrategyClass
as an argument to the url DSL method. | Library/Homebrew/formula.rb | @@ -173,8 +173,6 @@ def build; self.class.build; end
def opt_prefix; HOMEBREW_PREFIX/:opt/name end
- # Use the @active_spec to detect the download strategy.
- # Can be overriden to force a custom download strategy
def download_strategy
@active_spec.download_strategy
end | false |
Other | Homebrew | brew | ae9060fc54faa1ec273b090a3791a5a1cab174dd.json | Remove circular require | Library/Homebrew/formula_pin.rb | @@ -1,4 +1,3 @@
-require 'formula'
require 'fileutils'
class FormulaPin | false |
Other | Homebrew | brew | df29049222308b79a06d7eedfc67a26b90000d99.json | Recognize 7z files by magic bytes, not filename | Library/Homebrew/extend/pathname.rb | @@ -181,20 +181,20 @@ def compression_type
# POSIX tar magic has a 257 byte offset
# magic numbers stolen from /usr/share/file/magic/
case open { |f| f.read(262) }
- when /^PK\003\004/n then :zip
- when /^\037\213/n then :gzip
- when /^BZh/n then :bzip2
- when /^\037\235/n ... | false |
Other | Homebrew | brew | b1bc967f23f32fcd3d12769a635c731089890afc.json | use separate args in brew create | Library/Homebrew/cmd/create.rb | @@ -143,7 +143,7 @@ def install
"--prefix=\#{prefix}"
# system "cmake", ".", *std_cmake_args
<% end %>
- system "make install" # if this fails, try separate make/make install steps
+ system "make", "install" # if this fails, try separate make/make install steps... | false |
Other | Homebrew | brew | 3bceaf8f5e4b771eb1557c5a91a8fb84e62168ad.json | Add test for differing module and import name | Library/Homebrew/test/test_language_module_dependency.rb | @@ -23,6 +23,14 @@ def test_unique_deps_are_not_eql
assert !y.eql?(x)
end
+ def test_differing_module_and_import_name
+ mod_name = "foo"
+ import_name = "bar"
+ l = LanguageModuleDependency.new(:python, mod_name, import_name)
+ assert l.message.include?(mod_name)
+ assert l.the_test.one? { |c|... | false |
Other | Homebrew | brew | 9dd6d74b44d857d9b5906dffd896d4109229b1df.json | Add new tests for fails_with DSL | Library/Homebrew/test/test_fails_with.rb | @@ -0,0 +1,60 @@
+require 'testing_env'
+require 'test/testball'
+
+class FailsWithTests < Test::Unit::TestCase
+ class Double < Compiler
+ attr_accessor :name, :build
+ end
+
+ def assert_fails_with(cc)
+ assert @f.new.fails_with?(cc)
+ end
+
+ def assert_does_not_fail_with(cc)
+ assert !@f.new.fails_wit... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.