Class: RsyncCron::CLI
- Inherits:
-
Object
- Object
- RsyncCron::CLI
- Defined in:
- lib/rsync_cron/cli.rb
Constant Summary collapse
- SHELL =
`which crontab`.strip
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(args, io = STDOUT, shell = SHELL) ⇒ CLI
constructor
A new instance of CLI.
Constructor Details
Instance Method Details
#call ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rsync_cron/cli.rb', line 18 def call parser.parse!(@args) return @io.puts "specify valid src" unless @src return @io.puts "specify valid dest" unless @dest command = Command.new(src: @src, dest: @dest, log: @log, io: @io) return unless command.valid? if @check crontab = "#{@cron} #{command}" return @io.puts crontab unless @shell Installer.new(crontab, @shell).call.tap do |res| @io.puts "new crontab installed" if res end end |