makit 0.0.26 → 0.0.27

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) 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 +343 -343
  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 +184 -181
  21. data/lib/makit/dotnet.rb +104 -104
  22. data/lib/makit/environment.rb +123 -123
  23. data/lib/makit/fileinfo.rb +16 -16
  24. data/lib/makit/files.rb +47 -47
  25. data/lib/makit/git.rb +80 -80
  26. data/lib/makit/gitlab_runner.rb +60 -60
  27. data/lib/makit/humanize.rb +112 -112
  28. data/lib/makit/logging.rb +96 -96
  29. data/lib/makit/markdown.rb +75 -75
  30. data/lib/makit/mp/basic_object_mp.rb +16 -16
  31. data/lib/makit/mp/command_request.mp.rb +16 -16
  32. data/lib/makit/mp/project_mp.rb +210 -210
  33. data/lib/makit/mp/string_mp.rb +117 -117
  34. data/lib/makit/nuget.rb +57 -57
  35. data/lib/makit/protoc.rb +87 -61
  36. data/lib/makit/serializer.rb +115 -115
  37. data/lib/makit/show.rb +65 -0
  38. data/lib/makit/storage.rb +131 -131
  39. data/lib/makit/symbols.rb +149 -149
  40. data/lib/makit/tasks.rb +55 -55
  41. data/lib/makit/tree.rb +37 -37
  42. data/lib/makit/v1/makit.v1_pb.rb +3 -4
  43. data/lib/makit/v1/makit.v1_services_pb.rb +25 -25
  44. data/lib/makit/version.rb +12 -12
  45. data/lib/makit/wix.rb +95 -95
  46. data/lib/makit/zip.rb +17 -17
  47. data/lib/makit.rb +254 -254
  48. metadata +4 -3
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
data/lib/makit/tasks.rb CHANGED
@@ -1,55 +1,55 @@
1
- # frozen_string_literal: true
2
- require "digest"
3
- require "rake/clean"
4
- #require "sqlite3"
5
-
6
- # This module provides classes for the Makit gem.
7
- module Makit
8
- # This class provide methods for managing persistent data for the makit gem
9
- class Tasks
10
- def self.run_default_commands(task_name)
11
- Makit::LOGGER.debug("Running default commands for task: #{task_name}")
12
- end
13
- end
14
- end
15
-
16
- desc "Remove any temporary products."
17
- task :clean do
18
- puts ":clean".colorize(:blue)
19
- Makit::RUNNER.run(Makit::RUNNER.parse_command_request("git clean -dXf"))
20
- end
21
-
22
- desc "Integrate changes into the git repository."
23
- task :integrate do
24
- puts ":integrate".colorize(:blue)
25
- Makit::Git.integrate
26
- end
27
-
28
- desc "Sync changes with the git repository."
29
- task :sync do
30
- puts ":sync".colorize(:blue)
31
- Makit::Git.sync
32
- end
33
-
34
- desc "Format source code."
35
- task :format do
36
- puts ":format".colorize(:blue)
37
- Makit::RUNNER.try("rufo .") if File.exist?("Gemfile") || File.exist?("Rakefile")
38
- end
39
-
40
- desc "Update dependencies."
41
- task :update do
42
- puts ":update".colorize(:blue)
43
- system("bundle update") if File.exist?("Gemfile")
44
- # glob all *.csproj files
45
- Dir.glob("**/*.csproj").each do |file|
46
- "dotnet format #{file}".run
47
- end
48
- end
49
-
50
- # Register the at_exit hook for cleanup
51
- at_exit do
52
- #puts "at_exit in tasks.rb...."
53
- duration = Time.now - Makit::STARTTIME
54
- puts " completed in ".colorize(:grey) + Makit::Humanize.get_humanized_duration(duration).colorize(:green)
55
- end
1
+ # frozen_string_literal: true
2
+ require "digest"
3
+ require "rake/clean"
4
+ #require "sqlite3"
5
+
6
+ # This module provides classes for the Makit gem.
7
+ module Makit
8
+ # This class provide methods for managing persistent data for the makit gem
9
+ class Tasks
10
+ def self.run_default_commands(task_name)
11
+ Makit::LOGGER.debug("Running default commands for task: #{task_name}")
12
+ end
13
+ end
14
+ end
15
+
16
+ desc "Remove any temporary products."
17
+ task :clean do
18
+ puts ":clean".colorize(:blue)
19
+ Makit::RUNNER.run(Makit::RUNNER.parse_command_request("git clean -dXf"))
20
+ end
21
+
22
+ desc "Integrate changes into the git repository."
23
+ task :integrate do
24
+ puts ":integrate".colorize(:blue)
25
+ Makit::Git.integrate
26
+ end
27
+
28
+ desc "Sync changes with the git repository."
29
+ task :sync do
30
+ puts ":sync".colorize(:blue)
31
+ Makit::Git.sync
32
+ end
33
+
34
+ desc "Format source code."
35
+ task :format do
36
+ puts ":format".colorize(:blue)
37
+ Makit::RUNNER.try("rufo .") if File.exist?("Gemfile") || File.exist?("Rakefile")
38
+ end
39
+
40
+ desc "Update dependencies."
41
+ task :update do
42
+ puts ":update".colorize(:blue)
43
+ system("bundle update") if File.exist?("Gemfile")
44
+ # glob all *.csproj files
45
+ Dir.glob("**/*.csproj").each do |file|
46
+ "dotnet format #{file}".run
47
+ end
48
+ end
49
+
50
+ # Register the at_exit hook for cleanup
51
+ at_exit do
52
+ #puts "at_exit in tasks.rb...."
53
+ duration = Time.now - Makit::STARTTIME
54
+ puts " completed in ".colorize(:grey) + Makit::Humanize.get_humanized_duration(duration).colorize(:green)
55
+ end