Repository: rails/rails
File: railties/lib/rails/generators/app_base.rb (Ruby)

Code before:
        using_js_runtime? && !%w[bun].include?(options[:javascript])
      end

      def using_bun?
        using_js_runtime? && %w[bun].include?(options[:javascript])
      end

      def node_version
        if using_node?
          ENV.fetch("NODE_VERSION") do
            `node --version`[/\d+\.\d+\.\d+/]
          rescue
            NODE_LTS_VERSION
          end
        end
      end

      def dockerfile_yarn_version
        using_node? and `yarn --version`[/\d+\.\d+\.\d+/]
      rescue
        "latest"
      end

      def yarn_through_corepack?
        true if dockerfile_yarn_version == "latest"
        dockerfile_yarn_version.to_s.split(".").first.to_i >= 2
      end

      def dockerfile_bun_version
        using_bun? and `bun --version`[/\d+\.\d+\.\d+/]
      rescue
        BUN_VERSION
      end

      def dockerfile_binfile_fixups
        # binfiles may have OS specific paths to ruby.  Normalize them.
        shebangs = Dir["bin/*"].map { |file| IO.read(file).lines.first }.join
        rubies = shebangs.scan(%r{#!/usr/bin/env (ruby.*)}).flatten.uniq

        binfixups = (rubies - %w(ruby)).map do |ruby|
          "sed -i 's/#{Regexp.quote(ruby)}$/ruby/' bin/*"
        end

        # Windows line endings will cause scripts to fail.  If any
        # or found OR this generation is run on a windows platform
        # and there are other binfixups required, then convert
        # line endings.  This avoids adding unnecessary fixups if
        # none are required, but prepares for the need to do the
        # fix line endings if other fixups are required.
        has_cr = Dir["bin/*"].any? { |file| IO.read(file).include? "\r" }
        if has_cr || (Gem.win_platform? && !binfixups.empty?)

Review comment (suggestion):
```suggestion
        dockerfile_yarn_version >= "2"
```

Code after:
        using_js_runtime? && !%w[bun].include?(options[:javascript])
      end

      def using_bun?
        using_js_runtime? && %w[bun].include?(options[:javascript])
      end

      def node_version
        if using_node?
          ENV.fetch("NODE_VERSION") do
            `node --version`[/\d+\.\d+\.\d+/]
          rescue
            NODE_LTS_VERSION
          end
        end
      end

      def dockerfile_yarn_version
        using_node? and `yarn --version`[/\d+\.\d+\.\d+/]
      rescue
        "latest"
      end

      def yarn_through_corepack?
        true if dockerfile_yarn_version == "latest"
        dockerfile_yarn_version >= "2"
      end

      def dockerfile_bun_version
        using_bun? and `bun --version`[/\d+\.\d+\.\d+/]
      rescue
        BUN_VERSION
      end

      def dockerfile_binfile_fixups
        # binfiles may have OS specific paths to ruby.  Normalize them.
        shebangs = Dir["bin/*"].map { |file| IO.read(file).lines.first }.join
        rubies = shebangs.scan(%r{#!/usr/bin/env (ruby.*)}).flatten.uniq

        binfixups = (rubies - %w(ruby)).map do |ruby|
          "sed -i 's/#{Regexp.quote(ruby)}$/ruby/' bin/*"
        end

        # Windows line endings will cause scripts to fail.  If any
        # or found OR this generation is run on a windows platform
        # and there are other binfixups required, then convert
        # line endings.  This avoids adding unnecessary fixups if
        # none are required, but prepares for the need to do the
        # fix line endings if other fixups are required.
        has_cr = Dir["bin/*"].any? { |file| IO.read(file).include? "\r" }
        if has_cr || (Gem.win_platform? && !binfixups.empty?)