Comments (4)
Patch in text (just replacing each filter_map {...}
with map {...}.compact
:
diff --git a/lib/bundle/brew_dumper.rb b/lib/bundle/brew_dumper.rb
index 45b95c7..4803f92 100644
--- a/lib/bundle/brew_dumper.rb
+++ b/lib/bundle/brew_dumper.rb
@@ -143,8 +143,7 @@ module Bundle
installed_as_dependency = tab.installed_as_dependency
installed_on_request = tab.installed_on_request
runtime_dependencies = if (runtime_deps = tab.runtime_dependencies)
- runtime_deps.filter_map { |d| d["full_name"] }
-
+ runtime_deps.map { |d| d["full_name"] }.compact
end
poured_from_bottle = tab.poured_from_bottle
end
@@ -205,13 +204,13 @@ module Bundle
# Step 2: Sort by formula dependency topology.
topo = Topo.new
formulae.each do |f|
- topo[f[:name]] = topo[f[:full_name]] = f[:dependencies].filter_map do |dep|
+ topo[f[:name]] = topo[f[:full_name]] = f[:dependencies].map do |dep|
ff = formulae_by_name(dep)
next if ff.blank?
next unless ff[:any_version_installed?]
ff[:full_name]
- end
+ end.compact
end
@formulae = topo.tsort
.map { |name| @formulae_by_full_name[name] || @formulae_by_name[name] }
diff --git a/lib/bundle/brew_installer.rb b/lib/bundle/brew_installer.rb
index 2b4d12d..b8b72f0 100644
--- a/lib/bundle/brew_installer.rb
+++ b/lib/bundle/brew_installer.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: true
+# frozen_string_literal: true.compact
module Bundle
class BrewInstaller
@@ -172,19 +172,19 @@ module Bundle
end
def self.outdated_formulae
- @outdated_formulae ||= formulae.filter_map { |f| f[:name] if f[:outdated?] }
+ @outdated_formulae ||= formulae.map { |f| f[:name] if f[:outdated?] }.compact
end
def self.pinned_formulae
- @pinned_formulae ||= formulae.filter_map { |f| f[:name] if f[:pinned?] }
+ @pinned_formulae ||= formulae.map { |f| f[:name] if f[:pinned?] }.compact
end
def self.linked_and_keg_only_formulae
- @linked_and_keg_only_formulae ||= formulae.filter_map { |f| f[:name] if f[:link?] == true }
+ @linked_and_keg_only_formulae ||= formulae.map { |f| f[:name] if f[:link?] == true }.compact
end
def self.unlinked_and_not_keg_only_formulae
- @unlinked_and_not_keg_only_formulae ||= formulae.filter_map { |f| f[:name] if f[:link?] == false }
+ @unlinked_and_not_keg_only_formulae ||= formulae.map { |f| f[:name] if f[:link?] == false }.compact
end
def self.formulae
diff --git a/lib/bundle/brew_services.rb b/lib/bundle/brew_services.rb
index c5fad23..47cd14b 100644
--- a/lib/bundle/brew_services.rb
+++ b/lib/bundle/brew_services.rb
@@ -38,12 +38,12 @@ module Bundle
def started_services
@started_services ||= if Bundle.services_installed?
states_to_skip = %w[stopped none]
- Utils.safe_popen_read(HOMEBREW_BREW_FILE, "services", "list").lines.filter_map do |line|
+ Utils.safe_popen_read(HOMEBREW_BREW_FILE, "services", "list").lines.map do |line|
name, state, _plist = line.split(/\s+/)
next if states_to_skip.include? state
name
- end
+ end.compact
else
[]
end
diff --git a/lib/bundle/cask_installer.rb b/lib/bundle/cask_installer.rb
index 345ea3e..2e194a1 100644
--- a/lib/bundle/cask_installer.rb
+++ b/lib/bundle/cask_installer.rb
@@ -37,7 +37,7 @@ module Bundle
return Bundle.system HOMEBREW_BREW_FILE, "upgrade", "--cask", full_name, verbose: verbose
end
- args = options.fetch(:args, []).filter_map do |k, v|
+ args = options.fetch(:args, []).map do |k, v|
case v
when TrueClass
"--#{k}"
@@ -46,7 +46,7 @@ module Bundle
else
"--#{k}=#{v}"
end
- end
+ end.compact
args << "--force" if force
args.uniq!
from homebrew-bundle.
given that this is for Catalina which only makes up 0.68% of total usage over the last 30d, i'm hesitant to leave this old Ruby laying around for the sake of old Mac installs. the newer Ruby approach is much cleaner and concise as to the purpose of it and i feel this patch takes away some of that.
is there a reason you cannot upgrade? as it stands, you may need to fork homebrew-bundle
to continue running your patch.
from homebrew-bundle.
No, the freeze started with Catalina, but even the latest macOS comes with the same version:
I get this on 13.6.4 (Ventura) and Sonoma too:
❯ /usr/bin/ruby --version
ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.arm64e-darwin23]
Another thing that confuses me is that I already have 3.3 installed and in my $PATH
. It just doesn't seem to get picked up.
from homebrew-bundle.
You shouldn't need old Ruby even on Catalina. We supply Homebrew's portable Ruby for this. You need to brew update
and, if homebrew-bundle is still broken, supply your brew config
and brew doctor
output here.
from homebrew-bundle.
Related Issues (20)
- Qs on merging Brewfiles. HOT 2
- [Feature] Support groups HOT 1
- Error: cannot load such file -- abstract_command HOT 2
- Collection of potential new Installers/Checkers/Dumpers HOT 12
- npm & pip installers HOT 16
- Vscode : Case sensitive issue is back HOT 6
- [Question] Can formula and cask have the same name? HOT 4
- brew bundle dump spawns many ruby processes HOT 12
- Unattended install of a bundle HOT 4
- how to install only on specified macOS version or arch of OS HOT 1
- brew bundle [install] --cleanup removes dependencies when reading from stdin HOT 4
- Confusion on what should be dumped HOT 1
- VSCode@Insiders Support for Extensions HOT 6
- Error: private method `system' called for module Homebrew HOT 9
- `brew bundle cleanup`: exit nonzero if action would be taken (or flag to opt into nonzero exit code) HOT 2
- Linuxbrew: Error: End of file reached (brew update && brew upgrade)
- Error: Invalid Brewfile: no implicit conversion of Symbol into Integer HOT 1
- Add ability to provide context to what is being installed/updated HOT 7
- Improve `vscode` handling of local extensions HOT 5
- link and conflicts_with options do not work as expected
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from homebrew-bundle.