module NotTooLate::Command

Public Class Methods

get_time_travel() click to toggle source
# File lib/not_too_late/command.rb, line 9
def get_time_travel
  config = Config.read
  config['time_travel']
end
init_config() click to toggle source
# File lib/not_too_late/command.rb, line 4
def init_config
  puts "initiaize config file"
  Config.write({'time_travel' => 0})
end
set_time_travel(new_time) click to toggle source
# File lib/not_too_late/command.rb, line 14
def set_time_travel(new_time)
  config = Config.read

  if config['time_travel'] != 0 && new_time > config['time_travel']
    puts "You are traveling back in time again, "\
         "this might cause unexpected results to your git history. "\
         "Are you sure? (Press 'Y' to proceed, or any other key to abort"
    return unless STDIN.gets.chomp! == 'Y'
  end
  config['time_travel'] = new_time
  Config.write config
end