Project

cronut

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
A simple cron parser
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.14
~> 10.0
~> 3.0
 Project Readme

Cronut

Build Status Gem Version

Cronut is a tool for taking a cron expression (e.g. * * * * * /bin/yes) and outputting the times at which that cron expression will run. It supports most standard Vixie cron syntax, with some exceptions – see known issues.

Installation

  1. Ensure you have Ruby 2.3 or higher installed
  2. Run gem install cronut

Usage

There are two ways to use Cronut:

As a command-line tool

To use Cronut as a command-line tool and get human-readable representations of a cron expression, simply run:

cronut <your_cron_expression>

For example:

cronut '*/15 0 1,15 * 1-5 /usr/bin/find'

will output:

minute        0 15 30 45
hour          0
day of month  1 15
month         1 2 3 4 5 6 7 8 9 10 11 12
day of week   1 2 3 4 5
command       /usr/bin/find

As a library

After you've required Cronut in your application (via require 'cronut' or your Gemfile), it can be used like so:

expression = Cronut::Expression.new('* * * * * /bin/yes')
=> #<Cronut::Expression:0x007f975d06c8d0>

expression.weekday.possibilities
=> [0, 1, 2, 3, 4, 5, 6]

expression.command
=> "/bin/yes"

Known Issues

The following (largely non-standard) features of some cron parsers are currently unsupported:

  1. Shorthand macros (e.g. @yearly, @monthly, @daily)
  2. Compositions of lists, ranges and steps (e.g. 1-2,3,*/4)
  3. Alternative single values for months (e.g. JAN, DEC)
  4. Alternative single values for weekdays (e.g. MON, SUN)

Development

To work on Cronut:

  1. Clone this repository
  2. Run bundle install
  3. Run the tests using rake

CI

Tests are run on Drone against recent versions of Ruby.

The configuration file – .drone.yml – is automatically generated via Jsonnet.

Do not edit it directly; make your changes to .drone.jsonnet and then run rake generate_drone_yml.

License

This project is licensed under the MIT License.

Contribution Guidelines

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.