Coder Social home page Coder Social logo

Comments (3)

bkeepers avatar bkeepers commented on June 18, 2024

Hmm, that's a tricky one. One option is to just load the Rails environment in script/delayed_job, and then depend on the load path for finding the command. The down side is that this would make the command really slow if you were just doing a --help. Any other ideas?

from delayed_job.

tcocca avatar tcocca commented on June 18, 2024

Another issue I just ran into.

When you use gem-plugins (as they are called i believe) - when you convert a plugin to a gem as you have here, and use config.gem to include it in your rails project, the rake tasks do not automatically get included like they do for plugins. You have to explicitly include them.

This being the case I have to create a file under RAILS_ROOT/lib/tasks called delayed_job.rake

the contents of that file are the following:

require File.join(RAILS_ROOT, 'vendor', 'gems', 'collectiveidea-delayed_job-1.8.0', 'tasks', 'tasks')

That basically loads your rake tasks from the gem into the rails rake tasks list so that you can call rake jobs:work or rake jobs:clear

Here is an old lighthouse ticket about this: https://rails.lighthouseapp.com/projects/8994/tickets/59-when-loading-a-plugin-via-rubygems-rake-tasks-aren-t-included-2

I'm not sure if you meant to have your version of delayed_job used in plugin form or gem form, personally I like gems as you can keep track of versioning.

As for the first reported issue,

Is there a way to check the gems included via config.gem? If so I would use that to load the correct path and if it wasn't found I would default to the plugin.

Or if thats not possible looks for a directory in the gems folder matching /delayed_job/ if it is found get the full name of that director and set the require path, otherwise load it from the plugins folder ...

No other good ideas come to mind right now.

~ Tom

from delayed_job.

bkeepers avatar bkeepers commented on June 18, 2024

Rework script/delayed_job so it can be used as a plugin or a gem. Closed by 4d76b8d

from delayed_job.

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.