Giter Club home page Giter Club logo

delayed-web's Introduction

Delayed::Web for Delayed::Job

Build Status

A rails engine that provides a simple web interface for exposing the Delayed::Job queue.

Requirements

  • Ruby 2.2.x, 2.3.x
  • Rails 3.2.x, 4.0.x, 4.1.x, 4.2.x, 5.0.x, 6.x
  • Delayed::Job 3.0.x, 4.0.x
  • ActiveRecord or Mongoid

Installation

Put this in your Gemfile.

gem 'delayed-web'

Run bundler.

bundle install

Run the installation generator.

rails generate delayed:web:install

This will install an initializer into config/initializers/delayed_web.rb, mount the engine at /jobs in config/routes.rb and add the stylesheets to the list of precomiled assets in application.rb (If assets are enabled).

Routes

The installation script will automatically add routes into your app, like this.

# config/routes.rb
Rails.application.routes.draw do
  mount Delayed::Web::Engine, at: '/jobs'
end

This will mount the following routes.

GET /
GET /jobs
GET /jobs/:id

Authentication

Out of the box Delayed::Web doesn't make any assumptions about authentication. It's possible to take advantage of rails routing constraints or rack middleware.

An example using Devise's authenticated constraint.

# config/routes.rb
authenticated :user, -> user { user.admin? } do
  mount Delayed::Web::Engine, at: '/jobs'
end

An example using Rack::Auth::Basic.

# config/routes.rb
Delayed::Web::Engine.middleware.use Rack::Auth::Basic do |username, password|
  username == ENV['USERNAME'] && password == ENV['PASSWORD']
end

Backend

The installation script will automatically set the backend you're using for Delayed::Job, like this.

# config/initializers/delayed_web.rb
Rails.application.config.to_prepare do
  Delayed::Web::Job.backend = 'active_record'
end

Currently supported backends are 'active_record' and mongoid'. Patches are always welcome.

Asset Pipeline

The installation script will automatically add the engine's assets to your application's list of precompiled assets.

# config/application.rb
config.assets.enabled = true
config.assets.precompile << 'delayed/web/application.css'

This step is skipped if your project is configured not to use the asset pipeline.

I18n

If you want to translate flash messages, titles, or sentences you can set your own I18n translations to override defaults one:

en:
  delayed/web:
    views:
      id: ID
      status: Status
      created_at: Created At
      run_at: Run At
      attempts: Attempts
      last_error: Last Error

๐Ÿ‡ฌ๐Ÿ‡ง English, ๐Ÿ‡ช๐Ÿ‡ธ Spanish, ๐Ÿ‡ซ๐Ÿ‡ท French, ๐Ÿ‡ฉ๐Ÿ‡ช German, and ๐Ÿ‡ง๐Ÿ‡ท Portuguese are supported. You can find the full list here.

Developing Locally

After you've cloned the repository, run bundler.

bundle install

Make sure the specs are passing.

rake

Run the dummy rails app.

cd spec/dummy
rails s

Go to http://localhost:3000.

The dummy rails app uses Delayed::Web::Job::Double as its backend. It is an in-memory double of a real Delayed::Job.

Special Thanks

We're grateful for all our contributors, but we're especially grateful for contributions by the following people:

License

Released under the MIT license. See LICENSE.

delayed-web's People

Contributors

tatey avatar anthony-robin avatar cseelus avatar coop avatar jafuentest avatar dpedoneze avatar jayphen avatar mfbmina avatar razvan-pavel avatar pstaender avatar scottrobertson avatar

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.