makit 0.0.38 → 0.0.40
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/makit/directory.rb +16 -0
- data/lib/makit/git.rb +1 -0
- data/lib/makit/show.rb +35 -3
- data/lib/makit/tasks.rb +5 -5
- data/lib/makit/v1/makit.v1_pb.rb +34 -33
- data/lib/makit/version.rb +41 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93de9bfaedfa0557388f5bfd8f241fc289893106553c4947fa726a6ef494c808
|
4
|
+
data.tar.gz: e3fa7600024eae44bd5ded8398826064c302aa450850ea7c58f25957229b8ea5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f6f494ebbc66fc47fc94a20719d741b8fb85892d26a5bb2399e1b9e769d6e802a02643d1487ef289e1ca05eaacd9e4ec8c13ba02fdf0ad4cca40ace9a7e1289
|
7
|
+
data.tar.gz: aa932f069dd2f9a7038038d7c882e39128e2a2a245155ab164c027cc3217a57b1ccfa0512f3164c51614f13a7bf767afb45aeebe20997e9938b4a73b5c0e3b38
|
data/lib/makit/directory.rb
CHANGED
@@ -180,5 +180,21 @@ module Makit
|
|
180
180
|
end
|
181
181
|
end
|
182
182
|
end
|
183
|
+
|
184
|
+
def self.remove_empty_directories(dir)
|
185
|
+
Find.find(dir) do |path|
|
186
|
+
if File.directory?(path) && Dir.empty?(path)
|
187
|
+
FileUtils.rm_rf(path)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
def self.remove_empty_directories_recursively(dir)
|
193
|
+
Find.find(dir) do |path|
|
194
|
+
if File.directory?(path) && Dir.empty?(path)
|
195
|
+
FileUtils.rm_rf(path)
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
183
199
|
end
|
184
200
|
end
|
data/lib/makit/git.rb
CHANGED
data/lib/makit/show.rb
CHANGED
@@ -34,7 +34,8 @@ module Makit
|
|
34
34
|
if File.file?(path)
|
35
35
|
modified = File.mtime(path)
|
36
36
|
age = (Time.now - modified).to_f
|
37
|
-
|
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)
|
38
39
|
else
|
39
40
|
puts "#{path} does not exist"
|
40
41
|
end
|
@@ -42,7 +43,8 @@ module Makit
|
|
42
43
|
|
43
44
|
def file_symbol
|
44
45
|
#📄 (U+1F4C4) – "Page with Curl"
|
45
|
-
"\u{1F4C4}"
|
46
|
+
#"\u{1F4C4}"
|
47
|
+
"@"
|
46
48
|
end
|
47
49
|
|
48
50
|
def directory_symbol
|
@@ -70,7 +72,37 @@ module Makit
|
|
70
72
|
puts " ".colorize(:grey) + "#{task}".colorize(:green)
|
71
73
|
#puts ("=" * 100).colorize(:grey)
|
72
74
|
end
|
75
|
+
|
76
|
+
def info(text)
|
77
|
+
puts " ".colorize(:grey) + "#{text}".colorize(:cyan)
|
78
|
+
end
|
79
|
+
|
80
|
+
def success(text)
|
81
|
+
puts " ".colorize(:grey) + "#{text}".colorize(:green)
|
82
|
+
end
|
83
|
+
|
84
|
+
def version(path)
|
85
|
+
puts " #{Makit::Version.get_version_from_file(path)}".colorize(:green) + " found in #{path}".colorize(:grey)
|
86
|
+
#if(!File.exist?(path))
|
87
|
+
# puts "file #{path}does not exist"
|
88
|
+
# return
|
89
|
+
#end
|
90
|
+
|
91
|
+
#extension = File.extname(path)
|
92
|
+
#switch = extension.downcase
|
93
|
+
#case switch
|
94
|
+
#if extension == ".csproj"
|
95
|
+
# version = Makit::Version.detect_from_file(path, /<Version>([-\w\d.]+)</)
|
96
|
+
# if version.empty?
|
97
|
+
# puts "no version found in #{path}"
|
98
|
+
# else
|
99
|
+
# puts " #{version}".colorize(:green) + " found in #{path}".colorize(:grey)
|
100
|
+
# end
|
101
|
+
# else
|
102
|
+
## puts "unrecognized file type"
|
103
|
+
#end
|
104
|
+
end
|
73
105
|
end
|
74
106
|
end
|
75
107
|
|
76
|
-
|
108
|
+
|
data/lib/makit/tasks.rb
CHANGED
@@ -15,19 +15,19 @@ end
|
|
15
15
|
|
16
16
|
desc "Remove any temporary products."
|
17
17
|
task :clean do
|
18
|
-
|
18
|
+
Makit::SHOW.task(:clean)
|
19
19
|
Makit::RUNNER.run(Makit::RUNNER.parse_command_request("git clean -dXf"))
|
20
20
|
end
|
21
21
|
|
22
22
|
desc "Integrate changes into the git repository."
|
23
23
|
task :integrate do
|
24
|
-
|
24
|
+
Makit::SHOW.task(:integrate)
|
25
25
|
Makit::Git.integrate
|
26
26
|
end
|
27
27
|
|
28
28
|
desc "Sync changes with the git repository."
|
29
29
|
task :sync do
|
30
|
-
|
30
|
+
Makit::SHOW.task(:sync)
|
31
31
|
Makit::Git.sync
|
32
32
|
end
|
33
33
|
|
@@ -38,13 +38,13 @@ end
|
|
38
38
|
|
39
39
|
desc "Format source code."
|
40
40
|
task :format do
|
41
|
-
|
41
|
+
Makit::SHOW.task(:format)
|
42
42
|
Makit::RUNNER.try("rufo .") if File.exist?("Gemfile") || File.exist?("Rakefile")
|
43
43
|
end
|
44
44
|
|
45
45
|
desc "Update dependencies."
|
46
46
|
task :update do
|
47
|
-
|
47
|
+
Makit::SHOW.task(:update)
|
48
48
|
system("bundle update") if File.exist?("Gemfile")
|
49
49
|
# glob all *.csproj files
|
50
50
|
Dir.glob("**/*.csproj").each do |file|
|
data/lib/makit/v1/makit.v1_pb.rb
CHANGED
@@ -1,33 +1,34 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
|
-
# source: lib/makit/v1/makit.v1.proto
|
4
|
-
|
5
|
-
require
|
6
|
-
|
7
|
-
require
|
8
|
-
require
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
pool.
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
|
+
# source: lib/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\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\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
|
data/lib/makit/version.rb
CHANGED
@@ -1,12 +1,52 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Makit
|
4
|
-
VERSION = "0.0.
|
4
|
+
VERSION = "0.0.40"
|
5
5
|
|
6
6
|
class Version
|
7
7
|
# given an array of version strings, return the highest version
|
8
8
|
def self.get_highest_version(versions)
|
9
9
|
versions.sort { |a, b| Gem::Version.new(a) <=> Gem::Version.new(b) }.last
|
10
10
|
end
|
11
|
+
|
12
|
+
def self.get_version_from_file(path)
|
13
|
+
if(!File.exist?(path))
|
14
|
+
raise "file #{path}does not exist"
|
15
|
+
end
|
16
|
+
|
17
|
+
extension = File.extname(path)
|
18
|
+
#switch = extension.downcase
|
19
|
+
#case switch
|
20
|
+
#if extension == ".csproj"
|
21
|
+
switch = extension.downcase
|
22
|
+
case switch
|
23
|
+
when ".csproj"
|
24
|
+
Makit::Version.detect_from_file(path, /<Version>([-\w\d.]+)</)
|
25
|
+
when ".wxs"
|
26
|
+
Makit::Version.detect_from_file(path, / Version="([\d\.]+)"/)
|
27
|
+
else
|
28
|
+
raise "unrecognized file type"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.detect_from_file(filename, regex)
|
33
|
+
if File.exist?(filename)
|
34
|
+
match = IO.read(filename).match(regex)
|
35
|
+
match.captures[0] if !match.nil? && match.captures.length.positive?
|
36
|
+
else
|
37
|
+
raise "unable to find version in #{filename}"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.set_version_in_file(filename, version)
|
42
|
+
text = IO.read(filename)
|
43
|
+
new_text = text
|
44
|
+
new_text = text.gsub(/version\s?=\s?['|"]([.\d]+)['|"]/, "version='#{version}'") if filename.include?(".gemspec")
|
45
|
+
new_text = text.gsub(/<Version>([-\w\d.]+)</, "<Version>#{version}<") if filename.include?(".csproj")
|
46
|
+
new_text = text.gsub(/<version>([-\w\d.]+)</, "<version>#{version}<") if filename.include?(".nuspec")
|
47
|
+
new_text = text.gsub(/ Version="([\d\.]+)"/, " Version=\"#{version}\"") if filename.include?(".wxs")
|
48
|
+
new_text = text.gsub(/version\s+=\s+['"]([\w.]+)['"]/, "version=\"#{version}\"") if filename.include?(".toml")
|
49
|
+
File.open(filename, "w") { |f| f.write(new_text) } if new_text != text
|
50
|
+
end
|
11
51
|
end
|
12
52
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.40
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lou Parslow
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|