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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/raykit/version.rb +27 -54
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0b1374b129172e8702eebe947f177b4e694a16adc5ca5cdf301c137eba6e6cd
4
- data.tar.gz: 9fb05f3f1770975b5d61b5575409c7504e8d7a0feab90a017e4a9681142cc83b
3
+ metadata.gz: aa6efba922129fdee15789d267f758b6a78cf9575d52317c902abeac8f7a18b2
4
+ data.tar.gz: 1f9abe8c4fcd7bc23be5208533f59a76362fab0afa9cdc88cf61537cdf09674b
5
5
  SHA512:
6
- metadata.gz: 657d73fcacd253e9594ff3d1e266f7fa9ab5ac9153e0904986b089e4b42f365a9b69aaa02891381095353ffc896c1207dea3f96fd7fc1cbc240ab4d77433fdaa
7
- data.tar.gz: 74702790f943eb649d922a754e45f4216c21a02093caac09542404d488034939795c1f1945e3b308a16207afc554fbeb2186070afcb210b14e70237cbb5b6198
6
+ metadata.gz: 93ca4f7d319c43e36e5431cbede94ea25b30dd2a486801373f3a6045d4c47eaa47a6776b18eb69b03516b7d524aaf883bbe0aba91ba0311407a90cfcc0923f9a
7
+ data.tar.gz: dee95d06fd9913471dcef9f4c0c5bb4a437be84b031d6a63e649a166cae3e5a8a9d1e757084b829f115a9a5dc9bec52d8a555fe926cb555c48cbb8d3dc48ff4e
@@ -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
- puts 'detecting version' if(verbose)
9
- version=detect_from_file("#{name}/#{name}.csproj",/<Version>([\d.]+)</,verbose)
10
- return version if(version.length>0)
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
- version=detect_from_file("#{name}/Properties/AssemblyInfo.cs",/^\[assembly: AssemblyVersion\(\"([.\w]+)/,verbose)
13
- return version if(version.length>0)
12
+ version=detect_from_file("#{name}/Properties/AssemblyInfo.cs",/^\[assembly: AssemblyVersion\(\"([.\w]+)/,verbose)
13
+ return version if(version.length>0)
14
14
 
15
- version=detect_from_file("#{name}.gemspec",/version[\s]+=[\s]+['"]([\w.]+)['"]/,verbose)
16
- return version if(version.length>0)
15
+ version=detect_from_file("#{name}.gemspec",/version[\s]+=[\s]+['"]([\w.]+)['"]/,verbose)
16
+ return version if(version.length>0)
17
17
 
18
- version=detect_from_file("#{name}.nuspec",/<[Vv]ersion>([\d.]+)</,verbose)
19
- return version if(version.length>0)
18
+ version=detect_from_file("#{name}.nuspec",/<[Vv]ersion>([\d.]+)</,verbose)
19
+ return version if(version.length>0)
20
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'
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
- puts "detecting version from file #{filename} with regex #{regex}" if(verbose)
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
- puts "captured #{match.captures[0]}" if(verbose)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: raykit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.88
4
+ version: 0.0.89
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lou Parslow