Giter VIP home page Giter VIP logo

Comments (8)

Bartuz avatar Bartuz commented on June 12, 2024 1

In our case (our case = no rails but activesupport/railties) script fails on Rails.logger.extend so kind of ugly hot-fix would be changing

   begin
        require "rails"
      rescue LoadError
        # Not a Rails application.
      end

to

   class OnlyActiveSupportDetected < LoadError; end

   begin
        require "rails"
        raise OnlyActiveSupportDetected if Rails.logger.blank?
      rescue LoadError, OnlyActiveSupportDetected
        # Not a Rails application.
    end

but it's ugly and I don't like it and it can still produce False-Positives (less than before of course, so that's good) but there could be more false-negatives (i.e. Rails apps that have no .logger assigned? Is it possible? I don't know).

from racecar.

Bartuz avatar Bartuz commented on June 12, 2024

Our temporary fix which apparently does not break anything

#kafka_setup.rb

Racecar::RailsConfigFileLoader.class_eval do
  def self.load!
    $stderr.puts "=> Skipping rails detection as monkeypatch in kafka_setup.rb..."
  end
end

and include this file in bundle exec racecar --require kafka_setup.rb

from racecar.

dasch avatar dasch commented on June 12, 2024

Can you figure out a better way of detecting Rails?

from racecar.

simonireilly avatar simonireilly commented on June 12, 2024

Plus one for a fix on this - using racecar with ActiveRecord and no rails

from racecar.

dasch avatar dasch commented on June 12, 2024

How about a --no-rails flag that disables Rails booting?

from racecar.

mensfeld avatar mensfeld commented on June 12, 2024

Lets share some friendly knowledge and advise :) why not like that? https://github.com/karafka/karafka/blob/master/lib/karafka/cli/install.rb#L31

from racecar.

dasch avatar dasch commented on June 12, 2024

If it works! ❤️

Anyone up for doing a PR?

from racecar.

mensfeld avatar mensfeld commented on June 12, 2024

Works really well for "us". Also allows to determine that you have rails in the stack (I don't expect anyone sane to include it and not use it at all) prior to being loaded.

from racecar.

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.