makit 0.0.39 → 0.0.40
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/makit/show.rb +23 -1
- data/lib/makit/tasks.rb +4 -4
- 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/show.rb
CHANGED
@@ -80,7 +80,29 @@ module Makit
|
|
80
80
|
def success(text)
|
81
81
|
puts " ".colorize(:grey) + "#{text}".colorize(:green)
|
82
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
|
83
105
|
end
|
84
106
|
end
|
85
107
|
|
86
|
-
|
108
|
+
|
data/lib/makit/tasks.rb
CHANGED
@@ -15,7 +15,7 @@ end
|
|
15
15
|
|
16
16
|
desc "Remove any temporary products."
|
17
17
|
task :clean do
|
18
|
-
Makit::SHOW.task(:
|
18
|
+
Makit::SHOW.task(:clean)
|
19
19
|
Makit::RUNNER.run(Makit::RUNNER.parse_command_request("git clean -dXf"))
|
20
20
|
end
|
21
21
|
|
@@ -27,7 +27,7 @@ end
|
|
27
27
|
|
28
28
|
desc "Sync changes with the git repository."
|
29
29
|
task :sync do
|
30
|
-
Makit::SHOW.task(:
|
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
|
-
Makit::SHOW.task(:
|
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
|
-
Makit::SHOW.task(:
|
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/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
|