raykit 0.0.87 → 0.0.88
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/raykit/version.rb +64 -33
- 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: d0b1374b129172e8702eebe947f177b4e694a16adc5ca5cdf301c137eba6e6cd
|
4
|
+
data.tar.gz: 9fb05f3f1770975b5d61b5575409c7504e8d7a0feab90a017e4a9681142cc83b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 657d73fcacd253e9594ff3d1e266f7fa9ab5ac9153e0904986b089e4b42f365a9b69aaa02891381095353ffc896c1207dea3f96fd7fc1cbc240ab4d77433fdaa
|
7
|
+
data.tar.gz: 74702790f943eb649d922a754e45f4216c21a02093caac09542404d488034939795c1f1945e3b308a16207afc554fbeb2186070afcb210b14e70237cbb5b6198
|
data/lib/raykit/version.rb
CHANGED
@@ -6,41 +6,72 @@ module Raykit
|
|
6
6
|
# detect a version number based on the NAME variable, if defined
|
7
7
|
def self.detect(name,verbose=false)
|
8
8
|
puts 'detecting version' if(verbose)
|
9
|
-
|
10
|
-
if(
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
9
|
+
version=detect_from_file("#{name}/#{name}.csproj",/<Version>([\d.]+)</,verbose)
|
10
|
+
return version if(version.length>0)
|
11
|
+
|
12
|
+
version=detect_from_file("#{name}/Properties/AssemblyInfo.cs",/^\[assembly: AssemblyVersion\(\"([.\w]+)/,verbose)
|
13
|
+
return version if(version.length>0)
|
14
|
+
|
15
|
+
version=detect_from_file("#{name}.gemspec",/version[\s]+=[\s]+['"]([\w.]+)['"]/,verbose)
|
16
|
+
return version if(version.length>0)
|
17
|
+
|
18
|
+
version=detect_from_file("#{name}.nuspec",/<[Vv]ersion>([\d.]+)</,verbose)
|
19
|
+
return version if(version.length>0)
|
20
|
+
|
21
|
+
''
|
22
|
+
|
23
|
+
#csproj_filename = "#{name}/#{name}.csproj"
|
24
|
+
#if(File.exists?(csproj_filename))
|
25
|
+
# puts "checking version in #{csproj_filename}" if(verbose)
|
26
|
+
# match = IO.read(csproj_filename).match(/<Version>([\d.]+)</)
|
27
|
+
# if(!match.nil? && match.captures.length>0)
|
28
|
+
# return match.captures[0]
|
29
|
+
# end
|
30
|
+
#else
|
31
|
+
# puts "#{csproj_filename} not found" if(verbose)
|
32
|
+
#end
|
33
|
+
#assembly_info_filename = "#{name}/Properties/AssemblyInfo.cs"
|
34
|
+
#if(File.exists?(assembly_info_filename))
|
35
|
+
# puts "checking version in #{assembly_info_filename}" if(verbose)
|
36
|
+
# match = IO.read(csproj_filename).match(/^\[assembly: AssemblyVersion\(\"([.\w]+)/)
|
37
|
+
# if(!match.nil? && match.captures.length>0)
|
38
|
+
# return match.captures[0]
|
39
|
+
# else
|
40
|
+
# puts "no match for assembly regex in #{assembly_info_filename}" if(match.nil? && verbose)
|
41
|
+
# puts "no assembly regex captures in #{assembly_info_filename}" if(match.nil? && verbose)
|
42
|
+
# end
|
43
|
+
#else
|
44
|
+
# puts "#{assembly_info_filename} not found" if(verbose)
|
45
|
+
#end
|
46
|
+
#gemspec_filename = "#{name}.gemspec"
|
47
|
+
#if(File.exists?(gemspec_filename))
|
48
|
+
# return IO.read(gemspec_filename).match(/version[\s]+=[\s]+['"]([\w.]+)['"]/).captures[0]
|
49
|
+
#end
|
50
|
+
#nuspec_filename="#{name}.nuspec"
|
51
|
+
#if(File.exists?(nuspec_filename))
|
52
|
+
# match = IO.read(nuspec_filename).match(/<[Vv]ersion>([\d.]+)</)
|
53
|
+
# if(!match.nil? && match.captures.length>0)
|
54
|
+
# return match.captures[0]
|
55
|
+
# end
|
56
|
+
##end
|
57
|
+
#'0.0.0'
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.detect_from_file(filename,regex,verbose)
|
61
|
+
puts "detecting version from file #{filename} with regex #{regex}" if(verbose)
|
62
|
+
if(File.exists?(filename))
|
63
|
+
match = IO.read(filename).match(regex)
|
64
|
+
if(!match.nil? && match.captures.length>0)
|
65
|
+
puts "captured #{match.captures[0]}" if(verbose)
|
66
|
+
return match.captures[0]
|
29
67
|
else
|
30
|
-
puts "#{
|
31
|
-
|
32
|
-
gemspec_filename = "#{name}.gemspec"
|
33
|
-
if(File.exists?(gemspec_filename))
|
34
|
-
return IO.read(gemspec_filename).match(/version[\s]+=[\s]+['"]([\w.]+)['"]/).captures[0]
|
35
|
-
end
|
36
|
-
nuspec_filename="#{name}.nuspec"
|
37
|
-
if(File.exists?(nuspec_filename))
|
38
|
-
match = IO.read(nuspec_filename).match(/<[Vv]ersion>([\d.]+)</)
|
39
|
-
if(!match.nil? && match.captures.length>0)
|
40
|
-
return match.captures[0]
|
41
|
-
end
|
68
|
+
puts "no match for assembly regex in #{filename}" if(match.nil? && verbose)
|
69
|
+
puts "no assembly regex captures in #{filename}" if(match.nil? && verbose)
|
42
70
|
end
|
43
|
-
|
71
|
+
else
|
72
|
+
puts "#{filename} not found" if(verbose)
|
73
|
+
end
|
74
|
+
''
|
44
75
|
end
|
45
76
|
end
|
46
77
|
end
|