makit 0.0.68 → 0.0.70
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/makit/apache.rb +32 -32
- data/lib/makit/cli/clean.rb +14 -14
- data/lib/makit/cli/clone.rb +59 -59
- data/lib/makit/cli/init.rb +38 -38
- data/lib/makit/cli/main.rb +33 -33
- data/lib/makit/cli/make.rb +54 -54
- data/lib/makit/cli/new.rb +37 -37
- data/lib/makit/cli/nuget_cache.rb +38 -38
- data/lib/makit/cli/pull.rb +31 -31
- data/lib/makit/cli/setup.rb +71 -71
- data/lib/makit/cli/work.rb +21 -21
- data/lib/makit/command_runner.rb +404 -404
- data/lib/makit/commands.rb +21 -21
- data/lib/makit/content/default_gitignore.rb +5 -5
- data/lib/makit/content/default_rakefile.rb +11 -11
- data/lib/makit/content/gem_rakefile.rb +14 -14
- data/lib/makit/data.rb +50 -50
- data/lib/makit/directories.rb +143 -143
- data/lib/makit/directory.rb +264 -264
- data/lib/makit/docs/files.rb +94 -0
- data/lib/makit/docs/rake.rb +101 -0
- data/lib/makit/dotnet.rb +182 -182
- data/lib/makit/environment.rb +127 -127
- data/lib/makit/fileinfo.rb +26 -16
- data/lib/makit/files.rb +47 -47
- data/lib/makit/git.rb +145 -96
- data/lib/makit/gitlab_runner.rb +60 -60
- data/lib/makit/humanize.rb +129 -129
- data/lib/makit/indexer.rb +56 -56
- data/lib/makit/logging.rb +106 -106
- data/lib/makit/markdown.rb +75 -75
- data/lib/makit/mp/basic_object_mp.rb +16 -16
- data/lib/makit/mp/command_mp.rb +13 -0
- data/lib/makit/mp/command_request.mp.rb +16 -16
- data/lib/makit/mp/project_mp.rb +210 -210
- data/lib/makit/mp/string_mp.rb +137 -137
- data/lib/makit/nuget.rb +62 -62
- data/lib/makit/process.rb +26 -26
- data/lib/makit/protoc.rb +104 -104
- data/lib/makit/secrets.rb +51 -51
- data/lib/makit/serializer.rb +115 -115
- data/lib/makit/show.rb +110 -110
- data/lib/makit/storage.rb +131 -131
- data/lib/makit/symbols.rb +149 -149
- data/lib/makit/task_info.rb +79 -0
- data/lib/makit/tasks.rb +123 -68
- data/lib/makit/tree.rb +37 -37
- data/lib/makit/v1/makit.v1_pb.rb +34 -34
- data/lib/makit/v1/makit.v1_services_pb.rb +25 -25
- data/lib/makit/version.rb +65 -65
- data/lib/makit/wix.rb +95 -95
- data/lib/makit/yaml.rb +17 -17
- data/lib/makit/zip.rb +17 -17
- data/lib/makit.rb +267 -267
- metadata +7 -5
- data/lib/generated/makit/v1/makit.v1_pb.rb +0 -35
- data/lib/generated/makit/v1/web/link_pb.rb +0 -20
data/lib/makit/directory.rb
CHANGED
@@ -1,264 +1,264 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "find"
|
4
|
-
require "pathname"
|
5
|
-
#require "gitignore"
|
6
|
-
|
7
|
-
# This module provides classes for the Makit gem.
|
8
|
-
module Makit
|
9
|
-
# This class provide methods for working with Directories/
|
10
|
-
#
|
11
|
-
# Example:
|
12
|
-
#
|
13
|
-
# Makit::Directory.find_directory_with_pattern("/home/user", "*.rb")
|
14
|
-
#
|
15
|
-
class Directory
|
16
|
-
def self.show_dir_size(dir)
|
17
|
-
total_bytes = Dir.glob(File.join(dir, "**", "*"))
|
18
|
-
.select { |f| File.file?(f) }
|
19
|
-
.sum { |f| File.size(f) }
|
20
|
-
|
21
|
-
human_size(total_bytes)
|
22
|
-
puts " directory " + "#{dir}".colorize(:green) + " size is " + "#{human_size(total_bytes)}".colorize(:green)
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.show_largest_files(dir, limit)
|
26
|
-
puts " directory " + "#{dir}".colorize(:green) + " #{limit} largest files"
|
27
|
-
files = Dir.glob(File.join(dir,
|
28
|
-
.select { |f| File.file?(f) }
|
29
|
-
|
30
|
-
sorted = files.map { |f| [f, File.size(f)] }
|
31
|
-
.sort_by { |_, size| -size }
|
32
|
-
.first(limit)
|
33
|
-
|
34
|
-
sorted.each do |path, size|
|
35
|
-
# right justify human_size to be at least 10 characters wide
|
36
|
-
padded_size = human_size(size).rjust(10)
|
37
|
-
puts " #{padded_size}" + " #{path}".colorize(:green)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def human_size(bytes)
|
42
|
-
units = [
|
43
|
-
return "0 B" if bytes == 0
|
44
|
-
|
45
|
-
exp = (Math.log(bytes) / Math.log(1024)).to_i
|
46
|
-
exp = units.size - 1 if exp >= units.size
|
47
|
-
|
48
|
-
"%.2f %s" % [bytes.to_f / 1024**exp, units[exp]]
|
49
|
-
end
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
exp =
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
line_count
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
parent_directory
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
raise ArgumentError, "
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
#
|
140
|
-
#
|
141
|
-
#
|
142
|
-
|
143
|
-
|
144
|
-
#
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
newest_file
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
#
|
162
|
-
|
163
|
-
|
164
|
-
path = path.
|
165
|
-
|
166
|
-
path
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
# for
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
def self.deep_clean(dir)
|
246
|
-
git_dirs = []
|
247
|
-
#Dir.chdir(dir) do
|
248
|
-
# scan all subdirectories for git repositories
|
249
|
-
puts " scanning #{dir} for git repositories".colorize(:green)
|
250
|
-
Find.find(dir) do |path|
|
251
|
-
if File.directory?(path) && File.exist?("#{path}/.git")
|
252
|
-
git_dirs << path
|
253
|
-
end
|
254
|
-
end
|
255
|
-
#end
|
256
|
-
git_dirs.each do |path|
|
257
|
-
puts " cleaning #{path} of untracked files".colorize(:green)
|
258
|
-
Dir.chdir(path) do
|
259
|
-
puts `git clean -fdx`
|
260
|
-
end
|
261
|
-
end
|
262
|
-
end
|
263
|
-
end
|
264
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "find"
|
4
|
+
require "pathname"
|
5
|
+
#require "gitignore"
|
6
|
+
|
7
|
+
# This module provides classes for the Makit gem.
|
8
|
+
module Makit
|
9
|
+
# This class provide methods for working with Directories/
|
10
|
+
#
|
11
|
+
# Example:
|
12
|
+
#
|
13
|
+
# Makit::Directory.find_directory_with_pattern("/home/user", "*.rb")
|
14
|
+
#
|
15
|
+
class Directory
|
16
|
+
def self.show_dir_size(dir)
|
17
|
+
total_bytes = Dir.glob(File.join(dir, "**", "*"))
|
18
|
+
.select { |f| File.file?(f) }
|
19
|
+
.sum { |f| File.size(f) }
|
20
|
+
|
21
|
+
human_size(total_bytes)
|
22
|
+
puts " directory " + "#{dir}".colorize(:green) + " size is " + "#{human_size(total_bytes)}".colorize(:green)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.show_largest_files(dir, limit)
|
26
|
+
puts " directory " + "#{dir}".colorize(:green) + " #{limit} largest files"
|
27
|
+
files = Dir.glob(File.join(dir, "**", "*"), File::FNM_DOTMATCH)
|
28
|
+
.select { |f| File.file?(f) }
|
29
|
+
|
30
|
+
sorted = files.map { |f| [f, File.size(f)] }
|
31
|
+
.sort_by { |_, size| -size }
|
32
|
+
.first(limit)
|
33
|
+
|
34
|
+
sorted.each do |path, size|
|
35
|
+
# right justify human_size to be at least 10 characters wide
|
36
|
+
padded_size = human_size(size).rjust(10)
|
37
|
+
puts " #{padded_size}" + " #{path}".colorize(:green)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def human_size(bytes)
|
42
|
+
units = ["B", "KB", "MB", "GB", "TB"]
|
43
|
+
return "0 B" if bytes == 0
|
44
|
+
|
45
|
+
exp = (Math.log(bytes) / Math.log(1024)).to_i
|
46
|
+
exp = units.size - 1 if exp >= units.size
|
47
|
+
|
48
|
+
"%.2f %s" % [bytes.to_f / 1024 ** exp, units[exp]]
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.human_size(bytes)
|
52
|
+
units = ["B", "KB", "MB", "GB", "TB"]
|
53
|
+
return "0 B" if bytes == 0
|
54
|
+
|
55
|
+
exp = (Math.log(bytes) / Math.log(1024)).to_i
|
56
|
+
exp = units.size - 1 if exp >= units.size
|
57
|
+
|
58
|
+
"%.2f %s" % [bytes.to_f / 1024 ** exp, units[exp]]
|
59
|
+
end
|
60
|
+
def self.get_line_count(file)
|
61
|
+
line_count = 0
|
62
|
+
File.foreach(file) { line_count += 1 }
|
63
|
+
line_count
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.find_directory_with_patterns(starting_directory, patterns)
|
67
|
+
patterns.each do |pattern|
|
68
|
+
result = find_directory_with_pattern(starting_directory, pattern)
|
69
|
+
if (Dir.exist?(result))
|
70
|
+
return result
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
nil
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.find_directory_with_pattern(starting_directory, pattern)
|
78
|
+
current_directory = File.expand_path(starting_directory)
|
79
|
+
|
80
|
+
loop do
|
81
|
+
return current_directory if contains_pattern?(current_directory, pattern)
|
82
|
+
|
83
|
+
parent_directory = File.dirname(current_directory)
|
84
|
+
break if parent_directory == current_directory # Reached the root directory
|
85
|
+
|
86
|
+
current_directory = parent_directory
|
87
|
+
end
|
88
|
+
|
89
|
+
nil
|
90
|
+
end
|
91
|
+
|
92
|
+
def self.contains_pattern?(directory, pattern)
|
93
|
+
Dir.foreach(directory) do |entry|
|
94
|
+
next if [".", ".."].include?(entry)
|
95
|
+
return true if File.fnmatch(pattern, entry)
|
96
|
+
end
|
97
|
+
false
|
98
|
+
end
|
99
|
+
|
100
|
+
def self.get_size(directory)
|
101
|
+
total_size = 0
|
102
|
+
|
103
|
+
Find.find(directory) do |file|
|
104
|
+
total_size += File.size(file) if File.file?(file)
|
105
|
+
end
|
106
|
+
|
107
|
+
total_size
|
108
|
+
end
|
109
|
+
|
110
|
+
def self.get_humanized_size(size_in_bytes, precision = 2)
|
111
|
+
end
|
112
|
+
|
113
|
+
def self.zip_source_files(directory_path, zip_file_name)
|
114
|
+
raise ArgumentError, "Directory path cannot be nil" if directory_path.nil?
|
115
|
+
raise ArgumentError, "Zip file name cannot be nil or empty" if zip_file_name.nil? || zip_file_name.strip.empty?
|
116
|
+
|
117
|
+
unless Dir.exist?(directory_path)
|
118
|
+
raise ArgumentError, "Directory '#{directory_path}' does not exist."
|
119
|
+
end
|
120
|
+
|
121
|
+
tracked_files = get_git_tracked_files(directory_path)
|
122
|
+
|
123
|
+
if tracked_files.empty?
|
124
|
+
raise "No tracked files found in the directory."
|
125
|
+
end
|
126
|
+
|
127
|
+
Zip::File.open(zip_file_name, Zip::File::CREATE) do |zipfile|
|
128
|
+
tracked_files.each do |file|
|
129
|
+
full_path = File.join(directory_path, file)
|
130
|
+
if File.exist?(full_path)
|
131
|
+
zipfile.add(file, full_path)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
def self.get_git_tracked_files(directory_path)
|
138
|
+
#raise "do not use this method"
|
139
|
+
#output, status = Open3.capture2("git ls-files directory", chdir: directory_path)
|
140
|
+
#raise "Failed to list git-tracked files" unless status.success?
|
141
|
+
#command = "git ls-files #{directory_path}".run
|
142
|
+
|
143
|
+
#command.output.split("\n")
|
144
|
+
`git ls-files #{directory_path}`.split("\n")
|
145
|
+
end
|
146
|
+
|
147
|
+
def self.get_newest_git_file(directory_path)
|
148
|
+
get_git_tracked_files(directory_path).select { |f| File.file?(f) }.max_by { |f| File.mtime(f) }
|
149
|
+
end
|
150
|
+
|
151
|
+
def self.get_newest_git_file_timestamp(directory_path)
|
152
|
+
get_newest_git_file(directory_path).nil? ? Time.now : File.mtime(get_newest_git_file(directory_path))
|
153
|
+
end
|
154
|
+
|
155
|
+
def self.get_newest_file_timestamp(directory_path)
|
156
|
+
newest_file = get_git_tracked_files(directory_path).select { |f| File.file?(f) }.max_by { |f| File.mtime(f) }
|
157
|
+
newest_file.nil? ? Time.now : File.mtime(newest_file)
|
158
|
+
end
|
159
|
+
|
160
|
+
# Normalize the path by removing any leading or trailing slashes
|
161
|
+
# and replacing any backslashes with forward slashes
|
162
|
+
def self.normalize(path)
|
163
|
+
path = path.gsub("\\", "/")
|
164
|
+
#path = path[1..-1] if path.start_with?("/")
|
165
|
+
path = path[0..-2] if path.end_with?("/")
|
166
|
+
path
|
167
|
+
end
|
168
|
+
|
169
|
+
# for a given path, collect all the subdirectories that match a version pattern.
|
170
|
+
# for example 2.57.0, 2.62, or 2.65.0
|
171
|
+
def self.get_version_directories(path)
|
172
|
+
version_directories = []
|
173
|
+
Dir.foreach(path) do |entry|
|
174
|
+
next if [".", ".."].include?(entry)
|
175
|
+
version_directories << entry if entry.match?(/^\d+\.\d+\.\d+$/)
|
176
|
+
end
|
177
|
+
version_directories
|
178
|
+
end
|
179
|
+
|
180
|
+
def self.modified(path)
|
181
|
+
self.get_newest_file(path)
|
182
|
+
end
|
183
|
+
# for a given path, get the most recent file change date for any file in the directory
|
184
|
+
def self.get_latest_file_change_date(path)
|
185
|
+
# loop over all files in the directory
|
186
|
+
latest_date = nil
|
187
|
+
Find.find(path) do |file|
|
188
|
+
if File.file?(file)
|
189
|
+
date = File.mtime(file)
|
190
|
+
latest_date = date if latest_date.nil? || date > latest_date
|
191
|
+
end
|
192
|
+
end
|
193
|
+
latest_date
|
194
|
+
end
|
195
|
+
|
196
|
+
# for a given path, return the filename of the most recently modified file
|
197
|
+
def self.get_newest_file(path)
|
198
|
+
newest_file = nil
|
199
|
+
latest_date = nil
|
200
|
+
if (Dir.exist?(path))
|
201
|
+
Find.find(path) do |file|
|
202
|
+
if File.file?(file)
|
203
|
+
date = File.mtime(file)
|
204
|
+
latest_date = date if latest_date.nil? || date > latest_date
|
205
|
+
newest_file = file if date == latest_date
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
newest_file
|
210
|
+
end
|
211
|
+
|
212
|
+
def self.copy(src_dir, dst_dir, verbose = false)
|
213
|
+
FileUtils.cp_r(src_dir, dst_dir, verbose: verbose)
|
214
|
+
end
|
215
|
+
|
216
|
+
def self.generate_manifest(dir)
|
217
|
+
if File.exist?("#{dir}/manifest.txt")
|
218
|
+
File.delete("#{dir}/manifest.txt")
|
219
|
+
end
|
220
|
+
File.open("#{dir}/manifest.txt", "w") do |f|
|
221
|
+
Dir.glob("#{dir}/**/*").each do |file|
|
222
|
+
next if File.directory?(file)
|
223
|
+
f.puts file.sub("#{dir}/", "")
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
def self.remove_empty_directories(dir)
|
229
|
+
Find.find(dir) do |path|
|
230
|
+
if File.directory?(path) && Dir.empty?(path)
|
231
|
+
FileUtils.rm_rf(path)
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
def self.remove_empty_directories_recursively(dir)
|
237
|
+
Find.find(dir) do |path|
|
238
|
+
if File.directory?(path) && Dir.empty?(path)
|
239
|
+
FileUtils.rm_rf(path)
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
# cleans all git repositories found in the given directory
|
245
|
+
def self.deep_clean(dir)
|
246
|
+
git_dirs = []
|
247
|
+
#Dir.chdir(dir) do
|
248
|
+
# scan all subdirectories for git repositories
|
249
|
+
puts " scanning #{dir} for git repositories".colorize(:green)
|
250
|
+
Find.find(dir) do |path|
|
251
|
+
if File.directory?(path) && File.exist?("#{path}/.git")
|
252
|
+
git_dirs << path
|
253
|
+
end
|
254
|
+
end
|
255
|
+
#end
|
256
|
+
git_dirs.each do |path|
|
257
|
+
puts " cleaning #{path} of untracked files".colorize(:green)
|
258
|
+
Dir.chdir(path) do
|
259
|
+
puts `git clean -fdx`
|
260
|
+
end
|
261
|
+
end
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "find"
|
4
|
+
require "pathname"
|
5
|
+
#require "gitignore"
|
6
|
+
|
7
|
+
# This module provides classes for the Makit gem.
|
8
|
+
module Makit
|
9
|
+
module Docs
|
10
|
+
# This class provide methods for generating documentation
|
11
|
+
# about source files and artifacts.
|
12
|
+
#
|
13
|
+
# docs/Files.md
|
14
|
+
#
|
15
|
+
#
|
16
|
+
class Files
|
17
|
+
def self.generate
|
18
|
+
filename = "docs/Files.md"
|
19
|
+
if !Dir.exist?("docs")
|
20
|
+
Dir.mkdir("docs")
|
21
|
+
end
|
22
|
+
# overwrite the file if it exists
|
23
|
+
if File.exist?(filename)
|
24
|
+
File.delete(filename)
|
25
|
+
end
|
26
|
+
File.open(filename, "w") do |file|
|
27
|
+
file.write("# Files\n\n")
|
28
|
+
file.write("A file summary for the project #{Makit::Git::get_remote_url}.\n\n")
|
29
|
+
|
30
|
+
#
|
31
|
+
# Tracked Files
|
32
|
+
#
|
33
|
+
# report on the file tracked by git.
|
34
|
+
tracked_file_infos = Makit::Git::get_file_infos
|
35
|
+
|
36
|
+
# first display the count and total size of the files tracked by git.
|
37
|
+
file.write("## Tracked Files\n\n")
|
38
|
+
file.write("#{tracked_file_infos.count} files with a total size of #{Makit::Humanize.get_humanized_size(tracked_file_infos.sum(&:size))}.\n\n")
|
39
|
+
|
40
|
+
# next display a table of the 10 tracked files that have been modified recently.
|
41
|
+
# ordered by last modified date, display the size, name, and last modified date.
|
42
|
+
# leverage the humanize class to display the size in a human readable format.
|
43
|
+
# leverage the humanize class to display the last modified date in a human readable format.
|
44
|
+
file.write("The 10 files tracked by git that have been modified recently are:\n\n")
|
45
|
+
file.write("| Size | Name | Last Modified Date |\n")
|
46
|
+
file.write("|------|------|------------------|\n")
|
47
|
+
tracked_file_infos.sort_by(&:mtime).reverse.first(10).each do |file_info|
|
48
|
+
file.write("| #{Makit::Humanize.get_humanized_size(file_info.size)} | #{file_info.name} | #{Makit::Humanize.get_humanized_timestamp(file_info.mtime)} |\n")
|
49
|
+
end
|
50
|
+
file.write("\n")
|
51
|
+
|
52
|
+
# next display a table or the largest 10 files tracked by git.
|
53
|
+
# ordered by latest size first, display the size, name, and last modified date.
|
54
|
+
# leverage the humanize class to display the size in a human readable format.
|
55
|
+
# leverage the humanize class to display the last modified date in a human readable format.
|
56
|
+
file.write("The 10 largest files tracked by git are:\n\n")
|
57
|
+
file.write("| Size | Name | Last Modified Date |\n")
|
58
|
+
file.write("|------|------|------------------|\n")
|
59
|
+
tracked_file_infos.sort_by(&:size).reverse.first(10).each do |file_info|
|
60
|
+
file.write("| #{Makit::Humanize.get_humanized_size(file_info.size)} | #{file_info.name} | #{Makit::Humanize.get_humanized_timestamp(file_info.mtime)} |\n")
|
61
|
+
end
|
62
|
+
file.write("\n")
|
63
|
+
|
64
|
+
#
|
65
|
+
# Untracked Files
|
66
|
+
#
|
67
|
+
# report on the files that are not tracked by git.
|
68
|
+
untracked_file_infos = Makit::Git::get_untracked_file_infos
|
69
|
+
# display the count and total size of the files that are not tracked by git.
|
70
|
+
file.write("## Untracked Files\n\n")
|
71
|
+
file.write("#{untracked_file_infos.count} files with a total size of #{Makit::Humanize.get_humanized_size(untracked_file_infos.sum(&:size))}.\n\n")
|
72
|
+
# next display a table or the largest 10 files not tracked by git.
|
73
|
+
# ordered by latest size first, display the size, name, and last modified date.
|
74
|
+
# leverage the humanize class to display the size in a human readable format.
|
75
|
+
# leverage the humanize class to display the last modified date in a human readable format.
|
76
|
+
file.write("The 10 largest files not tracked by git are:\n\n")
|
77
|
+
file.write("| Size | Name | Last Modified Date |\n")
|
78
|
+
file.write("|------|------|------------------|\n")
|
79
|
+
untracked_file_infos.sort_by(&:size).reverse.first(10).each do |file_info|
|
80
|
+
file.write("| #{Makit::Humanize.get_humanized_size(file_info.size)} | #{file_info.name} | #{Makit::Humanize.get_humanized_timestamp(file_info.mtime)} |\n")
|
81
|
+
end
|
82
|
+
file.write("\n")
|
83
|
+
|
84
|
+
#
|
85
|
+
# Git Repository Size
|
86
|
+
#
|
87
|
+
## report on the git repository size
|
88
|
+
file.write(Makit::RUNNER.execute("git count-objects -vH").to_markdown)
|
89
|
+
file.write("\n\n")
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|