Sha256: 7bb4e66acb6050714b4be53257e063e9c95dba1ab7b9583d20d1505b9c21883f
Contents?: true
Size: 897 Bytes
Versions: 1
Compression:
Stored size: 897 Bytes
Contents
require_relative 'time_difference' module Autowow class Fs using RefinedTimeDifference def self.ls_dirs Dir.glob(File.expand_path('./*/')) end def self.latest(files) files.sort_by{ |f| File.mtime(f) }.reverse!.first end def self.older_than(files, quantity, unit) files.select do |dir| TimeDifference.between(File.mtime(dir), Time.now).public_send("in_#{unit}") > quantity end end def self.for_dirs(dirs) dirs.each do |working_dir| # TODO: add handling of directories via extra param to popen3 # https://stackoverflow.com/a/10148084/2771889 Dir.chdir(working_dir) do yield working_dir end end end def self.in_place_or_subdirs(in_place) if in_place yield else for_dirs(ls_dirs) do yield end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
autowow-0.1.0 | lib/autowow/fs.rb |