makit 0.0.74 → 0.0.76
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/generated/makit/v1/makit.v1_pb.rb +35 -0
- data/lib/generated/makit/v1/web/link_pb.rb +20 -0
- 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_gitignore.txt +222 -222
- 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 -94
- data/lib/makit/docs/rake.rb +106 -106
- data/lib/makit/dotnet.rb +212 -182
- data/lib/makit/environment.rb +131 -131
- data/lib/makit/fileinfo.rb +26 -26
- data/lib/makit/files.rb +47 -47
- data/lib/makit/git.rb +145 -145
- 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 -13
- 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 +86 -86
- data/lib/makit/tasks.rb +137 -137
- data/lib/makit/tree.rb +37 -37
- 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 +4 -2
data/lib/makit/docs/files.rb
CHANGED
@@ -1,94 +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
|
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
|
data/lib/makit/docs/rake.rb
CHANGED
@@ -1,106 +1,106 @@
|
|
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 Rake
|
17
|
-
def self.get_top_level_tasks
|
18
|
-
::Rake.application.top_level_tasks
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.get_top_task_name
|
22
|
-
self.get_top_level_tasks.first
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.duration
|
26
|
-
Time.now - Makit::STARTTIME
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.start_time
|
30
|
-
Makit::STARTTIME
|
31
|
-
end
|
32
|
-
|
33
|
-
# return a hash of name => value for properties of the rake execution
|
34
|
-
def self.properties
|
35
|
-
{
|
36
|
-
"top_level_tasks" => self.get_top_level_tasks,
|
37
|
-
# If global VERSION is defined, then add it to the properties (this is NOT the Makit::VERSION)
|
38
|
-
"version" => (defined?(VERSION) ? VERSION : ""),
|
39
|
-
"branch" => Makit::Git.branch,
|
40
|
-
# add the current user name
|
41
|
-
"user" => ENV["USER"],
|
42
|
-
# add the current machine name
|
43
|
-
"machine" => ENV["COMPUTERNAME"],
|
44
|
-
# add the os name
|
45
|
-
"os" => ENV["OS"],
|
46
|
-
"duration" => Makit::Humanize.get_humanized_duration(self.duration),
|
47
|
-
"start_time" => Makit::Humanize.get_humanized_timestamp(self.start_time),
|
48
|
-
"source_file_count" => Makit::Git.get_file_infos.count,
|
49
|
-
"source_file_size" => Makit::Humanize.get_humanized_size(Makit::Git.get_file_infos.sum(&:size)),
|
50
|
-
"untracked_file_count" => Makit::Git.get_untracked_file_infos.count,
|
51
|
-
"untracked_file_size" => Makit::Humanize.get_humanized_size(Makit::Git.get_untracked_file_infos.sum(&:size)),
|
52
|
-
# express the ratio of untracked file size to tracked file size as a percentage
|
53
|
-
"ratio_untracked_size_to_tracked_size" => ((Makit::Git.get_untracked_file_infos.sum(&:size) / Makit::Git.get_file_infos.sum(&:size)) * 100).to_i,
|
54
|
-
}
|
55
|
-
end
|
56
|
-
|
57
|
-
def self.generate
|
58
|
-
|
59
|
-
# if the top level tasks are of size 1, with the name "default",
|
60
|
-
# then we will continue to generate the documentation.
|
61
|
-
# otherwise, we will display a message and exit.
|
62
|
-
if self.get_top_level_tasks.size != 1 || self.get_top_level_tasks.first != "default"
|
63
|
-
puts " no top level tasks specified, skipping rake documentation generation".colorize(:yellow)
|
64
|
-
return
|
65
|
-
end
|
66
|
-
|
67
|
-
content = ""
|
68
|
-
# display: "Rake default completed in HUMANIZED_DURATION"
|
69
|
-
content += "# Rake default\n\n"
|
70
|
-
|
71
|
-
# display a table of the properties
|
72
|
-
content += "## Properties\n\n"
|
73
|
-
self.properties.each do |key, value|
|
74
|
-
content += "| #{key} | #{value} |\n"
|
75
|
-
end
|
76
|
-
content += "\n\n"
|
77
|
-
|
78
|
-
# display the completed tasks
|
79
|
-
content += "## Completed Tasks\n\n"
|
80
|
-
Makit::TaskInfo.completed_tasks.each do |task_name, task_info|
|
81
|
-
content += "| #{task_name} | #{Makit::Humanize.get_humanized_duration(task_info[:duration])} |\n"
|
82
|
-
end
|
83
|
-
content += "\n\n"
|
84
|
-
|
85
|
-
## report on the available rake tasks
|
86
|
-
content += Makit::RUNNER.execute("rake -T").to_markdown
|
87
|
-
content += "\n\n"
|
88
|
-
|
89
|
-
filename = "docs/Rake.md"
|
90
|
-
if !Dir.exist?("docs")
|
91
|
-
Dir.mkdir("docs")
|
92
|
-
end
|
93
|
-
# overwrite the file if it exists
|
94
|
-
if File.exist?(filename)
|
95
|
-
existing_content = File.read(filename)
|
96
|
-
if existing_content != content
|
97
|
-
File.delete(filename)
|
98
|
-
File.write(filename, content)
|
99
|
-
end
|
100
|
-
else
|
101
|
-
File.write(filename, content)
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
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
|
+
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 Rake
|
17
|
+
def self.get_top_level_tasks
|
18
|
+
::Rake.application.top_level_tasks
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.get_top_task_name
|
22
|
+
self.get_top_level_tasks.first
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.duration
|
26
|
+
Time.now - Makit::STARTTIME
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.start_time
|
30
|
+
Makit::STARTTIME
|
31
|
+
end
|
32
|
+
|
33
|
+
# return a hash of name => value for properties of the rake execution
|
34
|
+
def self.properties
|
35
|
+
{
|
36
|
+
"top_level_tasks" => self.get_top_level_tasks,
|
37
|
+
# If global VERSION is defined, then add it to the properties (this is NOT the Makit::VERSION)
|
38
|
+
"version" => (defined?(VERSION) ? VERSION : ""),
|
39
|
+
"branch" => Makit::Git.branch,
|
40
|
+
# add the current user name
|
41
|
+
"user" => ENV["USER"],
|
42
|
+
# add the current machine name
|
43
|
+
"machine" => ENV["COMPUTERNAME"],
|
44
|
+
# add the os name
|
45
|
+
"os" => ENV["OS"],
|
46
|
+
"duration" => Makit::Humanize.get_humanized_duration(self.duration),
|
47
|
+
"start_time" => Makit::Humanize.get_humanized_timestamp(self.start_time),
|
48
|
+
"source_file_count" => Makit::Git.get_file_infos.count,
|
49
|
+
"source_file_size" => Makit::Humanize.get_humanized_size(Makit::Git.get_file_infos.sum(&:size)),
|
50
|
+
"untracked_file_count" => Makit::Git.get_untracked_file_infos.count,
|
51
|
+
"untracked_file_size" => Makit::Humanize.get_humanized_size(Makit::Git.get_untracked_file_infos.sum(&:size)),
|
52
|
+
# express the ratio of untracked file size to tracked file size as a percentage
|
53
|
+
"ratio_untracked_size_to_tracked_size" => ((Makit::Git.get_untracked_file_infos.sum(&:size) / Makit::Git.get_file_infos.sum(&:size)) * 100).to_i,
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.generate
|
58
|
+
|
59
|
+
# if the top level tasks are of size 1, with the name "default",
|
60
|
+
# then we will continue to generate the documentation.
|
61
|
+
# otherwise, we will display a message and exit.
|
62
|
+
if self.get_top_level_tasks.size != 1 || self.get_top_level_tasks.first != "default"
|
63
|
+
puts " no top level tasks specified, skipping rake documentation generation".colorize(:yellow)
|
64
|
+
return
|
65
|
+
end
|
66
|
+
|
67
|
+
content = ""
|
68
|
+
# display: "Rake default completed in HUMANIZED_DURATION"
|
69
|
+
content += "# Rake default\n\n"
|
70
|
+
|
71
|
+
# display a table of the properties
|
72
|
+
content += "## Properties\n\n"
|
73
|
+
self.properties.each do |key, value|
|
74
|
+
content += "| #{key} | #{value} |\n"
|
75
|
+
end
|
76
|
+
content += "\n\n"
|
77
|
+
|
78
|
+
# display the completed tasks
|
79
|
+
content += "## Completed Tasks\n\n"
|
80
|
+
Makit::TaskInfo.completed_tasks.each do |task_name, task_info|
|
81
|
+
content += "| #{task_name} | #{Makit::Humanize.get_humanized_duration(task_info[:duration])} |\n"
|
82
|
+
end
|
83
|
+
content += "\n\n"
|
84
|
+
|
85
|
+
## report on the available rake tasks
|
86
|
+
content += Makit::RUNNER.execute("rake -T").to_markdown
|
87
|
+
content += "\n\n"
|
88
|
+
|
89
|
+
filename = "docs/Rake.md"
|
90
|
+
if !Dir.exist?("docs")
|
91
|
+
Dir.mkdir("docs")
|
92
|
+
end
|
93
|
+
# overwrite the file if it exists
|
94
|
+
if File.exist?(filename)
|
95
|
+
existing_content = File.read(filename)
|
96
|
+
if existing_content != content
|
97
|
+
File.delete(filename)
|
98
|
+
File.write(filename, content)
|
99
|
+
end
|
100
|
+
else
|
101
|
+
File.write(filename, content)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|