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" +#