makit 0.0.16 → 0.0.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/makit/command_runner.rb +4 -1
- data/lib/makit/humanize.rb +17 -0
- data/lib/makit/mp/project_mp.rb +1 -0
- data/lib/makit/v1/makit.v1_pb.rb +1 -1
- data/lib/makit/version.rb +1 -1
- data/lib/makit.rb +7 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6907ebf24a2329adf0bba41970b506e5b1a21d0459c82a0c44aa721946015c42
|
4
|
+
data.tar.gz: 36276973efd109200ea9448bbf9a072d3f43f4c983d28b71f520442f0dcb9b96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fecfe917f1dd787788af641b4b15a63a7f94dfe44b6efa0f008c1a8f90db5e1f61dc580a9a4fdb558f940c7b858138049e7912af094433a3c2b58aa49d884a2d
|
7
|
+
data.tar.gz: eade8504dd9d374edf17095af9a74dd10341c6092e861c1208a135f8973d5a6a9adf302245383d2849362c7397cf496d99dfd8612f0a5bd539f7a8badf14104f
|
data/lib/makit/command_runner.rb
CHANGED
@@ -51,9 +51,12 @@ module Makit
|
|
51
51
|
if File.exist?(cache_filename)
|
52
52
|
#puts "cache file date: #{File.mtime(cache_filename)}"
|
53
53
|
if (File.mtime(cache_filename) > timestamp)
|
54
|
-
|
54
|
+
puts " found cached command (newer than #{timestamp})".colorize(:grey)
|
55
55
|
command = Makit::Serializer.open(cache_filename, Makit::V1::Command)
|
56
56
|
show_command(command)
|
57
|
+
if command.exit_code != 0
|
58
|
+
abort "cached command failed: #{command.name} #{command.arguments.join(" ")}"
|
59
|
+
end
|
57
60
|
return command #Makit::Serializer.open(cache_filename, Makit::V1::Command)
|
58
61
|
else
|
59
62
|
#puts "cache_filename exists, but is older than #{timestamp}"
|
data/lib/makit/humanize.rb
CHANGED
@@ -85,5 +85,22 @@ module Makit
|
|
85
85
|
seconds = (total_seconds % 60).round(2)
|
86
86
|
"#{hours}h #{minutes}m #{seconds}s"
|
87
87
|
end
|
88
|
+
|
89
|
+
def self.get_humanized_duration(seconds)
|
90
|
+
minutes = (seconds / 60).to_i
|
91
|
+
seconds = (seconds % 60).to_i
|
92
|
+
hours = (minutes / 60).to_i
|
93
|
+
minutes = minutes % 60
|
94
|
+
days = (hours / 24).to_i
|
95
|
+
hours = hours % 24
|
96
|
+
|
97
|
+
parts = []
|
98
|
+
parts << "#{days} days" if days > 0
|
99
|
+
parts << "#{hours} hours" if hours > 0
|
100
|
+
parts << "#{minutes} minutes" if minutes > 0
|
101
|
+
parts << "#{seconds} seconds" if seconds > 0
|
102
|
+
|
103
|
+
parts.join(", ")
|
104
|
+
end
|
88
105
|
end
|
89
106
|
end
|
data/lib/makit/mp/project_mp.rb
CHANGED
data/lib/makit/v1/makit.v1_pb.rb
CHANGED
@@ -8,7 +8,7 @@ require 'google/protobuf/timestamp_pb'
|
|
8
8
|
require 'google/protobuf/duration_pb'
|
9
9
|
|
10
10
|
|
11
|
-
descriptor_data = "\n\x1blib/makit/v1/makit.v1.proto\x12\x08makit.v1\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/duration.proto\"\
|
11
|
+
descriptor_data = "\n\x1blib/makit/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\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
12
|
|
13
13
|
pool = Google::Protobuf::DescriptorPool.generated_pool
|
14
14
|
pool.add_serialized_file(descriptor_data)
|
data/lib/makit/version.rb
CHANGED
data/lib/makit.rb
CHANGED
@@ -15,13 +15,15 @@ module Makit
|
|
15
15
|
class Error < StandardError; end
|
16
16
|
|
17
17
|
# Constants
|
18
|
-
#PROJECT = Makit::V1::Project.create
|
19
|
-
PROJECT=Makit::V1::Project.new()
|
20
|
-
PROJECT.set_default_values
|
21
18
|
if File.exist? ".makit.project.json"
|
22
|
-
PROJECT.open
|
19
|
+
PROJECT = Makit::Serializer.open(".makit.project.json", Makit::V1::Project)
|
23
20
|
else
|
24
|
-
|
21
|
+
if File.exist? ".makit.project.yml"
|
22
|
+
PROJECT = Makit::Serializer.open(".makit.project.yml", Makit::V1::Project)
|
23
|
+
else
|
24
|
+
PROJECT = Makit::V1::Project.new
|
25
|
+
PROJECT.set_default_values
|
26
|
+
end
|
25
27
|
end
|
26
28
|
|
27
29
|
|