makit 0.0.0 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/lib/makit/apache.rb +32 -32
  3. data/lib/makit/cli/clean.rb +14 -14
  4. data/lib/makit/cli/clone.rb +59 -59
  5. data/lib/makit/cli/init.rb +38 -38
  6. data/lib/makit/cli/main.rb +33 -33
  7. data/lib/makit/cli/make.rb +54 -54
  8. data/lib/makit/cli/new.rb +37 -37
  9. data/lib/makit/cli/nuget_cache.rb +38 -38
  10. data/lib/makit/cli/pull.rb +31 -31
  11. data/lib/makit/cli/setup.rb +71 -71
  12. data/lib/makit/cli/work.rb +21 -21
  13. data/lib/makit/command_runner.rb +274 -237
  14. data/lib/makit/commands.rb +21 -21
  15. data/lib/makit/content/default_gitignore.rb +5 -5
  16. data/lib/makit/content/default_rakefile.rb +11 -11
  17. data/lib/makit/content/gem_rakefile.rb +14 -14
  18. data/lib/makit/data.rb +50 -50
  19. data/lib/makit/directories.rb +140 -140
  20. data/lib/makit/directory.rb +151 -120
  21. data/lib/makit/dotnet.rb +83 -16
  22. data/lib/makit/environment.rb +123 -123
  23. data/lib/makit/files.rb +47 -47
  24. data/lib/makit/git.rb +66 -66
  25. data/lib/makit/gitlab_runner.rb +60 -60
  26. data/lib/makit/humanize.rb +89 -89
  27. data/lib/makit/logging.rb +96 -96
  28. data/lib/makit/markdown.rb +75 -75
  29. data/lib/makit/mp/basic_object_mp.rb +16 -16
  30. data/lib/makit/mp/command_request.mp.rb +13 -0
  31. data/lib/makit/mp/project_mp.rb +156 -160
  32. data/lib/makit/mp/string_mp.rb +101 -101
  33. data/lib/makit/nuget.rb +57 -57
  34. data/lib/makit/protoc.rb +61 -61
  35. data/lib/makit/serializer.rb +115 -70
  36. data/lib/makit/storage.rb +131 -131
  37. data/lib/makit/symbols.rb +149 -149
  38. data/lib/makit/tasks.rb +67 -63
  39. data/lib/makit/tree.rb +37 -37
  40. data/lib/makit/v1/makit.v1_pb.rb +5 -5
  41. data/lib/makit/v1/makit.v1_services_pb.rb +25 -26
  42. data/lib/makit/version.rb +12 -12
  43. data/lib/makit/wix.rb +95 -92
  44. data/lib/makit/zip.rb +17 -17
  45. data/lib/makit.rb +243 -243
  46. metadata +8 -43
  47. data/.makit.project.json +0 -4
  48. data/.makit.project.yml +0 -2
  49. data/.rubocop.yml +0 -22
  50. data/.ruby-version +0 -1
  51. data/CHANGELOG.md +0 -8
  52. data/CODE_OF_CONDUCT.md +0 -84
  53. data/LICENSE +0 -21
  54. data/README.md +0 -119
  55. data/Rakefile +0 -190
  56. data/docs/Commands.md +0 -50
  57. data/docs_/Commands.md +0 -166
  58. data/docs_/Minitest.Timeouts.md +0 -332
  59. data/examples/protoc/Rakefile +0 -31
  60. data/examples/rake_default/Rakefile +0 -5
  61. data/examples/rubygem-foo/.gitkeep +0 -0
  62. data/examples/rubygem-foo/Rakefile +0 -3
  63. data/examples/run_mp/Rakefile +0 -8
  64. data/exe/makit +0 -5
  65. data/lib/makit/content/default_gitignore.txt +0 -222
  66. data/lib/makit/content/ruby_gitlab-ci.yml +0 -15
  67. data/lib/makit/v1/makit.v1.proto +0 -103
  68. data/makit.generated.sln +0 -30
  69. data/makit.sln +0 -69
  70. data/pages/.gitignore +0 -5
  71. data/pages/404.html +0 -25
  72. data/pages/Gemfile +0 -33
  73. data/pages/Gemfile.lock +0 -88
  74. data/pages/_config.yml +0 -55
  75. data/pages/_layouts/default.html +0 -1
  76. data/pages/_posts/2024-10-05-welcome-to-jekyll.markdown +0 -29
  77. data/pages/about.markdown +0 -18
  78. data/pages/index.markdown +0 -6
  79. data/sig/makit.rbs +0 -4
  80. data/src/ClassLib/Class1.cs +0 -6
  81. data/src/ClassLib/ClassLib.csproj +0 -13
data/lib/makit/storage.rb CHANGED
@@ -1,131 +1,131 @@
1
- # frozen_string_literal: true
2
-
3
- # This module provides classes for the Makit gem.
4
- module Makit
5
- # This class provide methods for serializing and deserializing objects.
6
- #
7
- class Storage
8
- # declare a private class variable, connection_string
9
- attr_accessor :directory #= nil
10
- attr_accessor :protoc_json_serializer # = Makit::Serializer::new()
11
- attr_accessor :protoc_binary_serializer # = Makit::Serializer::new()
12
-
13
- def initialize(directory)
14
- @directory = directory
15
- @protoc_json_serializer = Makit::Serializer::new(Makit::Proto3Formats::JSON)
16
- @protoc_binary_serializer = Makit::Serializer::new(Makit::Proto3Formats::BINARY)
17
- end
18
-
19
- def save(object, key)
20
- puts "=" * 80
21
- puts "Saving object to storage"
22
- puts "=" * 80
23
- raise "directory is nil" if @directory.nil?
24
- raise "Object is nil" if object.nil?
25
- raise "Key is nil" if key.nil?
26
-
27
- # get the fully qualfied type name of the object
28
- type_name = object.class.to_s
29
- puts "Type name: #{type_name}"
30
-
31
- type_rel_dir = type_name.downcase.gsub("::", "/")
32
- puts "Type relative directory: #{type_rel_dir}"
33
-
34
- # extract the file extension from the key
35
- file_extension = File.extname(key)
36
- puts "File extension: #{file_extension}"
37
-
38
- serializer = nil
39
- if file_extension == ".json"
40
- serializer = @protoc_json_serializer
41
- elsif file_extension == ".pb"
42
- serializer = @protoc_binary_serializer
43
- else
44
- raise "Unknown file extension: #{file_extension}"
45
- end
46
- bytes = serializer.serialize(object)
47
- puts "Serialized object size: #{bytes.size} bytes"
48
-
49
- rel_filename = File.join(type_rel_dir, "#{key}")
50
- puts "Relative filename: #{rel_filename}"
51
-
52
- filename = File.join(@directory, rel_filename)
53
- puts "Saving object to file: #{filename}"
54
-
55
- # make sure the file directory has been created
56
- FileUtils.mkdir_p(File.dirname(filename)) unless File.directory?(File.dirname(filename))
57
- # write the bytes to the file
58
- File.open(filename, "wb") do |file|
59
- file.write(bytes)
60
- end
61
-
62
- puts "=" * 80
63
- end
64
-
65
- def load(type, key)
66
- raise "directory is nil" if @directory.nil?
67
- raise "Key is nil" if key.nil?
68
-
69
- # get the fully qualfied type name of the object
70
- type_name = type.to_s # object.class.to_s
71
- puts "Type name: #{type_name}"
72
-
73
- type_rel_dir = type_name.downcase.gsub("::", "/")
74
- puts "Type relative directory: #{type_rel_dir}"
75
-
76
- # extract the file extension from the key
77
- file_extension = File.extname(key)
78
- puts "File extension: #{file_extension}"
79
-
80
- rel_filename = File.join(type_rel_dir, "#{key}")
81
- puts "Relative filename: #{rel_filename}"
82
-
83
- filename = File.join(@directory, rel_filename)
84
- puts "Loading object from file: #{filename}"
85
-
86
- # make sure the file exists
87
- raise "File does not exist: #{filename}" unless File.exist?(filename)
88
-
89
- # read the bytes from the file
90
- bytes = File.read(filename, mode: "rb")
91
- puts "Read object from file: #{filename}"
92
-
93
- # extract the file extension from the key
94
- file_extension = File.extname(key)
95
- puts "File extension: #{file_extension}"
96
-
97
- serializer = nil
98
- if file_extension == ".json"
99
- serializer = @protoc_json_serializer
100
- elsif file_extension == ".pb"
101
- serializer = @protoc_binary_serializer
102
- else
103
- raise "Unknown file extension: #{file_extension}"
104
- end
105
-
106
- # deserialize the object
107
- object = serializer.deserialize(type, bytes)
108
- puts "Deserialized object size: #{bytes.size} bytes"
109
-
110
- # if the object type inherits from Google::Protobuf::AbstractMessage,
111
- # then serialize to protobuf json format
112
- #if object.is_a? Google::Protobuf::MessageExts
113
- # puts "Serializing to protobuf json format"
114
- # serialized_object = object.to_json
115
- # pretty_json = JSON.pretty_generate(JSON.parse(serialized_object))
116
- # puts pretty_json
117
- #else
118
- # puts "Serializing to Marshal format"
119
- # serialized_object = Marshal.dump(object)
120
- #end
121
- # serialize the object
122
- #serialized_object = Marshal.dump(object)
123
-
124
- # save the object to the storage
125
- # ...
126
- puts "=" * 80
127
-
128
- object
129
- end
130
- end # class Storage
131
- end # module Makit
1
+ # frozen_string_literal: true
2
+
3
+ # This module provides classes for the Makit gem.
4
+ module Makit
5
+ # This class provide methods for serializing and deserializing objects.
6
+ #
7
+ class Storage
8
+ # declare a private class variable, connection_string
9
+ attr_accessor :directory #= nil
10
+ attr_accessor :protoc_json_serializer # = Makit::Serializer::new()
11
+ attr_accessor :protoc_binary_serializer # = Makit::Serializer::new()
12
+
13
+ def initialize(directory)
14
+ @directory = directory
15
+ @protoc_json_serializer = Makit::Serializer::new(Makit::Proto3Formats::JSON)
16
+ @protoc_binary_serializer = Makit::Serializer::new(Makit::Proto3Formats::BINARY)
17
+ end
18
+
19
+ def save(object, key)
20
+ #puts "=" * 80
21
+ #puts "Saving object to storage"
22
+ # puts "=" * 80
23
+ raise "directory is nil" if @directory.nil?
24
+ raise "Object is nil" if object.nil?
25
+ raise "Key is nil" if key.nil?
26
+
27
+ # get the fully qualfied type name of the object
28
+ type_name = object.class.to_s
29
+ #puts "Type name: #{type_name}"
30
+
31
+ type_rel_dir = type_name.downcase.gsub("::", "/")
32
+ #puts "Type relative directory: #{type_rel_dir}"
33
+
34
+ # extract the file extension from the key
35
+ file_extension = File.extname(key)
36
+ #puts "File extension: #{file_extension}"
37
+
38
+ serializer = nil
39
+ if file_extension == ".json"
40
+ serializer = @protoc_json_serializer
41
+ elsif file_extension == ".pb"
42
+ serializer = @protoc_binary_serializer
43
+ else
44
+ raise "Unknown file extension: #{file_extension}"
45
+ end
46
+ bytes = serializer.serialize(object)
47
+ #puts "Serialized object size: #{bytes.size} bytes"
48
+
49
+ rel_filename = File.join(type_rel_dir, "#{key}")
50
+ #puts "Relative filename: #{rel_filename}"
51
+
52
+ filename = File.join(@directory, rel_filename)
53
+ #puts "Saving object to file: #{filename}"
54
+
55
+ # make sure the file directory has been created
56
+ FileUtils.mkdir_p(File.dirname(filename)) unless File.directory?(File.dirname(filename))
57
+ # write the bytes to the file
58
+ File.open(filename, "wb") do |file|
59
+ file.write(bytes)
60
+ end
61
+
62
+ #puts "=" * 80
63
+ end
64
+
65
+ def load(type, key)
66
+ raise "directory is nil" if @directory.nil?
67
+ raise "Key is nil" if key.nil?
68
+
69
+ # get the fully qualfied type name of the object
70
+ type_name = type.to_s # object.class.to_s
71
+ #puts "Type name: #{type_name}"
72
+
73
+ type_rel_dir = type_name.downcase.gsub("::", "/")
74
+ #puts "Type relative directory: #{type_rel_dir}"
75
+
76
+ # extract the file extension from the key
77
+ file_extension = File.extname(key)
78
+ #puts "File extension: #{file_extension}"
79
+
80
+ rel_filename = File.join(type_rel_dir, "#{key}")
81
+ #puts "Relative filename: #{rel_filename}"
82
+
83
+ filename = File.join(@directory, rel_filename)
84
+ #puts "Loading object from file: #{filename}"
85
+
86
+ # make sure the file exists
87
+ raise "File does not exist: #{filename}" unless File.exist?(filename)
88
+
89
+ # read the bytes from the file
90
+ bytes = File.read(filename, mode: "rb")
91
+ #puts "Read object from file: #{filename}"
92
+
93
+ # extract the file extension from the key
94
+ file_extension = File.extname(key)
95
+ #puts "File extension: #{file_extension}"
96
+
97
+ serializer = nil
98
+ if file_extension == ".json"
99
+ serializer = @protoc_json_serializer
100
+ elsif file_extension == ".pb"
101
+ serializer = @protoc_binary_serializer
102
+ else
103
+ raise "Unknown file extension: #{file_extension}"
104
+ end
105
+
106
+ # deserialize the object
107
+ object = serializer.deserialize(type, bytes)
108
+ #puts "Deserialized object size: #{bytes.size} bytes"
109
+
110
+ # if the object type inherits from Google::Protobuf::AbstractMessage,
111
+ # then serialize to protobuf json format
112
+ #if object.is_a? Google::Protobuf::MessageExts
113
+ # puts "Serializing to protobuf json format"
114
+ # serialized_object = object.to_json
115
+ # pretty_json = JSON.pretty_generate(JSON.parse(serialized_object))
116
+ # puts pretty_json
117
+ #else
118
+ # puts "Serializing to Marshal format"
119
+ # serialized_object = Marshal.dump(object)
120
+ #end
121
+ # serialize the object
122
+ #serialized_object = Marshal.dump(object)
123
+
124
+ # save the object to the storage
125
+ # ...
126
+ #puts "=" * 80
127
+
128
+ object
129
+ end
130
+ end # class Storage
131
+ end # module Makit
data/lib/makit/symbols.rb CHANGED
@@ -1,149 +1,149 @@
1
- # frozen_string_literal: true
2
-
3
- require "rainbow"
4
-
5
- # https://symbl.cc/en/unicode/table/
6
- module Makit
7
- class Symbols
8
- def self.checkmark
9
- "\u2713"
10
- end
11
-
12
- def self.success
13
- "\u2713"
14
- end
15
-
16
- def self.error
17
- Rainbow("\u0058").red
18
- end
19
-
20
- def self.warning
21
- Rainbow("\u26A0").yellow
22
- end
23
-
24
- def self.debug
25
- Rainbow("\u24D8").blue # Circle with "i"
26
- end
27
-
28
- def self.info
29
- Rainbow("\u2139").blue # Information source
30
- end
31
-
32
- def self.fatal
33
- Rainbow("\u25A0").bright.red # Filled square, indicating stop/critical
34
- end
35
-
36
- def self.warn
37
- Rainbow("\u26A0").yellow # Warning sign
38
- end
39
-
40
- def self.star
41
- Rainbow("\u2605").yellow # Star
42
- end
43
-
44
- def self.coffee
45
- Rainbow("\u2615").yellow # Hot beverage
46
- end
47
-
48
- def self.heart
49
- Rainbow("\u2764").red # Heavy black heart
50
- end
51
-
52
- def self.bug
53
- Rainbow("\u1F41E").yellow # Bug
54
- end
55
-
56
- def self.gear
57
- Rainbow("\u2699").yellow # Gear
58
- end
59
-
60
- def self.magnifying_glass
61
- Rainbow("\u1F50D").yellow # Left-pointing magnifying glass
62
- end
63
-
64
- def self.question
65
- Rainbow("\u003F").yellow # Question mark
66
- end
67
-
68
- def self.arrow_right
69
- Rainbow("\u27A4").yellow # Arrow pointing rightwards then curving upwards
70
- end
71
-
72
- def self.arrow_left
73
- Rainbow("\u2B05").yellow # Left arrow
74
- end
75
-
76
- def self.arrow_up
77
- Rainbow("\u2B06").yellow # Up arrow
78
- end
79
-
80
- def self.arrow_down
81
- Rainbow("\u2B07").yellow # Down arrow
82
- end
83
-
84
- def self.arrow_up_down
85
- Rainbow("\u2195").yellow # Up/down arrow
86
- end
87
-
88
- def self.arrow_left_right
89
- Rainbow("\u2194").yellow # Left/right arrow
90
- end
91
-
92
- def self.arrow_upper_right
93
- Rainbow("\u2197").yellow # North east arrow
94
- end
95
-
96
- def self.arrow_lower_right
97
- Rainbow("\u2198").yellow # South east arrow
98
- end
99
-
100
- def self.arrow_lower_left
101
- Rainbow("\u2199").yellow # South west arrow
102
- end
103
-
104
- def self.arrow_upper_left
105
- Rainbow("\u2196").yellow # North west arrow
106
- end
107
-
108
- def self.arrow_up_small
109
- Rainbow("\u2B06").yellow # Up arrow
110
- end
111
-
112
- def self.arrow_down_small
113
- Rainbow("\u2B07").yellow # Down arrow
114
- end
115
-
116
- def self.arrow_right_small
117
- Rainbow("\u27A1").yellow # Black rightwards arrow
118
- end
119
-
120
- def self.arrow_left_small
121
- Rainbow("\u2B05").yellow # Left arrow
122
- end
123
-
124
- def self.arrow_up_down_small
125
- Rainbow("\u2195").yellow # Up/down arrow
126
- end
127
-
128
- def self.music
129
- Rainbow("\u266B").yellow # Beamed eighth notes
130
- end
131
-
132
- def self.get_severity_symbol(severity)
133
- case severity
134
- when "DEBUG"
135
- question
136
- # when "INFO"
137
- # info
138
- when "WARN"
139
- warning
140
- when "ERROR"
141
- error
142
- when "FATAL"
143
- fatal
144
- else
145
- " "
146
- end
147
- end
148
- end
149
- end
1
+ # frozen_string_literal: true
2
+
3
+ require "rainbow"
4
+
5
+ # https://symbl.cc/en/unicode/table/
6
+ module Makit
7
+ class Symbols
8
+ def self.checkmark
9
+ "\u2713"
10
+ end
11
+
12
+ def self.success
13
+ "\u2713"
14
+ end
15
+
16
+ def self.error
17
+ Rainbow("\u0058").red
18
+ end
19
+
20
+ def self.warning
21
+ Rainbow("\u26A0").yellow
22
+ end
23
+
24
+ def self.debug
25
+ Rainbow("\u24D8").blue # Circle with "i"
26
+ end
27
+
28
+ def self.info
29
+ Rainbow("\u2139").blue # Information source
30
+ end
31
+
32
+ def self.fatal
33
+ Rainbow("\u25A0").bright.red # Filled square, indicating stop/critical
34
+ end
35
+
36
+ def self.warn
37
+ Rainbow("\u26A0").yellow # Warning sign
38
+ end
39
+
40
+ def self.star
41
+ Rainbow("\u2605").yellow # Star
42
+ end
43
+
44
+ def self.coffee
45
+ Rainbow("\u2615").yellow # Hot beverage
46
+ end
47
+
48
+ def self.heart
49
+ Rainbow("\u2764").red # Heavy black heart
50
+ end
51
+
52
+ def self.bug
53
+ Rainbow("\u1F41E").yellow # Bug
54
+ end
55
+
56
+ def self.gear
57
+ Rainbow("\u2699").yellow # Gear
58
+ end
59
+
60
+ def self.magnifying_glass
61
+ Rainbow("\u1F50D").yellow # Left-pointing magnifying glass
62
+ end
63
+
64
+ def self.question
65
+ Rainbow("\u003F").yellow # Question mark
66
+ end
67
+
68
+ def self.arrow_right
69
+ Rainbow("\u27A4").yellow # Arrow pointing rightwards then curving upwards
70
+ end
71
+
72
+ def self.arrow_left
73
+ Rainbow("\u2B05").yellow # Left arrow
74
+ end
75
+
76
+ def self.arrow_up
77
+ Rainbow("\u2B06").yellow # Up arrow
78
+ end
79
+
80
+ def self.arrow_down
81
+ Rainbow("\u2B07").yellow # Down arrow
82
+ end
83
+
84
+ def self.arrow_up_down
85
+ Rainbow("\u2195").yellow # Up/down arrow
86
+ end
87
+
88
+ def self.arrow_left_right
89
+ Rainbow("\u2194").yellow # Left/right arrow
90
+ end
91
+
92
+ def self.arrow_upper_right
93
+ Rainbow("\u2197").yellow # North east arrow
94
+ end
95
+
96
+ def self.arrow_lower_right
97
+ Rainbow("\u2198").yellow # South east arrow
98
+ end
99
+
100
+ def self.arrow_lower_left
101
+ Rainbow("\u2199").yellow # South west arrow
102
+ end
103
+
104
+ def self.arrow_upper_left
105
+ Rainbow("\u2196").yellow # North west arrow
106
+ end
107
+
108
+ def self.arrow_up_small
109
+ Rainbow("\u2B06").yellow # Up arrow
110
+ end
111
+
112
+ def self.arrow_down_small
113
+ Rainbow("\u2B07").yellow # Down arrow
114
+ end
115
+
116
+ def self.arrow_right_small
117
+ Rainbow("\u27A1").yellow # Black rightwards arrow
118
+ end
119
+
120
+ def self.arrow_left_small
121
+ Rainbow("\u2B05").yellow # Left arrow
122
+ end
123
+
124
+ def self.arrow_up_down_small
125
+ Rainbow("\u2195").yellow # Up/down arrow
126
+ end
127
+
128
+ def self.music
129
+ Rainbow("\u266B").yellow # Beamed eighth notes
130
+ end
131
+
132
+ def self.get_severity_symbol(severity)
133
+ case severity
134
+ when "DEBUG"
135
+ question
136
+ # when "INFO"
137
+ # info
138
+ when "WARN"
139
+ warning
140
+ when "ERROR"
141
+ error
142
+ when "FATAL"
143
+ fatal
144
+ else
145
+ " "
146
+ end
147
+ end
148
+ end
149
+ end