raykit 0.0.88 → 0.0.89
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 +27 -54
- 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: aa6efba922129fdee15789d267f758b6a78cf9575d52317c902abeac8f7a18b2
|
4
|
+
data.tar.gz: 1f9abe8c4fcd7bc23be5208533f59a76362fab0afa9cdc88cf61537cdf09674b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93ca4f7d319c43e36e5431cbede94ea25b30dd2a486801373f3a6045d4c47eaa47a6776b18eb69b03516b7d524aaf883bbe0aba91ba0311407a90cfcc0923f9a
|
7
|
+
data.tar.gz: dee95d06fd9913471dcef9f4c0c5bb4a437be84b031d6a63e649a166cae3e5a8a9d1e757084b829f115a9a5dc9bec52d8a555fe926cb555c48cbb8d3dc48ff4e
|
data/lib/raykit/version.rb
CHANGED
@@ -5,73 +5,46 @@ module Raykit
|
|
5
5
|
|
6
6
|
# detect a version number based on the NAME variable, if defined
|
7
7
|
def self.detect(name,verbose=false)
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
#puts ' detecting version' if(verbose)
|
9
|
+
version=detect_from_file("#{name}/#{name}.csproj",/<Version>([\d.]+)</,verbose)
|
10
|
+
return version if(version.length>0)
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
version=detect_from_file("#{name}/Properties/AssemblyInfo.cs",/^\[assembly: AssemblyVersion\(\"([.\w]+)/,verbose)
|
13
|
+
return version if(version.length>0)
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
version=detect_from_file("#{name}.gemspec",/version[\s]+=[\s]+['"]([\w.]+)['"]/,verbose)
|
16
|
+
return version if(version.length>0)
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
version=detect_from_file("#{name}.nuspec",/<[Vv]ersion>([\d.]+)</,verbose)
|
19
|
+
return version if(version.length>0)
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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'
|
21
|
+
if(verbose)
|
22
|
+
warning="\u26A0"
|
23
|
+
symbol=Rainbow(warning.encode('utf-8')).yellow
|
24
|
+
puts symbol + ' version not detected'
|
25
|
+
end
|
26
|
+
''
|
58
27
|
end
|
59
28
|
|
60
29
|
def self.detect_from_file(filename,regex,verbose)
|
61
|
-
|
30
|
+
version=''
|
62
31
|
if(File.exists?(filename))
|
63
32
|
match = IO.read(filename).match(regex)
|
64
33
|
if(!match.nil? && match.captures.length>0)
|
65
|
-
|
66
|
-
return match.captures[0]
|
67
|
-
else
|
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)
|
34
|
+
version = match.captures[0]
|
70
35
|
end
|
71
36
|
else
|
72
|
-
puts "#{filename} not found" if(verbose)
|
37
|
+
#puts "#{filename} not found" if(verbose)
|
38
|
+
return ''
|
73
39
|
end
|
74
|
-
|
40
|
+
if(verbose)
|
41
|
+
if(version.length > 0)
|
42
|
+
puts "version detected in #{filename}"
|
43
|
+
else
|
44
|
+
puts "no version detected in #{filename}, regex #{regex.source}"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
version
|
75
48
|
end
|
76
49
|
end
|
77
50
|
end
|