-
Notifications
You must be signed in to change notification settings - Fork 726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
option to clear all releases from crontab #613
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ def initialize(options={}) | |
exit(1) | ||
end | ||
|
||
if [@options[:update], @options[:write], @options[:clear]].compact.length > 1 | ||
if [@options[:update], @options[:write], @options[:clear], options[:clear_all]].compact.length > 1 | ||
warn("[fail] Can only update, write or clear. Choose one.") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Include "clear_all" in this warn message. |
||
exit(1) | ||
end | ||
|
@@ -33,6 +33,16 @@ def initialize(options={}) | |
def run | ||
if @options[:update] || @options[:clear] | ||
write_crontab(updated_crontab) | ||
elsif @options[:clear_all] | ||
# Create a file if doesn't exist | ||
system "crontab -l | sed 's/>/>>/' | crontab - " | ||
# Remove crontab | ||
system "crontab -r" | ||
# Reinitilize | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reinitilize => Reinitialize |
||
system "crontab -l | sed 's/>/>>/' | crontab - " | ||
|
||
puts '[reset] Success to reboot crontab' | ||
exit(0) | ||
elsif @options[:write] | ||
write_crontab(whenever_cron) | ||
else | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Whenever | ||
VERSION = '0.9.4' | ||
VERSION = '0.9.5' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't bump version in a PR to add something. The bumping of the version is a part of the release process. |
||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
opts.on
takes a third argument which is the user-visible documentation string for this option. Include one here.We don't use the block argument, so I think you should remove it from this block.