makit 0.0.83 → 0.0.84

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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generated/makit/v1/makit.v1_pb.rb +35 -0
  3. data/lib/generated/makit/v1/web/link_pb.rb +20 -0
  4. data/lib/makit/apache.rb +32 -32
  5. data/lib/makit/cli/clean.rb +14 -14
  6. data/lib/makit/cli/clone.rb +59 -59
  7. data/lib/makit/cli/init.rb +38 -38
  8. data/lib/makit/cli/main.rb +33 -33
  9. data/lib/makit/cli/make.rb +54 -54
  10. data/lib/makit/cli/new.rb +37 -37
  11. data/lib/makit/cli/nuget_cache.rb +38 -38
  12. data/lib/makit/cli/pull.rb +31 -31
  13. data/lib/makit/cli/setup.rb +71 -71
  14. data/lib/makit/cli/work.rb +21 -21
  15. data/lib/makit/command_runner.rb +404 -404
  16. data/lib/makit/commands.rb +21 -21
  17. data/lib/makit/content/default_gitignore.rb +5 -5
  18. data/lib/makit/content/default_gitignore.txt +222 -222
  19. data/lib/makit/content/default_rakefile.rb +11 -11
  20. data/lib/makit/content/gem_rakefile.rb +14 -14
  21. data/lib/makit/data.rb +50 -50
  22. data/lib/makit/directories.rb +144 -144
  23. data/lib/makit/directory.rb +264 -264
  24. data/lib/makit/docs/files.rb +94 -94
  25. data/lib/makit/docs/rake.rb +106 -106
  26. data/lib/makit/dotnet.rb +219 -219
  27. data/lib/makit/email.rb +61 -61
  28. data/lib/makit/environment.rb +131 -131
  29. data/lib/makit/fileinfo.rb +26 -26
  30. data/lib/makit/files.rb +47 -47
  31. data/lib/makit/git.rb +145 -145
  32. data/lib/makit/gitlab_runner.rb +60 -60
  33. data/lib/makit/humanize.rb +129 -129
  34. data/lib/makit/indexer.rb +56 -56
  35. data/lib/makit/logging.rb +106 -106
  36. data/lib/makit/markdown.rb +75 -75
  37. data/lib/makit/mp/basic_object_mp.rb +16 -16
  38. data/lib/makit/mp/command_mp.rb +13 -13
  39. data/lib/makit/mp/command_request.mp.rb +16 -16
  40. data/lib/makit/mp/project_mp.rb +210 -210
  41. data/lib/makit/mp/string_mp.rb +137 -137
  42. data/lib/makit/nuget.rb +72 -72
  43. data/lib/makit/process.rb +26 -26
  44. data/lib/makit/protoc.rb +104 -104
  45. data/lib/makit/rake.rb +25 -25
  46. data/lib/makit/secrets.rb +51 -51
  47. data/lib/makit/serializer.rb +115 -115
  48. data/lib/makit/show.rb +110 -110
  49. data/lib/makit/storage.rb +131 -131
  50. data/lib/makit/symbols.rb +149 -149
  51. data/lib/makit/task_info.rb +86 -86
  52. data/lib/makit/tasks.rb +144 -144
  53. data/lib/makit/tree.rb +37 -37
  54. data/lib/makit/v1/makit.v1_services_pb.rb +25 -25
  55. data/lib/makit/version.rb +64 -65
  56. data/lib/makit/wix.rb +95 -95
  57. data/lib/makit/yaml.rb +17 -17
  58. data/lib/makit/zip.rb +17 -17
  59. data/lib/makit.rb +267 -267
  60. metadata +5 -3
@@ -1,137 +1,137 @@
1
- # frozen_string_literal: true
2
- require "json"
3
- # monkey patch String class with a run method
4
-
5
- class String
6
- def run(args = nil)
7
- if args.nil?
8
- command = self
9
- Makit::RUNNER.run(Makit::RUNNER::parse_command_request(command))
10
- else
11
- command = self
12
- request = Makit::RUNNER.parse_args(command)
13
- if args.is_a?(Hash)
14
- args.each do |key, value|
15
- request.send("#{key}=", value)
16
- end
17
- end
18
- Makit::RUNNER.run(request)
19
- end
20
- end
21
-
22
- def cache_run()
23
- command = self
24
- Makit::RUNNER.cache_run(Makit::RUNNER::parse_command_request(command))
25
- end
26
-
27
- def cache_run(timestamp = nil)
28
- if timestamp.nil?
29
- timestamp = Makit::GIT_FILE_INFOS.first.mtime #GIT_FILE_INFOS. Makit::Directory.get_newest_git_file_timestamp(Makit::Directories::PROJECT_ROOT)
30
- #timestamp = Makit::Timestamp.now
31
- end
32
-
33
- command = self
34
- Makit::RUNNER.cache_run(Makit::RUNNER::parse_command_request(command), timestamp)
35
- end
36
-
37
- def try(args = nil)
38
- if args.nil?
39
- command = self
40
- Makit::RUNNER.try(command)
41
- else
42
- command = self
43
- request = Makit::RUNNER.parse_args(command)
44
- if args.is_a?(Hash)
45
- args.each do |key, value|
46
- request.send("#{key}=", value)
47
- end
48
- end
49
- Makit::RUNNER.try(request)
50
- end
51
- end
52
-
53
- def cache_try()
54
- command = self
55
- Makit::RUNNER.cache_try(Makit::RUNNER::parse_command_request(command))
56
- end
57
-
58
- def cache_try(timestamp = nil)
59
- if timestamp.nil?
60
- timestamp = Makit::GIT_FILE_INFOS.first.mtime #GIT_FILE_INFOS. Makit::Directory.get_newest_git_file_timestamp(Makit::Directories::PROJECT_ROOT)
61
- #timestamp = Makit::Timestamp.now
62
- end
63
-
64
- command = self
65
- Makit::RUNNER.cache_try(Makit::RUNNER::parse_command_request(command), timestamp)
66
- end
67
-
68
- # Read a value from a JSON file
69
- # key is a string with the key to read, e.g. "AzureAd.Authority"
70
- def get_json_value(key)
71
- json = File.read(self)
72
- data = JSON.parse(json)
73
-
74
- # key delimiter is '.' so we can access nested keys
75
- key.split(".").each do |k|
76
- data = data[k]
77
- end
78
- data
79
- end
80
-
81
- alias_method :retrieve, :get_json_value
82
-
83
- # Set a value in a JSON file
84
- # key is a string with the key to set, e.g. "AzureAd.Authority"
85
- def set_json_value(key, value)
86
- file = File.read(self)
87
- data = JSON.parse(file)
88
- keys = key.split(".")
89
- current = data
90
-
91
- # Traverse and create any missing keys
92
- keys[0..-2].each do |k|
93
- current[k] ||= {} # Create a new hash if the key doesn't exist
94
- current = current[k]
95
- end
96
-
97
- # Set the value for the final key
98
- current[keys[-1]] = value
99
-
100
- # Write the JSON back to the file
101
- File.write(self, JSON.pretty_generate(data))
102
- end
103
-
104
- # Alias for set_json_value
105
- alias_method :assign, :set_json_value
106
-
107
- def strip_color_codes
108
- # Regular expression to remove ANSI color codes
109
- cleaned_content = self.gsub(/\e\[[\d;]+m/, "")
110
- cleaned_content
111
- end
112
-
113
- def to_lines(max_length = 80, indent_length = 5)
114
- if (self.length <= max_length)
115
- return self
116
- else
117
- indent = " " * indent_length
118
- words = self.split(" ")
119
- lines = []
120
- line = ""
121
- words.each do |word|
122
- if ((line + word).length > max_length)
123
- lines << line
124
- line = indent + word
125
- else
126
- if (line.length == 0)
127
- line = word
128
- else
129
- line += " " + word
130
- end
131
- end
132
- end
133
- lines << line
134
- return lines.join("\n")
135
- end
136
- end
137
- end
1
+ # frozen_string_literal: true
2
+ require "json"
3
+ # monkey patch String class with a run method
4
+
5
+ class String
6
+ def run(args = nil)
7
+ if args.nil?
8
+ command = self
9
+ Makit::RUNNER.run(Makit::RUNNER::parse_command_request(command))
10
+ else
11
+ command = self
12
+ request = Makit::RUNNER.parse_args(command)
13
+ if args.is_a?(Hash)
14
+ args.each do |key, value|
15
+ request.send("#{key}=", value)
16
+ end
17
+ end
18
+ Makit::RUNNER.run(request)
19
+ end
20
+ end
21
+
22
+ def cache_run()
23
+ command = self
24
+ Makit::RUNNER.cache_run(Makit::RUNNER::parse_command_request(command))
25
+ end
26
+
27
+ def cache_run(timestamp = nil)
28
+ if timestamp.nil?
29
+ timestamp = Makit::GIT_FILE_INFOS.first.mtime #GIT_FILE_INFOS. Makit::Directory.get_newest_git_file_timestamp(Makit::Directories::PROJECT_ROOT)
30
+ #timestamp = Makit::Timestamp.now
31
+ end
32
+
33
+ command = self
34
+ Makit::RUNNER.cache_run(Makit::RUNNER::parse_command_request(command), timestamp)
35
+ end
36
+
37
+ def try(args = nil)
38
+ if args.nil?
39
+ command = self
40
+ Makit::RUNNER.try(command)
41
+ else
42
+ command = self
43
+ request = Makit::RUNNER.parse_args(command)
44
+ if args.is_a?(Hash)
45
+ args.each do |key, value|
46
+ request.send("#{key}=", value)
47
+ end
48
+ end
49
+ Makit::RUNNER.try(request)
50
+ end
51
+ end
52
+
53
+ def cache_try()
54
+ command = self
55
+ Makit::RUNNER.cache_try(Makit::RUNNER::parse_command_request(command))
56
+ end
57
+
58
+ def cache_try(timestamp = nil)
59
+ if timestamp.nil?
60
+ timestamp = Makit::GIT_FILE_INFOS.first.mtime #GIT_FILE_INFOS. Makit::Directory.get_newest_git_file_timestamp(Makit::Directories::PROJECT_ROOT)
61
+ #timestamp = Makit::Timestamp.now
62
+ end
63
+
64
+ command = self
65
+ Makit::RUNNER.cache_try(Makit::RUNNER::parse_command_request(command), timestamp)
66
+ end
67
+
68
+ # Read a value from a JSON file
69
+ # key is a string with the key to read, e.g. "AzureAd.Authority"
70
+ def get_json_value(key)
71
+ json = File.read(self)
72
+ data = JSON.parse(json)
73
+
74
+ # key delimiter is '.' so we can access nested keys
75
+ key.split(".").each do |k|
76
+ data = data[k]
77
+ end
78
+ data
79
+ end
80
+
81
+ alias_method :retrieve, :get_json_value
82
+
83
+ # Set a value in a JSON file
84
+ # key is a string with the key to set, e.g. "AzureAd.Authority"
85
+ def set_json_value(key, value)
86
+ file = File.read(self)
87
+ data = JSON.parse(file)
88
+ keys = key.split(".")
89
+ current = data
90
+
91
+ # Traverse and create any missing keys
92
+ keys[0..-2].each do |k|
93
+ current[k] ||= {} # Create a new hash if the key doesn't exist
94
+ current = current[k]
95
+ end
96
+
97
+ # Set the value for the final key
98
+ current[keys[-1]] = value
99
+
100
+ # Write the JSON back to the file
101
+ File.write(self, JSON.pretty_generate(data))
102
+ end
103
+
104
+ # Alias for set_json_value
105
+ alias_method :assign, :set_json_value
106
+
107
+ def strip_color_codes
108
+ # Regular expression to remove ANSI color codes
109
+ cleaned_content = self.gsub(/\e\[[\d;]+m/, "")
110
+ cleaned_content
111
+ end
112
+
113
+ def to_lines(max_length = 80, indent_length = 5)
114
+ if (self.length <= max_length)
115
+ return self
116
+ else
117
+ indent = " " * indent_length
118
+ words = self.split(" ")
119
+ lines = []
120
+ line = ""
121
+ words.each do |word|
122
+ if ((line + word).length > max_length)
123
+ lines << line
124
+ line = indent + word
125
+ else
126
+ if (line.length == 0)
127
+ line = word
128
+ else
129
+ line += " " + word
130
+ end
131
+ end
132
+ end
133
+ lines << line
134
+ return lines.join("\n")
135
+ end
136
+ end
137
+ end
data/lib/makit/nuget.rb CHANGED
@@ -1,72 +1,72 @@
1
- require "tmpdir"
2
- # This module provides classes for the Makit gem.
3
- module Makit
4
- # This class provide methods for working with the Nuget package cache
5
- #
6
- # Example:
7
- #
8
- # Makit::Directory.cache("Google.Protobuf", "3.27.2")
9
- #
10
- # dotnet nuget locals all --list
11
- # dotnet nuget locals all --clear
12
- #
13
- class NuGet
14
- def self.get_cache_dir(package, version)
15
- File.join(Makit::Directories::NUGET_PACKAGE_CACHE, package, version)
16
- end
17
-
18
- def self.cache(package, version)
19
- # if the package is already cached, there is nothing to do
20
- if (!Dir.exist?(get_cache_dir(package, version)))
21
- Dir.mktmpdir do |dir|
22
- # Use the temp directory here
23
- Dir.chdir(dir) do
24
- system("dotnet new classlib -n ClassLib")
25
- Dir.chdir("ClassLib") do
26
-
27
- # display a list of directories in the current directory
28
- puts Dir.entries(Dir.pwd)
29
- # display a list of files in the current directory
30
- puts Dir.entries(Dir.pwd)
31
- puts "dotnet add ClassLib.csproj package #{package} --version #{version}"
32
- system("dotnet add ClassLib.csproj package #{package} --version #{version}")
33
- end
34
- end
35
- # The directory and its contents will be removed automatically after the block
36
- end
37
- end
38
- end
39
-
40
- def self.clear_cache(package, version)
41
- if (Dir.exist?(get_cache_dir(package, version)))
42
- FileUtils.rm_rf(get_cache_dir(package, version))
43
- end
44
- end
45
-
46
- # get the latest version of the package
47
- def self.get_latest_version(package)
48
- dir = File.join(Makit::Directories::NUGET_PACKAGE_CACHE, package)
49
- if (Dir.exist?(dir))
50
- versions = Dir.entries(dir).select { |entry| File.directory?(File.join(dir, entry)) && !(entry == "." || entry == "..") }
51
- highest_version = Makit::Version::get_highest_version(versions)
52
- return highest_version
53
- end
54
- nil
55
- end
56
-
57
- # publish a package to a nuget directory feed
58
- def self.add_package(package, path)
59
- system("dotnet nuget push #{path} --source #{path}")
60
- end
61
-
62
- def self.publish_to_directory(nuget_package_path,directory,package_name,version)
63
- target_package_path = "#{directory}/#{package_name}/#{version}/#{package_name}.#{version}.nupkg".downcase
64
- if (File.exist?(target_package_path))
65
- puts " #{target_package_path} already exists".colorize(:grey)
66
- else
67
- "dotnet nuget push #{nuget_package_path} --source #{directory}".run
68
- end
69
- end
70
-
71
- end
72
- end
1
+ require "tmpdir"
2
+ # This module provides classes for the Makit gem.
3
+ module Makit
4
+ # This class provide methods for working with the Nuget package cache
5
+ #
6
+ # Example:
7
+ #
8
+ # Makit::Directory.cache("Google.Protobuf", "3.27.2")
9
+ #
10
+ # dotnet nuget locals all --list
11
+ # dotnet nuget locals all --clear
12
+ #
13
+ class NuGet
14
+ def self.get_cache_dir(package, version)
15
+ File.join(Makit::Directories::NUGET_PACKAGE_CACHE, package, version)
16
+ end
17
+
18
+ def self.cache(package, version)
19
+ # if the package is already cached, there is nothing to do
20
+ if (!Dir.exist?(get_cache_dir(package, version)))
21
+ Dir.mktmpdir do |dir|
22
+ # Use the temp directory here
23
+ Dir.chdir(dir) do
24
+ system("dotnet new classlib -n ClassLib")
25
+ Dir.chdir("ClassLib") do
26
+
27
+ # display a list of directories in the current directory
28
+ puts Dir.entries(Dir.pwd)
29
+ # display a list of files in the current directory
30
+ puts Dir.entries(Dir.pwd)
31
+ puts "dotnet add ClassLib.csproj package #{package} --version #{version}"
32
+ system("dotnet add ClassLib.csproj package #{package} --version #{version}")
33
+ end
34
+ end
35
+ # The directory and its contents will be removed automatically after the block
36
+ end
37
+ end
38
+ end
39
+
40
+ def self.clear_cache(package, version)
41
+ if (Dir.exist?(get_cache_dir(package, version)))
42
+ FileUtils.rm_rf(get_cache_dir(package, version))
43
+ end
44
+ end
45
+
46
+ # get the latest version of the package
47
+ def self.get_latest_version(package)
48
+ dir = File.join(Makit::Directories::NUGET_PACKAGE_CACHE, package)
49
+ if (Dir.exist?(dir))
50
+ versions = Dir.entries(dir).select { |entry| File.directory?(File.join(dir, entry)) && !(entry == "." || entry == "..") }
51
+ highest_version = Makit::Version::get_highest_version(versions)
52
+ return highest_version
53
+ end
54
+ nil
55
+ end
56
+
57
+ # publish a package to a nuget directory feed
58
+ def self.add_package(package, path)
59
+ system("dotnet nuget push #{path} --source #{path}")
60
+ end
61
+
62
+ def self.publish_to_directory(nuget_package_path,directory,package_name,version)
63
+ target_package_path = "#{directory}/#{package_name}/#{version}/#{package_name}.#{version}.nupkg".downcase
64
+ if (File.exist?(target_package_path))
65
+ puts " #{target_package_path} already exists".colorize(:grey)
66
+ else
67
+ "dotnet nuget push #{nuget_package_path} --source #{directory}".run
68
+ end
69
+ end
70
+
71
+ end
72
+ end
data/lib/makit/process.rb CHANGED
@@ -1,26 +1,26 @@
1
- # This module provides classes for the Makit gem.
2
- module Makit
3
- class Process
4
- def self.is_running?(name)
5
- # provide a cross-platform way to check if a process is running
6
- if Makit::Environment.is_windows?
7
- # on windows, use the tasklist command
8
- results = `tasklist /FI "imagename eq #{name}.exe"`
9
- results.include?(name)
10
- else
11
- # on linux, use the ps command
12
- results = `ps aux | grep #{name} | grep -v grep`
13
- results.include?(name)
14
- end
15
- end
16
-
17
- def self.kill(name)
18
- # provide a cross-platform way to kill a process
19
- if Makit::Environment.is_windows?
20
- `taskkill /IM #{name}.exe /F`
21
- else
22
- `kill -9 #{name}`
23
- end
24
- end
25
- end
26
- end
1
+ # This module provides classes for the Makit gem.
2
+ module Makit
3
+ class Process
4
+ def self.is_running?(name)
5
+ # provide a cross-platform way to check if a process is running
6
+ if Makit::Environment.is_windows?
7
+ # on windows, use the tasklist command
8
+ results = `tasklist /FI "imagename eq #{name}.exe"`
9
+ results.include?(name)
10
+ else
11
+ # on linux, use the ps command
12
+ results = `ps aux | grep #{name} | grep -v grep`
13
+ results.include?(name)
14
+ end
15
+ end
16
+
17
+ def self.kill(name)
18
+ # provide a cross-platform way to kill a process
19
+ if Makit::Environment.is_windows?
20
+ `taskkill /IM #{name}.exe /F`
21
+ else
22
+ `kill -9 #{name}`
23
+ end
24
+ end
25
+ end
26
+ end