makit 0.0.88 → 0.0.90

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 (61) 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 +145 -145
  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 +139 -131
  29. data/lib/makit/fileinfo.rb +26 -26
  30. data/lib/makit/files.rb +47 -47
  31. data/lib/makit/gems.rb +38 -38
  32. data/lib/makit/git.rb +145 -145
  33. data/lib/makit/gitlab_runner.rb +60 -60
  34. data/lib/makit/humanize.rb +129 -129
  35. data/lib/makit/indexer.rb +56 -56
  36. data/lib/makit/logging.rb +106 -106
  37. data/lib/makit/markdown.rb +75 -75
  38. data/lib/makit/mp/basic_object_mp.rb +16 -16
  39. data/lib/makit/mp/command_mp.rb +13 -13
  40. data/lib/makit/mp/command_request.mp.rb +16 -16
  41. data/lib/makit/mp/project_mp.rb +210 -210
  42. data/lib/makit/mp/string_mp.rb +153 -137
  43. data/lib/makit/nuget.rb +72 -72
  44. data/lib/makit/process.rb +56 -26
  45. data/lib/makit/protoc.rb +104 -104
  46. data/lib/makit/rake.rb +25 -25
  47. data/lib/makit/secrets.rb +51 -51
  48. data/lib/makit/serializer.rb +115 -115
  49. data/lib/makit/show.rb +110 -110
  50. data/lib/makit/storage.rb +131 -131
  51. data/lib/makit/symbols.rb +149 -149
  52. data/lib/makit/task_info.rb +86 -86
  53. data/lib/makit/tasks.rb +150 -150
  54. data/lib/makit/tree.rb +37 -37
  55. data/lib/makit/v1/makit.v1_services_pb.rb +25 -25
  56. data/lib/makit/version.rb +65 -65
  57. data/lib/makit/wix.rb +95 -95
  58. data/lib/makit/yaml.rb +17 -17
  59. data/lib/makit/zip.rb +17 -17
  60. data/lib/makit.rb +267 -267
  61. metadata +5 -6
@@ -1,131 +1,139 @@
1
- # frozen_string_literal: true
2
-
3
- require "sorted_set"
4
- require_relative "directory"
5
- # This module provides classes for the Makit gem.
6
- module Makit
7
- # This class provide methods for working with the system Environment.
8
- #
9
- class Environment
10
- def self.which(name)
11
- return name if File.exist?(name)
12
-
13
- ["", ".exe", ".bat", ".cmd"].each do |ext|
14
- aname = name + ext
15
- return aname if File.exist?(aname)
16
-
17
- ENV["PATH"].split(File::PATH_SEPARATOR).each do |path|
18
- apath = "#{path.gsub("\\", "/")}/#{aname}".gsub("//", "/")
19
- return apath if File.exist?(apath)
20
- end
21
- end
22
- ""
23
- end
24
-
25
- def self.constants_hash
26
- constants = {}
27
- # collect all constants that are all uppercase
28
- Object.constants.each { |c| constants[c] = Object.const_get(c) if c == c.upcase } # puts "#{c} = #{Object.const_get(c)}" }
29
- #Object.constants.each { |c| constants[c] = Object.const_get(c)}# puts "#{c} = #{Object.const_get(c)}" }
30
- constants
31
- end
32
-
33
- def self.rake_file_name
34
- caller_locations.each do |location|
35
- return location.absolute_path if location.absolute_path&.end_with?("Rakefile")
36
- end
37
- nil
38
- end
39
-
40
- def self.gem_data_directory
41
- gem_data_directory = File.join(Dir.home, ".makit")
42
- end
43
-
44
- def self.project_root_directory
45
- if !Makit::Environment.rake_file_name.nil?
46
- File.dirname(Makit::Environment.rake_file_name)
47
- else
48
- Makit::Directory.find_directory_with_pattern(File.dirname(__FILE__), "Rakefile")
49
- # lass Directory
50
- # def self.find_directory_with_pattern(starting_directory, pattern)
51
- # nil
52
- end
53
- end
54
-
55
- def self.get_relative_directory(url)
56
- url = url.gsub("https://", "").gsub("http://", "")
57
- url = url.gsub("gitlab.com", "gitlab")
58
- url
59
- end
60
-
61
- def self.get_code_root
62
- # user home directory + "code"
63
- code_root = File.join(Dir.home, "code")
64
- end
65
-
66
- def self.get_work_directory(url)
67
- raise "invalid url" if !url.include? "https://"
68
- url = url.gsub("https://", "").gsub("http://", "")
69
- #url = url.gsub("gitlab.com","gitlab")
70
- url
71
- end
72
-
73
- def self.is_windows?
74
- RbConfig::CONFIG["host_os"] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/
75
- end
76
-
77
- def self.is_mac?
78
- RbConfig::CONFIG["host_os"] =~ /darwin/
79
- end
80
-
81
- def self.is_linux?
82
- RbConfig::CONFIG["host_os"] =~ /linux/
83
- end
84
-
85
- def self.get_os
86
- case RbConfig::CONFIG["host_os"]
87
- when /linux/
88
- "Linux"
89
- when /darwin/
90
- "macOS"
91
- when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
92
- "Windows"
93
- else
94
- "Unknown"
95
- end
96
- end
97
-
98
- def self.get_runtime_identifier()
99
- os = RbConfig::CONFIG["host_os"]
100
- cpu = RbConfig::CONFIG["host_cpu"]
101
-
102
- case os
103
- when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
104
- os_rid = "win"
105
- when /darwin|mac os/
106
- os_rid = "osx"
107
- when /linux/
108
- os_rid = "linux"
109
- when /solaris|bsd/
110
- os_rid = "unix"
111
- else
112
- raise "Unknown operating system: host_os=#{os}"
113
- end
114
-
115
- case cpu
116
- when /x86_64|amd64|x64/
117
- arch_rid = "x64"
118
- when /i686|i386/
119
- arch_rid = "x86"
120
- #when /arm/
121
- # arch_rid = "arm"
122
- when /aarch64|arm64/
123
- arch_rid = "arm64"
124
- else
125
- raise "Unknown architecture: host_cpu=#{cpu}"
126
- end
127
-
128
- "#{os_rid}-#{arch_rid}"
129
- end
130
- end
131
- end
1
+ # frozen_string_literal: true
2
+
3
+ require "sorted_set"
4
+ require_relative "directory"
5
+ # This module provides classes for the Makit gem.
6
+ module Makit
7
+ # This class provide methods for working with the system Environment.
8
+ #
9
+ class Environment
10
+ def self.current_user
11
+ if Makit::Environment.is_windows?
12
+ `whoami`
13
+ else
14
+ `whoami`
15
+ end
16
+ end
17
+
18
+ def self.which(name)
19
+ return name if File.exist?(name)
20
+
21
+ ["", ".exe", ".bat", ".cmd"].each do |ext|
22
+ aname = name + ext
23
+ return aname if File.exist?(aname)
24
+
25
+ ENV["PATH"].split(File::PATH_SEPARATOR).each do |path|
26
+ apath = "#{path.gsub("\\", "/")}/#{aname}".gsub("//", "/")
27
+ return apath if File.exist?(apath)
28
+ end
29
+ end
30
+ ""
31
+ end
32
+
33
+ def self.constants_hash
34
+ constants = {}
35
+ # collect all constants that are all uppercase
36
+ Object.constants.each { |c| constants[c] = Object.const_get(c) if c == c.upcase } # puts "#{c} = #{Object.const_get(c)}" }
37
+ #Object.constants.each { |c| constants[c] = Object.const_get(c)}# puts "#{c} = #{Object.const_get(c)}" }
38
+ constants
39
+ end
40
+
41
+ def self.rake_file_name
42
+ caller_locations.each do |location|
43
+ return location.absolute_path if location.absolute_path&.end_with?("Rakefile")
44
+ end
45
+ nil
46
+ end
47
+
48
+ def self.gem_data_directory
49
+ gem_data_directory = File.join(Dir.home, ".makit")
50
+ end
51
+
52
+ def self.project_root_directory
53
+ if !Makit::Environment.rake_file_name.nil?
54
+ File.dirname(Makit::Environment.rake_file_name)
55
+ else
56
+ Makit::Directory.find_directory_with_pattern(File.dirname(__FILE__), "Rakefile")
57
+ # lass Directory
58
+ # def self.find_directory_with_pattern(starting_directory, pattern)
59
+ # nil
60
+ end
61
+ end
62
+
63
+ def self.get_relative_directory(url)
64
+ url = url.gsub("https://", "").gsub("http://", "")
65
+ url = url.gsub("gitlab.com", "gitlab")
66
+ url
67
+ end
68
+
69
+ def self.get_code_root
70
+ # user home directory + "code"
71
+ code_root = File.join(Dir.home, "code")
72
+ end
73
+
74
+ def self.get_work_directory(url)
75
+ raise "invalid url" if !url.include? "https://"
76
+ url = url.gsub("https://", "").gsub("http://", "")
77
+ #url = url.gsub("gitlab.com","gitlab")
78
+ url
79
+ end
80
+
81
+ def self.is_windows?
82
+ RbConfig::CONFIG["host_os"] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/
83
+ end
84
+
85
+ def self.is_mac?
86
+ RbConfig::CONFIG["host_os"] =~ /darwin/
87
+ end
88
+
89
+ def self.is_linux?
90
+ RbConfig::CONFIG["host_os"] =~ /linux/
91
+ end
92
+
93
+ def self.get_os
94
+ case RbConfig::CONFIG["host_os"]
95
+ when /linux/
96
+ "Linux"
97
+ when /darwin/
98
+ "macOS"
99
+ when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
100
+ "Windows"
101
+ else
102
+ "Unknown"
103
+ end
104
+ end
105
+
106
+ def self.get_runtime_identifier()
107
+ os = RbConfig::CONFIG["host_os"]
108
+ cpu = RbConfig::CONFIG["host_cpu"]
109
+
110
+ case os
111
+ when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
112
+ os_rid = "win"
113
+ when /darwin|mac os/
114
+ os_rid = "osx"
115
+ when /linux/
116
+ os_rid = "linux"
117
+ when /solaris|bsd/
118
+ os_rid = "unix"
119
+ else
120
+ raise "Unknown operating system: host_os=#{os}"
121
+ end
122
+
123
+ case cpu
124
+ when /x86_64|amd64|x64/
125
+ arch_rid = "x64"
126
+ when /i686|i386/
127
+ arch_rid = "x86"
128
+ #when /arm/
129
+ # arch_rid = "arm"
130
+ when /aarch64|arm64/
131
+ arch_rid = "arm64"
132
+ else
133
+ raise "Unknown architecture: host_cpu=#{cpu}"
134
+ end
135
+
136
+ "#{os_rid}-#{arch_rid}"
137
+ end
138
+ end
139
+ end
@@ -1,26 +1,26 @@
1
- # frozen_string_literal: true
2
-
3
- # This module provides classes for the Makit gem.
4
- module Makit
5
- # This class provide methods for working with the system Environment.
6
- #
7
- class FileInfo
8
- attr_accessor :name, :mtime, :size
9
-
10
- def initialize(name:, mtime:, size:)
11
- @name = name
12
- @mtime = mtime
13
- @size = size
14
- end
15
-
16
- def self.get_file_infos(filenames)
17
- filenames.map do |filename|
18
- begin
19
- FileInfo.new(name: filename, mtime: File.mtime(filename), size: File.size(filename))
20
- rescue
21
- next
22
- end
23
- end
24
- end
25
- end
26
- end
1
+ # frozen_string_literal: true
2
+
3
+ # This module provides classes for the Makit gem.
4
+ module Makit
5
+ # This class provide methods for working with the system Environment.
6
+ #
7
+ class FileInfo
8
+ attr_accessor :name, :mtime, :size
9
+
10
+ def initialize(name:, mtime:, size:)
11
+ @name = name
12
+ @mtime = mtime
13
+ @size = size
14
+ end
15
+
16
+ def self.get_file_infos(filenames)
17
+ filenames.map do |filename|
18
+ begin
19
+ FileInfo.new(name: filename, mtime: File.mtime(filename), size: File.size(filename))
20
+ rescue
21
+ next
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
data/lib/makit/files.rb CHANGED
@@ -1,47 +1,47 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "directory"
4
- require_relative "environment"
5
- require_relative "protoc"
6
- require_relative "nuget"
7
- require_relative "version"
8
- require "rake"
9
-
10
- # This module provides classes for the Makit gem.
11
- module Makit
12
- # This class provide methods for working with the system Environment.
13
- #
14
- module Files
15
- if (Makit::Directories::PROJECT_ROOT != nil)
16
- Dir.chdir(Makit::Directories::PROJECT_ROOT) do
17
- CSPROJ = Dir.glob("**/*.csproj")
18
- end
19
- else
20
- CSPROJ = Array.new
21
- end
22
-
23
- # show all the files constants in a nicely formatted table format with the name of the constant and the value
24
- def self.show
25
- # Array of constant names (symbols)
26
- constant_names = [:CSPROJ]
27
-
28
- # Find the length of the longest constant name and add 1
29
- max_length = constant_names.map(&:to_s).max_by(&:length).length + 1
30
-
31
- # Iterate through each constant name
32
- constant_names.each do |constant_name|
33
- begin
34
- constant_value = const_get(constant_name) # Fetch the value of the constant
35
- if (constant_value != nil && File.exist?(constant_value))
36
- constant_value = constant_value.colorize(:green)
37
- end
38
- # Print the constant name right justified to the max_length
39
- puts "#{constant_name.to_s.rjust(max_length)} = #{constant_value}"
40
- rescue NameError
41
- # Handle the case where the constant is not defined
42
- puts "#{constant_name.to_s.rjust(max_length)} = [Constant not defined]"
43
- end
44
- end
45
- end
46
- end # module Files
47
- end # module Makit
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "directory"
4
+ require_relative "environment"
5
+ require_relative "protoc"
6
+ require_relative "nuget"
7
+ require_relative "version"
8
+ require "rake"
9
+
10
+ # This module provides classes for the Makit gem.
11
+ module Makit
12
+ # This class provide methods for working with the system Environment.
13
+ #
14
+ module Files
15
+ if (Makit::Directories::PROJECT_ROOT != nil)
16
+ Dir.chdir(Makit::Directories::PROJECT_ROOT) do
17
+ CSPROJ = Dir.glob("**/*.csproj")
18
+ end
19
+ else
20
+ CSPROJ = Array.new
21
+ end
22
+
23
+ # show all the files constants in a nicely formatted table format with the name of the constant and the value
24
+ def self.show
25
+ # Array of constant names (symbols)
26
+ constant_names = [:CSPROJ]
27
+
28
+ # Find the length of the longest constant name and add 1
29
+ max_length = constant_names.map(&:to_s).max_by(&:length).length + 1
30
+
31
+ # Iterate through each constant name
32
+ constant_names.each do |constant_name|
33
+ begin
34
+ constant_value = const_get(constant_name) # Fetch the value of the constant
35
+ if (constant_value != nil && File.exist?(constant_value))
36
+ constant_value = constant_value.colorize(:green)
37
+ end
38
+ # Print the constant name right justified to the max_length
39
+ puts "#{constant_name.to_s.rjust(max_length)} = #{constant_value}"
40
+ rescue NameError
41
+ # Handle the case where the constant is not defined
42
+ puts "#{constant_name.to_s.rjust(max_length)} = [Constant not defined]"
43
+ end
44
+ end
45
+ end
46
+ end # module Files
47
+ end # module Makit
data/lib/makit/gems.rb CHANGED
@@ -1,39 +1,39 @@
1
- # frozen_string_literal: true
2
-
3
- # This module provides classes for the Makit gem.
4
- module Makit
5
- # This class provide methods for working with the system Environment.
6
- #
7
- module Gems
8
- def self.install_latest_gem(gem_name)
9
- if(!is_gem_installed(gem_name))
10
- "gem install #{gem_name}".run
11
- puts " #{gem_name} gem installed".colorize(:green)
12
- else
13
- latest_version = get_latest_gem_version(gem_name)
14
- installed_version = get_installed_gem_version(gem_name)
15
- if(installed_version != latest_version)
16
- "gem install #{gem_name}".run
17
- puts " #{gem_name} gem updated to #{latest_version}".colorize(:green)
18
- else
19
- puts " #{gem_name} gem is up to date".colorize(:green)
20
- end
21
- end
22
- end
23
-
24
- def self.is_gem_installed(gem_name)
25
- `gem list #{gem_name}`
26
- $?.success?
27
- end
28
-
29
-
30
- def self.get_installed_gem_version(gem_name)
31
- versions = `gem list #{gem_name}`.split("(")[1].split(")")[0].split(",")
32
- versions.first.strip
33
- end
34
-
35
- def self.get_latest_gem_version(gem_name)
36
- `gem search #{gem_name} --remote --exact`.split("(")[1].split(")")[0]
37
- end
38
- end # class Gem
1
+ # frozen_string_literal: true
2
+
3
+ # This module provides classes for the Makit gem.
4
+ module Makit
5
+ # This class provide methods for working with the system Environment.
6
+ #
7
+ module Gems
8
+ def self.install_latest_gem(gem_name)
9
+ if(!is_gem_installed(gem_name))
10
+ "gem install #{gem_name}".run
11
+ puts " #{gem_name} gem installed".colorize(:green)
12
+ else
13
+ latest_version = get_latest_gem_version(gem_name)
14
+ installed_version = get_installed_gem_version(gem_name)
15
+ if(installed_version != latest_version)
16
+ "gem install #{gem_name}".run
17
+ puts " #{gem_name} gem updated to #{latest_version}".colorize(:green)
18
+ else
19
+ puts " #{gem_name} gem is up to date".colorize(:green)
20
+ end
21
+ end
22
+ end
23
+
24
+ def self.is_gem_installed(gem_name)
25
+ `gem list #{gem_name}`
26
+ $?.success?
27
+ end
28
+
29
+
30
+ def self.get_installed_gem_version(gem_name)
31
+ versions = `gem list #{gem_name}`.split("(")[1].split(")")[0].split(",")
32
+ versions.first.strip
33
+ end
34
+
35
+ def self.get_latest_gem_version(gem_name)
36
+ `gem search #{gem_name} --remote --exact`.split("(")[1].split(")")[0]
37
+ end
38
+ end # class Gem
39
39
  end # module Makit