class Hookalist::File

Attributes

commit_time[R]
file_name[R]
start_time[R]

Public Class Methods

new(file_name, start_time, commit_time) click to toggle source
# File lib/hookalist/file.rb, line 5
def initialize(file_name, start_time, commit_time)
  @file_name = file_name
  @start_time = start_time.clone
  @commit_time = commit_time.clone
end

Public Instance Methods

file_path() click to toggle source
# File lib/hookalist/file.rb, line 11
def file_path
  @file_path ||= Dir.pwd + "/#{file_name}"
end
touch_command() click to toggle source
# File lib/hookalist/file.rb, line 15
def touch_command
  c_time = rand(start_time...commit_time)
  seconds = (Time.now - c_time).to_i
  command = "touch -d \"#{seconds} seconds ago\" #{file_path}"
  puts "#{command}"
  command
end