All Projects → Ebbe → arask

Ebbe / arask

Licence: MIT License
Automatic RAils taSKs.

Programming Languages

ruby
36898 projects - #4 most used programming language
HTML
75241 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to arask

superglue
A productive library for Classic Rails, React and Redux
Stars: ✭ 106 (+241.94%)
Mutual labels:  ruby-gem, ruby-on-rails
request store-sidekiq
Provides an easy integration between RequestStore and Sidekiq
Stars: ✭ 32 (+3.23%)
Mutual labels:  ruby-gem, ruby-on-rails
activerecord-crate-adapter
Ruby on Rails ActiveRecord adapter for CrateDB
Stars: ✭ 27 (-12.9%)
Mutual labels:  ruby-gem, ruby-on-rails
Mailjet Gem
[API v3] Mailjet official Ruby GEM
Stars: ✭ 119 (+283.87%)
Mutual labels:  ruby-gem, ruby-on-rails
mobility-actiontext
Translate Rails Action Text rich text with Mobility.
Stars: ✭ 27 (-12.9%)
Mutual labels:  ruby-gem, ruby-on-rails
Rorvswild
Ruby on Rails app monitoring: performances & exceptions insights for rails developers.
Stars: ✭ 159 (+412.9%)
Mutual labels:  ruby-gem, ruby-on-rails
activerecord-setops
Union, Intersect, and Difference set operations for ActiveRecord (also, SQL's UnionAll).
Stars: ✭ 21 (-32.26%)
Mutual labels:  ruby-gem, ruby-on-rails
Motion
Reactive frontend UI components for Rails in pure Ruby
Stars: ✭ 498 (+1506.45%)
Mutual labels:  ruby-gem, ruby-on-rails
has placeholder image
A Ruby gem for generating string based placeholder images in Rails.
Stars: ✭ 20 (-35.48%)
Mutual labels:  ruby-gem, ruby-on-rails
eight ball
Ruby gem for querying feature flags
Stars: ✭ 17 (-45.16%)
Mutual labels:  ruby-gem, ruby-on-rails
Sidekiq Cron
Scheduler / Cron for Sidekiq jobs
Stars: ✭ 1,383 (+4361.29%)
Mutual labels:  ruby-gem, ruby-on-rails
slack widgets
An abstraction of the JSON structure needed to create widgets in Slack message attachments
Stars: ✭ 14 (-54.84%)
Mutual labels:  ruby-gem, ruby-on-rails
Ransack
Object-based searching.
Stars: ✭ 5,020 (+16093.55%)
Mutual labels:  ruby-gem, ruby-on-rails
Filestack Rails
Official Ruby on Rails plugin for Filestack File Picker that makes it easy to add powerful file uploading and transformation capabilities to any web or mobile application.
Stars: ✭ 220 (+609.68%)
Mutual labels:  ruby-gem, ruby-on-rails
React on rails
Integration of React + Webpack + Rails + rails/webpacker including server-side rendering of React, enabling a better developer experience and faster client performance.
Stars: ✭ 4,815 (+15432.26%)
Mutual labels:  ruby-gem, ruby-on-rails
wor-authentication
Gem to add authentication to your application using JWT, with expirable, renewable and customizable tokens!
Stars: ✭ 63 (+103.23%)
Mutual labels:  ruby-gem, ruby-on-rails
Cloudinary gem
Cloudinary GEM for Ruby on Rails integration
Stars: ✭ 394 (+1170.97%)
Mutual labels:  ruby-gem, ruby-on-rails
Matestack Ui Core
Matestack enables you to create sophisticated, reactive UIs in pure Ruby, without touching JavaScript and HTML. You end up writing 50% less code while increasing productivity, maintainability and developer happiness.
Stars: ✭ 469 (+1412.9%)
Mutual labels:  ruby-gem, ruby-on-rails
tag columns
Fast & simple Rails ActiveRecord model tagging using PostgreSQL's Array datatype
Stars: ✭ 40 (+29.03%)
Mutual labels:  ruby-gem, ruby-on-rails
rails cursor pagination
Add cursor pagination to your ActiveRecord backed application
Stars: ✭ 21 (-32.26%)
Mutual labels:  ruby-gem, ruby-on-rails

Arask

Gem Version Build Status Coverage Status

Automatic RAils taSKs (with minimal setup).

No need to setup anything outside of Rails. If Rails is running, so is Arask. If Rails has been stopped, the next time rails starts, Arask will go through overdue jobs and perform them.

Use cron syntax or simply define the interval.

Installation

Add this line to your application's Gemfile:

gem 'arask'

Execute:

$ bundle install
$ rails generate arask:install
$ rails db:migrate

Setup your tasks in config/initializers/arask.rb. Initially it looks like this.

Usage

After installation, you can edit config/initializers/arask.rb with your tasks.

Examples of jobs in the initializer

# Rake tasks with cron syntax
arask.create task: 'send:logs', cron: '0 2 * * *' # At 02:00 every day
arask.create task: 'update:cache', cron: '*/5 * * * *' # Every 5 minutes

# Scripts with interval (when time of day or month etc doesn't matter)
arask.create script: 'puts "IM ALIVE!"', interval: :daily
arask.create task: 'my:awesome_task', interval: :hourly
arask.create task: 'my:awesome_task', interval: 3.minutes

# Run an ActiveJob.
arask.create job: 'ImportCurrenciesJob', interval: 1.month

# Only run on production
arask.create script: 'Attachment.process_new', interval: 5.hours if Rails.env.production?

# Run first time. If the job didn't exist already when starting rails, run it:
arask.create script: 'Attachment.process_new', interval: 5.hours, run_first_time: true

# On exceptions, send email with details
arask.on_exception email: '[email protected]'

# Run code on exceptions
arask.on_exception do |exception, arask_job|
  MyExceptionHandler.new(exception)
end

About cron

Arask uses fugit to parse cron and get next execution time. It follows normal cron syntax. You can test your cron at https://crontab.guru/.

Not supported is @reboot.

About interval

The interval starts when the task has started running. If a task with the interval :hourly is run at 08:37PM, then it will run the next time at 09:37PM.

Todos

  • Have a "try again" feature. For instance arask.create script: 'raise "I failed"', interval: :daily, fail_retry: 5.minutes, retry_at_most: 2
  • Be able to specify line and number that failed for an exception:
file,line,_ = caller.first.split(':')
fileline = File.readlines(file)[line.to_i - 1].strip

Special environments

Heroku

Nothing special to setup. But if you use a hobby dyno and it falls to sleep, so will Arask. As soon as the dyno wakes up, Arask will run any pending jobs.

Docker

Nothing special to setup.

Caveats

If you reload a database dump, your jobs could be run again.

Contributing

Please use https://github.com/Ebbe/arask

Running tests

$ bundle install
$ bundle exec rake test

License

The gem is available as open source under the terms of the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].