raykit 0.0.539 → 0.0.540
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/raykit/dir.rb +34 -3
- data/lib/raykit/git/directory.rb +17 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 034edb34cbfb58218b76515bcafa58e1c36cfebb6bcdb5642756d8b38f392777
|
4
|
+
data.tar.gz: 3dd2ea4c976d8ac05e5bdb905b42eea20cd9481b0589a2515b21b1e23de0a7d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cb56b0f0ab6f0753b8ae2056ffa7d0489533cb0624ed9a221d456679557d9777f4dd0b71c203c95f3f6c82b15e5b4464242155b97e057fd65f6b480a8f3926c
|
7
|
+
data.tar.gz: 2453d3a0703fa63a1bf903e1aba5a1c261bbe1786240c77ee1b2df25c21e4a3c8a1bca07d5d1f490d608110c45d5b9cd1993821b0386abc38201525d37e621dd
|
data/lib/raykit/dir.rb
CHANGED
@@ -80,16 +80,47 @@ class Dir
|
|
80
80
|
path = File.join(dir, entry) # Construct the full path
|
81
81
|
|
82
82
|
if File.directory?(path)
|
83
|
-
|
84
|
-
|
85
|
-
|
83
|
+
begin
|
84
|
+
remove_empty_directories(path) # Recursively call the method if the entry is a directory
|
85
|
+
rescue Errno::ENAMETOOLONG
|
86
|
+
puts "Path too long: #{path}"
|
87
|
+
next # Skip this directory and continue with others
|
88
|
+
end
|
89
|
+
|
90
|
+
# Attempt to remove the directory if it's empty after processing its contents
|
91
|
+
begin
|
92
|
+
Dir.rmdir(path) if Dir.empty?(path)
|
93
|
+
rescue Errno::ENAMETOOLONG
|
94
|
+
puts "Path too long to remove: #{path}"
|
95
|
+
end
|
86
96
|
end
|
87
97
|
end
|
88
98
|
rescue Errno::ENOENT
|
89
99
|
# Handle the case where the directory doesn't exist or is removed before rmdir is called
|
90
100
|
puts "Directory not found: #{dir}"
|
101
|
+
rescue Errno::ENAMETOOLONG
|
102
|
+
# Handle the case where the initial directory path is too long
|
103
|
+
puts "Initial path too long: #{dir}"
|
91
104
|
end
|
92
105
|
|
106
|
+
#def self.remove_empty_directories(dir)
|
107
|
+
# List all entries in the directory except for '.' and '..'
|
108
|
+
# Dir.entries(dir).each do |entry|
|
109
|
+
# next if entry == "." || entry == ".." # Skip the current and parent directory entries
|
110
|
+
|
111
|
+
# path = File.join(dir, entry) # Construct the full path
|
112
|
+
|
113
|
+
# if File.directory?(path)
|
114
|
+
# remove_empty_directories(path) # Recursively call the method if the entry is a directory
|
115
|
+
# Remove the directory if it's empty after processing its contents
|
116
|
+
# Dir.rmdir(path) if Dir.empty?(path)
|
117
|
+
# end
|
118
|
+
# end
|
119
|
+
#rescue Errno::ENOENT
|
120
|
+
# Handle the case where the directory doesn't exist or is removed before rmdir is called
|
121
|
+
# puts "Directory not found: #{dir}"
|
122
|
+
#end
|
123
|
+
|
93
124
|
# Example usage:
|
94
125
|
# remove_empty_directories('/path/to/directory')
|
95
126
|
|
data/lib/raykit/git/directory.rb
CHANGED
@@ -95,8 +95,23 @@ module Raykit
|
|
95
95
|
|
96
96
|
def last_modified_filename
|
97
97
|
Dir.chdir(@directory) do
|
98
|
-
#
|
99
|
-
|
98
|
+
# TODO: consider handling the case where glob can fail because of filename length
|
99
|
+
# Errno::ENAMETOOLONG: File name too long @ dir_s_glob - /Users/username/...
|
100
|
+
#
|
101
|
+
begin
|
102
|
+
# Use Dir.glob to find all files, select the actual files, find the one with the latest modification time, and return its name
|
103
|
+
files = Dir.glob("**/*.*").select { |f| File.file?(f) }
|
104
|
+
|
105
|
+
# Find the file with the latest modification time
|
106
|
+
latest_file = files.max_by { |f| File.mtime(f) }
|
107
|
+
|
108
|
+
return latest_file
|
109
|
+
|
110
|
+
#Dir.glob("**/*.*").select { |f| File.file?(f) }.max_by { |f| File.mtime(f) }
|
111
|
+
rescue Errno::ENAMETOOLONG => e
|
112
|
+
puts "Error: #{e.message}"
|
113
|
+
return handle_long_filename_error
|
114
|
+
end
|
100
115
|
end
|
101
116
|
end
|
102
117
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: raykit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.540
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lou Parslow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-04-
|
11
|
+
date: 2024-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -152,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
152
|
- !ruby/object:Gem::Version
|
153
153
|
version: '0'
|
154
154
|
requirements: []
|
155
|
-
rubygems_version: 3.5.
|
155
|
+
rubygems_version: 3.5.8
|
156
156
|
signing_key:
|
157
157
|
specification_version: 4
|
158
158
|
summary: ruby gem to support rake ci/cd tasks
|