makit 0.0.34 → 0.0.36

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) 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 +391 -353
  14. data/lib/makit/commands.rb +21 -21
  15. data/lib/makit/content/default_gitignore.rb +5 -5
  16. data/lib/makit/content/default_gitignore.txt +222 -222
  17. data/lib/makit/content/default_rakefile.rb +11 -11
  18. data/lib/makit/content/gem_rakefile.rb +14 -14
  19. data/lib/makit/data.rb +50 -50
  20. data/lib/makit/directories.rb +140 -140
  21. data/lib/makit/directory.rb +184 -184
  22. data/lib/makit/dotnet.rb +156 -134
  23. data/lib/makit/environment.rb +127 -127
  24. data/lib/makit/fileinfo.rb +16 -16
  25. data/lib/makit/files.rb +47 -47
  26. data/lib/makit/git.rb +86 -86
  27. data/lib/makit/gitlab_runner.rb +60 -60
  28. data/lib/makit/humanize.rb +112 -112
  29. data/lib/makit/indexer.rb +56 -0
  30. data/lib/makit/logging.rb +96 -96
  31. data/lib/makit/markdown.rb +75 -75
  32. data/lib/makit/mp/basic_object_mp.rb +16 -16
  33. data/lib/makit/mp/command_request.mp.rb +16 -16
  34. data/lib/makit/mp/project_mp.rb +210 -210
  35. data/lib/makit/mp/string_mp.rb +122 -122
  36. data/lib/makit/nuget.rb +57 -57
  37. data/lib/makit/protoc.rb +104 -104
  38. data/lib/makit/serializer.rb +115 -115
  39. data/lib/makit/show.rb +76 -77
  40. data/lib/makit/storage.rb +131 -131
  41. data/lib/makit/symbols.rb +149 -149
  42. data/lib/makit/tasks.rb +60 -60
  43. data/lib/makit/tree.rb +37 -37
  44. data/lib/makit/v1/makit.v1_pb.rb +4 -3
  45. data/lib/makit/v1/makit.v1_services_pb.rb +25 -25
  46. data/lib/makit/version.rb +12 -12
  47. data/lib/makit/wix.rb +95 -95
  48. data/lib/makit/zip.rb +17 -17
  49. data/lib/makit.rb +267 -267
  50. metadata +4 -5
  51. data/lib/generated/makit/v1/makit.v1_pb.rb +0 -34
  52. data/lib/generated/makit/v1/web/link_pb.rb +0 -20
data/lib/makit/show.rb CHANGED
@@ -1,77 +1,76 @@
1
- # frozen_string_literal: true
2
-
3
- require "find"
4
- require "pathname"
5
-
6
- # This module provides classes for the Makit gem.
7
- module Makit
8
- class Show
9
- def modified(path)
10
- if File.file?(path)
11
- puts "#{path} modified ".colorize(:grey) + "#{Makit::Humanize.get_humanized_timestamp(File.mtime(path))}".colorize(:cyan)
12
- elsif File.directory?(path)
13
- puts "#{path} modified ".colorize(:grey) + "#{Makit::Humanize.get_humanized_timestamp(Makit::Directory.modified(path))}".colorize(:cyan)
14
- else
15
- puts "#{path} does not exist"
16
- end
17
- end
18
-
19
- def age(path)
20
- if File.file?(path)
21
- modified = File.mtime(path)
22
- age = (Time.now - modified).to_f
23
- puts "#{path} age is ".colorize(:grey) + "#{Makit::Humanize.get_humanized_duration(age)}".colorize(:cyan)
24
- elsif File.directory?(path)
25
- modified = Makit::Directory.modified(path)
26
- age = (Time.now -modified).to_f
27
- puts "#{path} age is ".colorize(:grey) + "#{Makit::Humanize.get_humanized_duration(age)}".colorize(:cyan)
28
- else
29
- puts "#{path} does not exist"
30
- end
31
- end
32
-
33
- def file(path)
34
- if File.file?(path)
35
- modified = File.mtime(path)
36
- age = (Time.now - modified).to_f
37
- puts "#{file_symbol} #{path} ".colorize(:grey) + "#{Makit::Humanize.get_humanized_size(File.size(path))} ".colorize(:cyan) + "#{Makit::Humanize.get_humanized_duration(age)}".colorize(:cyan)
38
- else
39
- puts "#{path} does not exist"
40
- end
41
- end
42
-
43
- def file_symbol
44
- #📄 (U+1F4C4) – "Page with Curl"
45
- "\u{1F4C4}"
46
- end
47
-
48
- def directory_symbol
49
- # 📁 (U+1F4C1) – "File Folder"
50
- "\u{1F4C1}"
51
- end
52
-
53
- def task_symbol
54
- # 🛠️ (U+1F6E0) Hammer and Wrench – Represents tools, suitable for tasks and automation.
55
- "\u{1F6E0}"
56
-
57
- end
58
-
59
- def size(path)
60
- if File.file?(path)
61
- puts "#{path} size is ".colorize(:grey) + "#{Makit::Humanize.get_humanized_size(File.size(path))}".colorize(:cyan)
62
- elsif File.directory?(path)
63
- puts "#{path} size is ".colorize(:grey) + "#{Makit::Humanize.get_humanized_size(Makit::Directory.get_size(path))}".colorize(:cyan)
64
- else
65
- puts "#{path} does not exist"
66
- end
67
- end
68
-
69
- def task(task)
70
- puts ("=" * 80).colorize(:grey)
71
- puts " ".colorize(:grey) + "#{task}".colorize(:green)
72
- #puts ("=" * 100).colorize(:grey)
73
- end
74
- end
75
- end
76
-
77
- #Code42-#{VERSION}-win10-x64 ".colorize(:grey) + "#{Makit::Humanize.get_humanized_size(Makit::Directory.get_size("artifacts/Code42-0.0.0-win10-x64"))}".colorize(:cyan)
1
+ # frozen_string_literal: true
2
+
3
+ require "find"
4
+ require "pathname"
5
+
6
+ # This module provides classes for the Makit gem.
7
+ module Makit
8
+ class Show
9
+ def modified(path)
10
+ if File.file?(path)
11
+ puts "#{path} modified ".colorize(:grey) + "#{Makit::Humanize.get_humanized_timestamp(File.mtime(path))}".colorize(:cyan)
12
+ elsif File.directory?(path)
13
+ puts "#{path} modified ".colorize(:grey) + "#{Makit::Humanize.get_humanized_timestamp(Makit::Directory.modified(path))}".colorize(:cyan)
14
+ else
15
+ puts "#{path} does not exist"
16
+ end
17
+ end
18
+
19
+ def age(path)
20
+ if File.file?(path)
21
+ modified = File.mtime(path)
22
+ age = (Time.now - modified).to_f
23
+ puts "#{path} age is ".colorize(:grey) + "#{Makit::Humanize.get_humanized_duration(age)}".colorize(:cyan)
24
+ elsif File.directory?(path)
25
+ modified = Makit::Directory.modified(path)
26
+ age = (Time.now -modified).to_f
27
+ puts "#{path} age is ".colorize(:grey) + "#{Makit::Humanize.get_humanized_duration(age)}".colorize(:cyan)
28
+ else
29
+ puts "#{path} does not exist"
30
+ end
31
+ end
32
+
33
+ def file(path)
34
+ if File.file?(path)
35
+ modified = File.mtime(path)
36
+ age = (Time.now - modified).to_f
37
+ puts "#{file_symbol} #{path} ".colorize(:grey) + "#{Makit::Humanize.get_humanized_size(File.size(path))} ".colorize(:cyan) + "#{Makit::Humanize.get_humanized_duration(age)}".colorize(:cyan)
38
+ else
39
+ puts "#{path} does not exist"
40
+ end
41
+ end
42
+
43
+ def file_symbol
44
+ #📄 (U+1F4C4) – "Page with Curl"
45
+ "\u{1F4C4}"
46
+ end
47
+
48
+ def directory_symbol
49
+ # 📁 (U+1F4C1) – "File Folder"
50
+ "\u{1F4C1}"
51
+ end
52
+
53
+ def task_symbol
54
+ # 🛠️ (U+1F6E0) Hammer and Wrench – Represents tools, suitable for tasks and automation.
55
+ "\u{1F6E0}"
56
+ end
57
+
58
+ def size(path)
59
+ if File.file?(path)
60
+ puts "#{path} size is ".colorize(:grey) + "#{Makit::Humanize.get_humanized_size(File.size(path))}".colorize(:cyan)
61
+ elsif File.directory?(path)
62
+ puts "#{path} size is ".colorize(:grey) + "#{Makit::Humanize.get_humanized_size(Makit::Directory.get_size(path))}".colorize(:cyan)
63
+ else
64
+ puts "#{path} does not exist"
65
+ end
66
+ end
67
+
68
+ def task(task)
69
+ puts ("=" * 80).colorize(:grey)
70
+ puts " ".colorize(:grey) + "#{task}".colorize(:green)
71
+ #puts ("=" * 100).colorize(:grey)
72
+ end
73
+ end
74
+ end
75
+
76
+ #Code42-#{VERSION}-win10-x64 ".colorize(:grey) + "#{Makit::Humanize.get_humanized_size(Makit::Directory.get_size("artifacts/Code42-0.0.0-win10-x64"))}".colorize(:cyan)
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