makit 0.0.27 → 0.0.28
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.
- checksums.yaml +4 -4
- data/lib/generated/makit/v1/makit.v1_pb.rb +34 -0
- data/lib/generated/makit/v1/web/link_pb.rb +20 -0
- data/lib/makit/command_runner.rb +11 -1
- data/lib/makit/mp/string_mp.rb +5 -0
- data/lib/makit/protoc.rb +25 -8
- data/lib/makit/show.rb +10 -6
- data/lib/makit/version.rb +1 -1
- data/lib/makit.rb +14 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59e3040750721c32917be211bd138bb66fe39606b7104c461db28afd7db3b0e6
|
4
|
+
data.tar.gz: ef979b03839b0237baf973a2bbd74842c9d62c04a49a218915054727ee5f44b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa2a0a557088dbe73ef772a2d2f8a7e8314ec472241a9f6340aadd09589c34cc968202cc64d93878491106530d4e9b29748e45801a81547182001aaa42257149
|
7
|
+
data.tar.gz: 4d6e68cee15e15d53b72453806af12924c0553b1b096183bbcb7c2081669568c3ce5696b1098ab2632ac8f30d198646473b913275b47cbb4edde558a542fc29b
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
|
+
# source: makit/v1/makit.v1.proto
|
4
|
+
|
5
|
+
require 'google/protobuf'
|
6
|
+
|
7
|
+
require 'google/protobuf/timestamp_pb'
|
8
|
+
require 'google/protobuf/duration_pb'
|
9
|
+
|
10
|
+
|
11
|
+
descriptor_data = "\n\x17makit/v1/makit.v1.proto\x12\x08makit.v1\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/duration.proto\"\x92\x02\n\rDotNetProject\x12\x10\n\x08template\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x0e\n\x06output\x18\x03 \x01(\t\x12\x10\n\x08packages\x18\x04 \x03(\t\x12\x12\n\nreferences\x18\x05 \x03(\t\x12\n\n\x02os\x18\x06 \x01(\t\x12\x10\n\x08\x63ommands\x18\x07 \x03(\t\x12-\n\nbuild_args\x18\x08 \x03(\x0b\x32\x19.makit.v1.DotNetBuildArgs\x12\x31\n\x0cpublish_args\x18\t \x03(\x0b\x32\x1b.makit.v1.DotNetPublishArgs\x12+\n\ttest_args\x18\n \x03(\x0b\x32\x18.makit.v1.DotNetTestArgs\"8\n\x0f\x44otNetBuildArgs\x12\x15\n\rconfiguration\x18\x01 \x01(\t\x12\x0e\n\x06output\x18\x02 \x01(\t\":\n\x11\x44otNetPublishArgs\x12\x15\n\rconfiguration\x18\x01 \x01(\t\x12\x0e\n\x06output\x18\x02 \x01(\t\"7\n\x0e\x44otNetTestArgs\x12\x15\n\rconfiguration\x18\x01 \x01(\t\x12\x0e\n\x06output\x18\x02 \x01(\t\"\xa8\x01\n\x07Project\x12\x16\n\x0egit_remote_url\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x11\n\tartifacts\x18\x03 \x03(\t\x12\x32\n\x10\x63ommand_requests\x18\x04 \x03(\x0b\x32\x18.makit.v1.CommandRequest\x12\x30\n\x0f\x64otnet_projects\x18\x05 \x03(\x0b\x32\x17.makit.v1.DotNetProject\"\xa5\x01\n\x0e\x43ommandRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x11\n\targuments\x18\x02 \x03(\t\x12+\n\x07timeout\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x11\n\tdirectory\x18\x04 \x01(\t\x12\x0c\n\x04task\x18\x05 \x01(\t\x12\r\n\x05input\x18\x06 \x01(\x0c\x12\x15\n\rexit_on_error\x18\x07 \x01(\x08\"\x91\x02\n\x07\x43ommand\x12\n\n\x02id\x18\x01 \x01(\x03\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x11\n\targuments\x18\x03 \x03(\t\x12\x11\n\texit_code\x18\x04 \x01(\x05\x12\r\n\x05input\x18\x05 \x01(\x0c\x12\x0e\n\x06output\x18\x06 \x01(\x0c\x12\r\n\x05\x65rror\x18\x07 \x01(\x0c\x12.\n\nstarted_at\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12+\n\x08\x64uration\x18\t \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x0c\n\x04user\x18\n \x01(\t\x12\x0e\n\x06\x64\x65vice\x18\x0b \x01(\t\x12\n\n\x02os\x18\x0c \x01(\t\x12\x11\n\tdirectory\x18\r \x01(\t\"I\n\rConfiguration\x12\x0c\n\x04name\x18\x01 \x01(\t\x12*\n\x08\x63ommands\x18\x02 \x03(\x0b\x32\x18.makit.v1.CommandRequest\"3\n\rGitRepository\x12\x0b\n\x03url\x18\x01 \x01(\t\x12\x15\n\rrelative_path\x18\x02 \x01(\t\"h\n\x0bGitLogEntry\x12\x0e\n\x06\x63ommit\x18\x01 \x01(\t\x12\x0e\n\x06\x61uthor\x18\x02 \x01(\t\x12(\n\x04\x64\x61te\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0f\n\x07message\x18\x04 \x01(\t\"\xc8\x01\n\nMakeResult\x12\x12\n\nrepository\x18\x01 \x01(\t\x12\x0e\n\x06\x63ommit\x18\x02 \x01(\t\x12\x0e\n\x06\x62ranch\x18\x03 \x01(\t\x12\x0b\n\x03tag\x18\x04 \x01(\t\x12\x0e\n\x06\x64\x65vice\x18\x05 \x01(\t\x12\x1a\n\x12runtime_identifier\x18\x06 \x01(\t\x12#\n\x08\x63ommands\x18\x07 \x03(\x0b\x32\x11.makit.v1.Command\x12\x14\n\x0cinitial_size\x18\x08 \x01(\x05\x12\x12\n\nfinal_size\x18\t \x01(\x05\"?\n\rDotNetNewArgs\x12\x10\n\x08template\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x0e\n\x06output\x18\x03 \x01(\t\"^\n\rManifestEntry\x12\x0c\n\x04path\x18\x01 \x01(\t\x12\x31\n\rlast_modified\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0c\n\x04size\x18\x03 \x01(\x03**\n\x08Language\x12\x08\n\x04RUBY\x10\x00\x12\n\n\x06\x43SHARP\x10\x01\x12\x08\n\x04RUST\x10\x02*,\n\x0bPackageType\x12\x07\n\x03GEM\x10\x00\x12\t\n\x05NUGET\x10\x01\x12\t\n\x05\x43RATE\x10\x03\x32H\n\x0e\x43ommandService\x12\x36\n\x07\x45xecute\x12\x18.makit.v1.CommandRequest\x1a\x11.makit.v1.Commandb\x06proto3"
|
12
|
+
|
13
|
+
pool = Google::Protobuf::DescriptorPool.generated_pool
|
14
|
+
pool.add_serialized_file(descriptor_data)
|
15
|
+
|
16
|
+
module Makit
|
17
|
+
module V1
|
18
|
+
DotNetProject = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.DotNetProject").msgclass
|
19
|
+
DotNetBuildArgs = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.DotNetBuildArgs").msgclass
|
20
|
+
DotNetPublishArgs = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.DotNetPublishArgs").msgclass
|
21
|
+
DotNetTestArgs = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.DotNetTestArgs").msgclass
|
22
|
+
Project = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.Project").msgclass
|
23
|
+
CommandRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.CommandRequest").msgclass
|
24
|
+
Command = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.Command").msgclass
|
25
|
+
Configuration = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.Configuration").msgclass
|
26
|
+
GitRepository = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.GitRepository").msgclass
|
27
|
+
GitLogEntry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.GitLogEntry").msgclass
|
28
|
+
MakeResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.MakeResult").msgclass
|
29
|
+
DotNetNewArgs = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.DotNetNewArgs").msgclass
|
30
|
+
ManifestEntry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.ManifestEntry").msgclass
|
31
|
+
Language = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.Language").enummodule
|
32
|
+
PackageType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.PackageType").enummodule
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
|
+
# source: makit/v1/web/link.proto
|
4
|
+
|
5
|
+
require 'google/protobuf'
|
6
|
+
|
7
|
+
require 'google/protobuf/timestamp_pb'
|
8
|
+
require 'google/protobuf/duration_pb'
|
9
|
+
|
10
|
+
|
11
|
+
descriptor_data = "\n\x17makit/v1/web/link.proto\x12\x08makit.v1\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/duration.proto\"6\n\x04Link\x12\x0b\n\x03url\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\tb\x06proto3"
|
12
|
+
|
13
|
+
pool = Google::Protobuf::DescriptorPool.generated_pool
|
14
|
+
pool.add_serialized_file(descriptor_data)
|
15
|
+
|
16
|
+
module Makit
|
17
|
+
module V1
|
18
|
+
Link = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.Link").msgclass
|
19
|
+
end
|
20
|
+
end
|
data/lib/makit/command_runner.rb
CHANGED
@@ -11,13 +11,14 @@ module Makit
|
|
11
11
|
#
|
12
12
|
class CommandRunner
|
13
13
|
attr_accessor :show_output_on_success, :log_to_artifacts, :commands
|
14
|
-
attr_accessor :debug
|
14
|
+
attr_accessor :debug, :default_modified
|
15
15
|
|
16
16
|
def initialize
|
17
17
|
@show_output_on_success = false
|
18
18
|
@log_to_artifacts = false
|
19
19
|
@commands = []
|
20
20
|
@debug = false
|
21
|
+
@default_modified = Makit::Git::get_file_infos.first.mtime # Makit::GIT_FILE_INFOS.first.mtime
|
21
22
|
end
|
22
23
|
|
23
24
|
def get_cache_filename(command)
|
@@ -30,6 +31,10 @@ module Makit
|
|
30
31
|
cache_filename
|
31
32
|
end
|
32
33
|
|
34
|
+
def cache_run(command_request)
|
35
|
+
cache_run(command_request, @default_modified)
|
36
|
+
end
|
37
|
+
|
33
38
|
# if there is a matching cached command result, that then the specified timestamp,
|
34
39
|
# then return the cached result
|
35
40
|
# otherwise run the command and save the result to a cache file
|
@@ -38,6 +43,11 @@ module Makit
|
|
38
43
|
raise "Invalid command_request" unless command_request.is_a? Makit::V1::CommandRequest
|
39
44
|
cache_filename = get_cache_filename(command_request)
|
40
45
|
|
46
|
+
# Check if timestamp is a valid Time object
|
47
|
+
unless timestamp.is_a?(Time)
|
48
|
+
raise ArgumentError, "timestamp must be a Time object, got #{timestamp.class}"
|
49
|
+
end
|
50
|
+
|
41
51
|
if debug
|
42
52
|
puts " timestamp: #{Makit::Humanize.get_humanized_timestamp(timestamp)}"
|
43
53
|
puts " command.name: #{command_request.name}"
|
data/lib/makit/mp/string_mp.rb
CHANGED
@@ -35,6 +35,11 @@ class String
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
+
def cache_run()
|
39
|
+
command = self
|
40
|
+
Makit::RUNNER.cache_run(Makit::RUNNER::parse_command_request(command))
|
41
|
+
end
|
42
|
+
|
38
43
|
def cache_run(timestamp = nil)
|
39
44
|
if timestamp.nil?
|
40
45
|
timestamp = Makit::GIT_FILE_INFOS.first.mtime #GIT_FILE_INFOS. Makit::Directory.get_newest_git_file_timestamp(Makit::Directories::PROJECT_ROOT)
|
data/lib/makit/protoc.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
require "pathname"
|
2
3
|
|
3
4
|
# This module provides classes for the Makit gem.
|
4
5
|
module Makit
|
@@ -74,14 +75,30 @@ module Makit
|
|
74
75
|
end
|
75
76
|
|
76
77
|
# language: charp, ruby, go, etc.
|
77
|
-
def self.generate_source_files(proto_source_dir, language,
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
78
|
+
def self.generate_source_files(proto_source_dir, language, output_dir)
|
79
|
+
debug = false
|
80
|
+
puts "Generating source files for #{language} in #{proto_source_dir} to #{output_dir}" if debug
|
81
|
+
FileUtils.mkdir_p(output_dir) unless Dir.exist?(output_dir)
|
82
|
+
|
83
|
+
path_a = Pathname.new(proto_source_dir)
|
84
|
+
path_b = Pathname.new(output_dir)
|
85
|
+
output_relative_path = path_b.relative_path_from(path_a)
|
86
|
+
puts "output_relative_path: #{output_relative_path}" if debug
|
87
|
+
|
88
|
+
Dir.chdir(proto_source_dir) do
|
89
|
+
Dir.glob("**/*.proto").each do |proto|
|
90
|
+
puts "Generating #{proto}" if debug
|
91
|
+
if (language == "csharp")
|
92
|
+
namespace_dir = File.dirname(proto)
|
93
|
+
output_dir = "#{output_relative_path}/#{namespace_dir}"
|
94
|
+
puts "Generating #{proto} in #{output_dir}" if debug
|
95
|
+
FileUtils.mkdir_p("#{output_dir}") unless Dir.exist?("#{output_dir}")
|
96
|
+
"protoc --csharp_out=#{output_dir} #{proto}".run
|
97
|
+
else
|
98
|
+
"protoc --#{language}_out=#{output_relative_path} #{proto}".run
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
85
102
|
end
|
86
103
|
end
|
87
104
|
end
|
data/lib/makit/show.rb
CHANGED
@@ -12,7 +12,7 @@ module Makit
|
|
12
12
|
elsif File.directory?(path)
|
13
13
|
puts "#{path} modified ".colorize(:grey) + "#{Makit::Humanize.get_humanized_timestamp(Makit::Directory.modified(path))}".colorize(:cyan)
|
14
14
|
else
|
15
|
-
|
15
|
+
puts "#{path} does not exist"
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -26,14 +26,18 @@ module Makit
|
|
26
26
|
age = (Time.now -modified).to_f
|
27
27
|
puts "#{path} age is ".colorize(:grey) + "#{Makit::Humanize.get_humanized_duration(age)}".colorize(:cyan)
|
28
28
|
else
|
29
|
-
|
29
|
+
puts "#{path} does not exist"
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
33
|
def file(path)
|
34
|
-
|
35
|
-
|
36
|
-
|
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
|
37
41
|
end
|
38
42
|
|
39
43
|
def file_symbol
|
@@ -52,7 +56,7 @@ module Makit
|
|
52
56
|
elsif File.directory?(path)
|
53
57
|
puts "#{path} size is ".colorize(:grey) + "#{Makit::Humanize.get_humanized_size(Makit::Directory.get_size(path))}".colorize(:cyan)
|
54
58
|
else
|
55
|
-
|
59
|
+
puts "#{path} does not exist"
|
56
60
|
end
|
57
61
|
end
|
58
62
|
|
data/lib/makit/version.rb
CHANGED
data/lib/makit.rb
CHANGED
@@ -4,8 +4,21 @@ require "rake/clean"
|
|
4
4
|
require "logger"
|
5
5
|
require "json"
|
6
6
|
require "yaml"
|
7
|
+
require "google/protobuf"
|
7
8
|
|
8
|
-
|
9
|
+
#%w[generated/makit].each do |dir|
|
10
|
+
# Dir[File.join(__dir__, dir, "*.rb")].each do |file|
|
11
|
+
# require_relative file
|
12
|
+
# end
|
13
|
+
#end
|
14
|
+
if (File.exist?("protos/makit/makit.v1.proto.rb"))
|
15
|
+
require_relative "generated/makit/makit.v1_pb"
|
16
|
+
else
|
17
|
+
require_relative "makit/v1/makit.v1_pb"
|
18
|
+
end
|
19
|
+
|
20
|
+
#%w[makit makit/v1 makit/cli makit/content makit/mp].each do |dir|
|
21
|
+
%w[makit makit/cli makit/content makit/mp].each do |dir|
|
9
22
|
Dir[File.join(__dir__, dir, "*.rb")].each do |file|
|
10
23
|
require_relative file
|
11
24
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: makit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.28
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lou Parslow
|
@@ -143,6 +143,8 @@ executables: []
|
|
143
143
|
extensions: []
|
144
144
|
extra_rdoc_files: []
|
145
145
|
files:
|
146
|
+
- lib/generated/makit/v1/makit.v1_pb.rb
|
147
|
+
- lib/generated/makit/v1/web/link_pb.rb
|
146
148
|
- lib/makit.rb
|
147
149
|
- lib/makit/apache.rb
|
148
150
|
- lib/makit/cli/clean.rb
|