This repository has been archived by the owner. It is now read-only.
Asynchronous processing with Carrierwave
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.github
lib
.gitignore
.travis.yml
CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Gemfile
Gemfile.lock
INSTALL.md
LICENSE
OWNERS.yaml
README.md
Rakefile
carrierwave-delay.gemspec

README.md

This project has been discontinued.


carrierwave-delay - asynchronous processing with CarrierWave

Gem Version

With carrierwave-delay you can offload version processing of your Carrierwave uploaders to Sidekiq and ActiveJob instances.


Table of Contents


Installation

carrierwave-delay works with Rails 4.0 onwards. You can add it to your Gemfile with:

gem 'carrierwave-delay'

And then execute:

$ bundle

Or install it yourself as:

$ gem install carrierwave-delay

If you always want to be up to date fetch the latest from GitHub in your Gemfile:

gem 'carrierwave-delay', github: 'slooob/carrierwave-delay'

Usage

Start by including CarrierWave::Delay in your uploader class and add is_processing_delayed? as condition to your defined versions:

class ImageUploader < CarrierWave::Uploader::Base
    include CarrierWave::Delay

    version :small, if: :is_processing_delayed? do
        process resize_to_fill: [50, 50]
    end
end

Then, define versions to be processed in your ActiveRecord class:

class Post < ApplicationRecord
    mount_uploader :image, ImageUploader
    mount_uploader :logo, LogoUploader

    carrierwave_delay [:image]
end

Configuration

By adding class methods to your model, you are able to configure queue and priority of your background tasks:

class Post < ApplicationRecord
    mount_uploader :image, ImageUploader
    mount_uploader :logo, LogoUploader

    carrierwave_delay [:image]

    def self.carrierwave_delay_queue
        :carrierwave # defaults to `:default`
    end
    def self.carrierwave_delay_priority
        10 # defaults to `20`
    end
end

To Do

  • Leave your suggestions here

Contributing

We hope that you will consider contributing to carrierwave-delay. Please read this short overview for some information about how to get started:

Learn more about contributing to this repository, Code of Conduct

Contributors

Give the people some ❤️ who are working on this project. See them all at:

https://github.com/slooob/carrierwave-delay/graphs/contributors

Semantic Versioning

carrierwave-delay follows Semantic Versioning 2.0 as defined at http://semver.org.

License

MIT License

Copyright (c) 2017 Slooob

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.