makit 0.0.57 → 0.0.58

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) 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 +404 -399
  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 +200 -200
  21. data/lib/makit/dotnet.rb +182 -182
  22. data/lib/makit/environment.rb +127 -127
  23. data/lib/makit/fileinfo.rb +16 -16
  24. data/lib/makit/files.rb +47 -47
  25. data/lib/makit/git.rb +96 -96
  26. data/lib/makit/gitlab_runner.rb +60 -60
  27. data/lib/makit/humanize.rb +129 -129
  28. data/lib/makit/indexer.rb +56 -56
  29. data/lib/makit/logging.rb +96 -96
  30. data/lib/makit/markdown.rb +75 -75
  31. data/lib/makit/mp/basic_object_mp.rb +16 -16
  32. data/lib/makit/mp/command_request.mp.rb +16 -16
  33. data/lib/makit/mp/project_mp.rb +210 -210
  34. data/lib/makit/mp/string_mp.rb +137 -137
  35. data/lib/makit/nuget.rb +57 -57
  36. data/lib/makit/protoc.rb +104 -104
  37. data/lib/makit/serializer.rb +115 -115
  38. data/lib/makit/show.rb +111 -111
  39. data/lib/makit/storage.rb +131 -131
  40. data/lib/makit/symbols.rb +149 -149
  41. data/lib/makit/tasks.rb +61 -61
  42. data/lib/makit/tree.rb +37 -37
  43. data/lib/makit/v1/makit.v1_services_pb.rb +25 -25
  44. data/lib/makit/version.rb +68 -68
  45. data/lib/makit/wix.rb +95 -95
  46. data/lib/makit/yaml.rb +19 -19
  47. data/lib/makit/zip.rb +17 -17
  48. data/lib/makit.rb +267 -267
  49. metadata +3 -5
  50. data/lib/generated/makit/v1/makit.v1_pb.rb +0 -35
  51. data/lib/generated/makit/v1/web/link_pb.rb +0 -20
@@ -1,115 +1,115 @@
1
- # frozen_string_literal: true
2
- require "google/protobuf"
3
- # This module provides classes for the Makit gem.
4
- module Makit
5
- module Proto3Formats
6
- JSON = 0,
7
- PRETTY_JSON = 1,
8
- YAML = 2,
9
- BINARY = 3
10
- end
11
-
12
- # This class provide methods for serializing and deserializing objects.
13
- #
14
- class Serializer
15
- attr_accessor :format_map
16
-
17
- def self.save_as(filename, object)
18
- extension = File.extname(filename)
19
- case extension
20
- when ".json"
21
- File.write(filename, Makit::Serializer.new(Makit::Proto3Formats::PRETTY_JSON).serialize(object))
22
- when ".yml"
23
- File.write(filename, Makit::Serializer.new(Makit::Proto3Formats::YAML).serialize(object))
24
- when ".pb"
25
- File.open(filename, "wb") do |file|
26
- file.write(Makit::Serializer.new(Makit::Proto3Formats::BINARY).serialize(object))
27
- end
28
-
29
- #File.write(filename, Makit::Serializer.new(Makit::Proto3Formats::BINARY).serialize(object))
30
- else
31
- raise "unsupported file extension: #{extension}"
32
- end
33
- end
34
-
35
- def self.open(filename, type)
36
- extension = File.extname(filename)
37
- case extension
38
- when ".json"
39
- Makit::Serializer.new(Makit::Proto3Formats::PRETTY_JSON).deserialize(type, File.read(filename))
40
- when ".yml"
41
- Makit::Serializer.new(Makit::Proto3Formats::YAML).deserialize(type, File.read(filename))
42
- when ".pb"
43
- data = File.open(filename, "rb") { |file| file.read }
44
- Makit::Serializer.new(Makit::Proto3Formats::BINARY).deserialize(type, data)
45
- else
46
- raise "unsupported file extension: #{extension}"
47
- end
48
- end
49
-
50
- def initialize(proto3_format = Proto3Formats::PRETTY_JSON)
51
- @format_maps = {
52
- ::Google::Protobuf::MessageExts => proto3_format,
53
- }
54
- end
55
-
56
- # Serialize an object to a byte[] or a string
57
- def serialize(object)
58
- raise "Object is nil" if object.nil?
59
- raise "object is not of type ::Google::Protobuf::MessageExts" if !object.is_a? ::Google::Protobuf::MessageExts
60
-
61
- case @format_maps[::Google::Protobuf::MessageExts]
62
- when Proto3Formats::JSON
63
- #puts "Serializing to protobuf json format"
64
- object.to_json
65
- when Proto3Formats::PRETTY_JSON
66
- #puts "Serializing to protobuf pretty json format"
67
- json = object.to_json
68
- pretty_json = JSON.pretty_generate(JSON.parse(json))
69
- pretty_json
70
- when Proto3Formats::YAML
71
- #puts "Serializing to protobuf yaml format"
72
- data = JSON.parse(object.to_json)
73
- data.to_yaml.sub(/^---\n/, "")
74
- when Proto3Formats::BINARY
75
- #puts "Serializing to protobuf binary format"
76
- serialized_object = object.to_proto
77
- else
78
- raise "Unknown serialization format"
79
- end
80
- end
81
-
82
- # Deserialize a byte[] or a string to an object
83
- def deserialize(type, data)
84
- raise "data is nil" if data.nil?
85
- case @format_maps[::Google::Protobuf::MessageExts]
86
- when Proto3Formats::JSON
87
- raise "data is not of type string" if !data.is_a? String
88
- json = data
89
- #puts "Deserializing from protobuf json format into type #{type}"
90
- # use the from_json method to deserialize the object
91
- type.decode_json(json)
92
- when Proto3Formats::PRETTY_JSON
93
- raise "data is not of type string" if !data.is_a? String
94
- json = data
95
- #puts "Deserializing from protobuf pretty json format into type #{type}"
96
- # use the from_json method to deserialize the object
97
- type.decode_json(json)
98
- when Proto3Formats::YAML
99
- raise "data is not of type string" if !data.is_a? String
100
- yaml = data
101
- # convert yaml to json
102
- json = JSON.pretty_generate(YAML.safe_load(yaml))
103
- #puts "Deserializing from protobuf yaml format into type #{type}"
104
- type.decode_json(json)
105
- when Proto3Formats::BINARY
106
- #raise "data is not of type byte[]" if !data.is_a? Array
107
- bytes = data
108
- #puts "Deserializing from protobuf binary format into type #{type}"
109
- type.decode(bytes)
110
- else
111
- raise "Unknown serialization format"
112
- end
113
- end
114
- end # class Storage
115
- end # module Makit
1
+ # frozen_string_literal: true
2
+ require "google/protobuf"
3
+ # This module provides classes for the Makit gem.
4
+ module Makit
5
+ module Proto3Formats
6
+ JSON = 0,
7
+ PRETTY_JSON = 1,
8
+ YAML = 2,
9
+ BINARY = 3
10
+ end
11
+
12
+ # This class provide methods for serializing and deserializing objects.
13
+ #
14
+ class Serializer
15
+ attr_accessor :format_map
16
+
17
+ def self.save_as(filename, object)
18
+ extension = File.extname(filename)
19
+ case extension
20
+ when ".json"
21
+ File.write(filename, Makit::Serializer.new(Makit::Proto3Formats::PRETTY_JSON).serialize(object))
22
+ when ".yml"
23
+ File.write(filename, Makit::Serializer.new(Makit::Proto3Formats::YAML).serialize(object))
24
+ when ".pb"
25
+ File.open(filename, "wb") do |file|
26
+ file.write(Makit::Serializer.new(Makit::Proto3Formats::BINARY).serialize(object))
27
+ end
28
+
29
+ #File.write(filename, Makit::Serializer.new(Makit::Proto3Formats::BINARY).serialize(object))
30
+ else
31
+ raise "unsupported file extension: #{extension}"
32
+ end
33
+ end
34
+
35
+ def self.open(filename, type)
36
+ extension = File.extname(filename)
37
+ case extension
38
+ when ".json"
39
+ Makit::Serializer.new(Makit::Proto3Formats::PRETTY_JSON).deserialize(type, File.read(filename))
40
+ when ".yml"
41
+ Makit::Serializer.new(Makit::Proto3Formats::YAML).deserialize(type, File.read(filename))
42
+ when ".pb"
43
+ data = File.open(filename, "rb") { |file| file.read }
44
+ Makit::Serializer.new(Makit::Proto3Formats::BINARY).deserialize(type, data)
45
+ else
46
+ raise "unsupported file extension: #{extension}"
47
+ end
48
+ end
49
+
50
+ def initialize(proto3_format = Proto3Formats::PRETTY_JSON)
51
+ @format_maps = {
52
+ ::Google::Protobuf::MessageExts => proto3_format,
53
+ }
54
+ end
55
+
56
+ # Serialize an object to a byte[] or a string
57
+ def serialize(object)
58
+ raise "Object is nil" if object.nil?
59
+ raise "object is not of type ::Google::Protobuf::MessageExts" if !object.is_a? ::Google::Protobuf::MessageExts
60
+
61
+ case @format_maps[::Google::Protobuf::MessageExts]
62
+ when Proto3Formats::JSON
63
+ #puts "Serializing to protobuf json format"
64
+ object.to_json
65
+ when Proto3Formats::PRETTY_JSON
66
+ #puts "Serializing to protobuf pretty json format"
67
+ json = object.to_json
68
+ pretty_json = JSON.pretty_generate(JSON.parse(json))
69
+ pretty_json
70
+ when Proto3Formats::YAML
71
+ #puts "Serializing to protobuf yaml format"
72
+ data = JSON.parse(object.to_json)
73
+ data.to_yaml.sub(/^---\n/, "")
74
+ when Proto3Formats::BINARY
75
+ #puts "Serializing to protobuf binary format"
76
+ serialized_object = object.to_proto
77
+ else
78
+ raise "Unknown serialization format"
79
+ end
80
+ end
81
+
82
+ # Deserialize a byte[] or a string to an object
83
+ def deserialize(type, data)
84
+ raise "data is nil" if data.nil?
85
+ case @format_maps[::Google::Protobuf::MessageExts]
86
+ when Proto3Formats::JSON
87
+ raise "data is not of type string" if !data.is_a? String
88
+ json = data
89
+ #puts "Deserializing from protobuf json format into type #{type}"
90
+ # use the from_json method to deserialize the object
91
+ type.decode_json(json)
92
+ when Proto3Formats::PRETTY_JSON
93
+ raise "data is not of type string" if !data.is_a? String
94
+ json = data
95
+ #puts "Deserializing from protobuf pretty json format into type #{type}"
96
+ # use the from_json method to deserialize the object
97
+ type.decode_json(json)
98
+ when Proto3Formats::YAML
99
+ raise "data is not of type string" if !data.is_a? String
100
+ yaml = data
101
+ # convert yaml to json
102
+ json = JSON.pretty_generate(YAML.safe_load(yaml))
103
+ #puts "Deserializing from protobuf yaml format into type #{type}"
104
+ type.decode_json(json)
105
+ when Proto3Formats::BINARY
106
+ #raise "data is not of type byte[]" if !data.is_a? Array
107
+ bytes = data
108
+ #puts "Deserializing from protobuf binary format into type #{type}"
109
+ type.decode(bytes)
110
+ else
111
+ raise "Unknown serialization format"
112
+ end
113
+ end
114
+ end # class Storage
115
+ end # module Makit
data/lib/makit/show.rb CHANGED
@@ -1,111 +1,111 @@
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
- humanized_size = Makit::Humanize.get_humanized_size(File.size(path))
38
- #puts "#{file_symbol} ".colorize(:grey) + "#{humanized_size.rjust(10)} ".colorize(:cyan) + " #{path} ".colorize(:grey)
39
- puts "#{file_symbol} ".colorize(:grey) + "#{File.basename(path)} ".colorize(:green) + "#{humanized_size.rjust(10)} ".colorize(:cyan) + " #{path} ".colorize(:grey)# + "modified #{Makit::Humanize.get_humanized_timestamp(modified)}".colorize(:grey) + " age #{Makit::Humanize.get_humanized_duration(age)}".colorize(:grey)
40
- else
41
- puts "#{path} does not exist"
42
- end
43
- end
44
-
45
- def files(path_array)
46
- path_array.each do |path|
47
- file(path)
48
- end
49
- end
50
-
51
- def file_symbol
52
- #📄 (U+1F4C4) – "Page with Curl"
53
- #"\u{1F4C4}"
54
- "@"
55
- end
56
-
57
- def directory_symbol
58
- # 📁 (U+1F4C1) – "File Folder"
59
- "\u{1F4C1}"
60
- end
61
-
62
- def task_symbol
63
- # 🛠️ (U+1F6E0) Hammer and Wrench – Represents tools, suitable for tasks and automation.
64
- "\u{1F6E0}"
65
- end
66
-
67
- def git_branch_symbol
68
- # 🌱 (U+1F331) – "Seedling"
69
- "\u{1F331}"
70
- end
71
-
72
- def size(path)
73
- if File.file?(path)
74
- puts "#{path} size is ".colorize(:grey) + "#{Makit::Humanize.get_humanized_size(File.size(path))}".colorize(:cyan)
75
- elsif File.directory?(path)
76
- puts "#{path} size is ".colorize(:grey) + "#{Makit::Humanize.get_humanized_size(Makit::Directory.get_size(path))}".colorize(:cyan)
77
- else
78
- puts "#{path} does not exist"
79
- end
80
- end
81
-
82
- def task(task)
83
- puts ("=" * 80).colorize(:grey)
84
- puts " ".colorize(:grey) + "#{task}".colorize(:green)
85
- #puts ("=" * 100).colorize(:grey)
86
- end
87
-
88
- def info(text)
89
- puts " ".colorize(:grey) + "#{text}".colorize(:cyan)
90
- end
91
-
92
- def success(text)
93
- puts " ".colorize(:grey) + "#{text}".colorize(:green)
94
- end
95
-
96
- def version(path)
97
- puts " #{Makit::Version.get_version_from_file(path)}".colorize(:green) + " found in #{path}".colorize(:grey)
98
- end
99
-
100
- def versions(glob_pattern)
101
- Dir.glob(glob_pattern).each do |filename|
102
- puts " #{Makit::Version.get_version_from_file(filename)}".colorize(:green) + " found in #{filename}".colorize(:grey)
103
- end
104
- end
105
-
106
- def git_branch
107
- puts "#{git_branch_symbol} ".colorize(:grey) + "#{Makit::Git.branch}".colorize(:green) + " branch".colorize(:grey)
108
- end
109
- end
110
- end
111
-
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
+ humanized_size = Makit::Humanize.get_humanized_size(File.size(path))
38
+ #puts "#{file_symbol} ".colorize(:grey) + "#{humanized_size.rjust(10)} ".colorize(:cyan) + " #{path} ".colorize(:grey)
39
+ puts "#{file_symbol} ".colorize(:grey) + "#{File.basename(path)} ".colorize(:green) + "#{humanized_size.rjust(10)} ".colorize(:cyan) + " #{path} ".colorize(:grey)# + "modified #{Makit::Humanize.get_humanized_timestamp(modified)}".colorize(:grey) + " age #{Makit::Humanize.get_humanized_duration(age)}".colorize(:grey)
40
+ else
41
+ puts "#{path} does not exist"
42
+ end
43
+ end
44
+
45
+ def files(path_array)
46
+ path_array.each do |path|
47
+ file(path)
48
+ end
49
+ end
50
+
51
+ def file_symbol
52
+ #📄 (U+1F4C4) – "Page with Curl"
53
+ #"\u{1F4C4}"
54
+ "@"
55
+ end
56
+
57
+ def directory_symbol
58
+ # 📁 (U+1F4C1) – "File Folder"
59
+ "\u{1F4C1}"
60
+ end
61
+
62
+ def task_symbol
63
+ # 🛠️ (U+1F6E0) Hammer and Wrench – Represents tools, suitable for tasks and automation.
64
+ "\u{1F6E0}"
65
+ end
66
+
67
+ def git_branch_symbol
68
+ # 🌱 (U+1F331) – "Seedling"
69
+ "\u{1F331}"
70
+ end
71
+
72
+ def size(path)
73
+ if File.file?(path)
74
+ puts "#{path} size is ".colorize(:grey) + "#{Makit::Humanize.get_humanized_size(File.size(path))}".colorize(:cyan)
75
+ elsif File.directory?(path)
76
+ puts "#{path} size is ".colorize(:grey) + "#{Makit::Humanize.get_humanized_size(Makit::Directory.get_size(path))}".colorize(:cyan)
77
+ else
78
+ puts "#{path} does not exist"
79
+ end
80
+ end
81
+
82
+ def task(task)
83
+ puts ("=" * 80).colorize(:grey)
84
+ puts " ".colorize(:grey) + "#{task}".colorize(:green)
85
+ #puts ("=" * 100).colorize(:grey)
86
+ end
87
+
88
+ def info(text)
89
+ puts " ".colorize(:grey) + "#{text}".colorize(:cyan)
90
+ end
91
+
92
+ def success(text)
93
+ puts " ".colorize(:grey) + "#{text}".colorize(:green)
94
+ end
95
+
96
+ def version(path)
97
+ puts " #{Makit::Version.get_version_from_file(path)}".colorize(:green) + " found in #{path}".colorize(:grey)
98
+ end
99
+
100
+ def versions(glob_pattern)
101
+ Dir.glob(glob_pattern).each do |filename|
102
+ puts " #{Makit::Version.get_version_from_file(filename)}".colorize(:green) + " found in #{filename}".colorize(:grey)
103
+ end
104
+ end
105
+
106
+ def git_branch
107
+ puts "#{git_branch_symbol} ".colorize(:grey) + "#{Makit::Git.branch}".colorize(:green) + " branch".colorize(:grey)
108
+ end
109
+ end
110
+ end
111
+