lib/makit/directory.rb in makit-0.0.21 vs lib/makit/directory.rb in makit-0.0.22
- old
+ new
@@ -89,14 +89,17 @@
end
end
end
def self.get_git_tracked_files(directory_path)
- output, status = Open3.capture2("git ls-files", chdir: directory_path)
- raise "Failed to list git-tracked files" unless status.success?
+ #raise "do not use this method"
+ #output, status = Open3.capture2("git ls-files directory", chdir: directory_path)
+ #raise "Failed to list git-tracked files" unless status.success?
+ #command = "git ls-files #{directory_path}".run
- output.split("\n")
+ #command.output.split("\n")
+ `git ls-files #{directory_path}`.split("\n")
end
def self.get_newest_git_file(directory_path)
get_git_tracked_files(directory_path).select { |f| File.file?(f) }.max_by { |f| File.mtime(f) }
end
@@ -107,10 +110,9 @@
def self.get_newest_file_timestamp(directory_path)
newest_file = get_git_tracked_files(directory_path).select { |f| File.file?(f) }.max_by { |f| File.mtime(f) }
newest_file.nil? ? Time.now : File.mtime(newest_file)
end
-
# Normalize the path by removing any leading or trailing slashes
# and replacing any backslashes with forward slashes
def self.normalize(path)
path = path.gsub("\\", "/")