A Crystal library for creating command line tasks to be used with the LuckyCli.
-
Add the dependency to your
shard.yml
:dependencies: lucky_task: github: luckyframework/lucky_task
-
Run
shards install
Create a file tasks.cr
at the root of your project
require "lucky_task"
# Using `lucky` from the command line will do nothing if you forget this
LuckyTask::Runner.run
Create a tasks
directory in the root of your project.
Update your tasks.cr
file to require all files within that directory for them to be registered with the CLI.
# tasks.cr
require "lucky_task"
require "./tasks/*"
In the directory create a file called send_daily_notifications.cr
.
class SendDailyNotifications < LuckyTask::Task
summary "Send notifications to users"
# Name is inferred from class name ("send_daily_notifications")
# It can be overridden:
#
# task_name "app.send_daily_notifications"
def call
# Code that sends notifications to all your users...
end
end
- Fork it (https://github.com/luckyframework/lucky_task/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
- matthewmcgarvey - creator and maintainer