Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions bin/whenever
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ OptionParser.new do |opts|
options[:clear] = true
options[:identifier] = identifier if identifier
end
opts.on('-a', '--clear-all-flags-crontab') do |identifier|
Copy link
Contributor

@olleolleolle olleolleolle Dec 15, 2016

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.

options[:clear_all] = true
end
opts.on('-s', '--set [variables]', 'Example: --set \'environment=staging&path=/my/sweet/path\'') do |set|
options[:set] = set if set
end
Expand Down
12 changes: 11 additions & 1 deletion lib/whenever/command_line.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Include "clear_all" in this warn message.

exit(1)
end
Expand All @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The 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
Expand Down
2 changes: 1 addition & 1 deletion lib/whenever/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Whenever
VERSION = '0.9.4'
VERSION = '0.9.5'
Copy link
Contributor

Choose a reason for hiding this comment

The 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