Giter Club home page Giter Club logo

Comments (4)

anujmore-grabtaxi avatar anujmore-grabtaxi commented on June 2, 2024

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.

jacobbednarz avatar jacobbednarz commented on June 2, 2024

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.

anujmore-grabtaxi avatar anujmore-grabtaxi commented on June 2, 2024

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.

MikeMcQuaid avatar MikeMcQuaid commented on June 2, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.