Code Monkey home page Code Monkey logo

audited-deferrable's Introduction

audited-deferrable

Extension to the audited gem to defer writing of audits via Resque, but with modular architecture to support adding other providers such as sidekiq and delayed job (pull requests, please!)

NOTE: This currently only works with Resque v1, not Resque v2 which is a different API. I'd gladly accept pull requests supporting both.

Usage:

In Gemfile:

gem "audited-activerecord", "~> 3.0.0"
gem "resque", "~> 1.24"
gem "audited-deferrable", "~> 0.1.0"

In an initializer (config/initializers/audited.rb):

Audited.defer_with = :resque

After this, all of your audits will be written to the resque queue, and to complete them you'll need to run a resque worker:

$ QUEUE=audited rake environment resque:work

Configuration

By default, the resque queue is set to :audited, but can be changed:

Audited::Deferrable::Resque.queue = :custom_queue

Custom Handlers

If you want to write a handler for sidekiq or delayed job, please fork the project and implement as a subclass of Audited::Deferrable::Base, then send a pull request so all can use.

A completely custom handler can be implemented outside of the gem by subclassing Audited::Deferrable::Base, then setting that class to defer_with directly:

class Audited::Deferrable::CustomProvider < Audited::Deferrable::Base
  ...
end

Audited.defer_with = Audited::Deferrable::CustomProvider

audited-deferrable's People

Contributors

rubiety avatar

Watchers

 avatar  avatar

audited-deferrable's Issues

License missing from gemspec

Some companies will only use gems with a certain license.
The canonical and easy way to check is via the gemspec
via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

There is even a License Finder to help companies ensure all gems they use
meet their licensing needs. This tool depends on license information being available in the gemspec.
Including a license in your gemspec is a good practice, in any case.

How did I find you?

I'm using a script to collect stats on gems, originally looking for download data, but decided to collect licenses too,
and make issues for missing ones as a public service :)
https://gist.github.com/bf4/5952053#file-license_issue-rb-L13 So far it's going pretty well

Fails on Destroys (Object Doesn't Exist)

Audited::Deferrable::Base#from_arguments (entry-point for doing a chunk of work) fails because the object itself no longer exists in the case of deletes.

This is a fundamental design flaw; can't necessarily rely on an actual object reference within the class, must maintain type/id without dereferencing.

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.