Skip to content

Commit

Permalink
feat(): add delayed job recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
ldlsegovia committed Feb 19, 2016
1 parent d1629c5 commit ccddb80
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ The following optional integrations are added too:
- [ActiveAdmin](http://activeadmin.info) for admin interfaces.
- [ActiveAdminAddons](https://github.com/platanus/activeadmin_addons) for some help with ActiveAdmin.
- [Pundit](https://github.com/elabs/pundit) for role-based authorization.
- [DelayedJob](https://github.com/collectiveidea/delayed_job) to execute longer tasks in the background.

A few more things are added to the project:

Expand Down
5 changes: 4 additions & 1 deletion lib/potassium/templates/application/assets/README.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,7 @@ For managing uploads, this project uses [Paperclip](https://github.com/thoughtbo
<% end-%>
### Admin
As a way to speed up development of an admin interface, we're using [ActiveAdmin](https://github.com/activeadmin/activeadmin)

<% if selected?(:delayed_job) %>
### Queue System
For managing tasks in the background, this project uses [DelayedJob](https://github.com/collectiveidea/delayed_job)
<% end-%>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
use_delayed_job = Ask.confirm "Do you want to use delayed jobs?"
set(:delayed_job, use_delayed_job)
17 changes: 17 additions & 0 deletions lib/potassium/templates/application/recipes/delayed_job.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
if selected?(:delayed_job)
gather_gem "daemons"
gather_gem "delayed_job_active_record"

delayed_job_config = "config.active_job.queue_adapter = :delayed_job"
application(delayed_job_config)

after(:gem_install) do
generate "delayed_job:active_record"

if selected?(:heroku)
gsub_file "Procfile", /^.*$/m do |match|
"#{match}worker: bundle exec rake jobs:work"
end
end
end
end
2 changes: 2 additions & 0 deletions lib/potassium/templates/application/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
eval_file "recipes/asks/database.rb"
eval_file "recipes/asks/devise.rb"
eval_file "recipes/asks/admin.rb"
eval_file "recipes/asks/delayed_job.rb"
eval_file "recipes/asks/pundit.rb"
eval_file "recipes/asks/i18n.rb"
eval_file "recipes/asks/api.rb"
Expand All @@ -33,6 +34,7 @@
eval_file "recipes/devise.rb"
eval_file "recipes/admin.rb"
eval_file "recipes/angular_admin.rb"
eval_file "recipes/delayed_job.rb"
eval_file "recipes/pundit.rb"
eval_file "recipes/testing.rb"
eval_file "recipes/production.rb"
Expand Down

0 comments on commit ccddb80

Please sign in to comment.