From 20217b0c8ab7b8170c3a299473fd3fb3c9bd19b0 Mon Sep 17 00:00:00 2001 From: Dzmitry Plashchynski Date: Mon, 2 Mar 2015 21:43:47 +0200 Subject: [PATCH] Add install generator --- .../periodicity/install/install_generator.rb | 12 ++++++++++++ .../periodicity/install/templates/periodicity.rb.erb | 9 +++++++++ 2 files changed, 21 insertions(+) create mode 100644 lib/generators/periodicity/install/install_generator.rb create mode 100644 lib/generators/periodicity/install/templates/periodicity.rb.erb diff --git a/lib/generators/periodicity/install/install_generator.rb b/lib/generators/periodicity/install/install_generator.rb new file mode 100644 index 0000000..dfae31b --- /dev/null +++ b/lib/generators/periodicity/install/install_generator.rb @@ -0,0 +1,12 @@ +module Periodicity + module Generators + class InstallGenerator < ::Rails::Generators::Base + desc "Installs periodicity and generates the necessary configuration files" + source_root File.expand_path("../templates", __FILE__) + + def copy_config + template 'periodicity.rb.erb', 'config/initializers/periodicity.rb' + end + end + end +end diff --git a/lib/generators/periodicity/install/templates/periodicity.rb.erb b/lib/generators/periodicity/install/templates/periodicity.rb.erb new file mode 100644 index 0000000..b4e493d --- /dev/null +++ b/lib/generators/periodicity/install/templates/periodicity.rb.erb @@ -0,0 +1,9 @@ +# Periodicity configuration file +# +# Here you can specify periodic jobs and their schedule. +# You can specify a periodic job as a ActiveJob class in `app/jobs/` +# Actually you can use any class. The only requirement is that +# the class should implement a method `perform` without arguments. +# +# TestJob.perform_every 2.days, at: "15:30" +#