raykit 0.0.304 → 0.0.305

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.
@@ -1,101 +1,94 @@
1
- #warn "[DEPRECATION] Raykit::VersionHelper is deprecated. Use bump gem for better transparency."
1
+ # frozen_string_literal: true
2
+
3
+ # warn "[DEPRECATION] Raykit::VersionHelper is deprecated. Use bump gem for better transparency."
2
4
 
3
5
  module Raykit
4
- # Version functionality
5
- class Version
6
- attr_accessor :start_time
6
+ # Version functionality
7
+ class Version
8
+ attr_accessor :start_time
7
9
 
8
- # detect a version number based on the NAME variable, if defined
9
- def self.detect(name,verbose=false)
10
- version=detect_from_file("#{name}/#{name}.csproj",/<Version>([-\w\d\.]+)</,verbose)
11
- return version if(version.length>0)
10
+ # detect a version number based on the NAME variable, if defined
11
+ def self.detect(name, verbose = false)
12
+ version = detect_from_file("#{name}/#{name}.csproj", /<Version>([-\w\d.]+)</, verbose)
13
+ return version if version.length.positive?
12
14
 
13
- version=detect_from_file("#{name}/Properties/AssemblyInfo.cs",/^\[assembly: AssemblyVersion\(\"([.\w]+)/,verbose)
14
- return version if(version.length>0)
15
+ version = detect_from_file("#{name}/Properties/AssemblyInfo.cs", /^\[assembly: AssemblyVersion\("([.\w]+)/,
16
+ verbose)
17
+ return version if version.length.positive?
15
18
 
16
- version=detect_from_file("#{name}.gemspec",/version[\s]+=[\s]+['"]([\w.]+)['"]/,verbose)
17
- return version if(version.length>0)
19
+ version = detect_from_file("#{name}.gemspec", /version\s+=\s+['"]([\w.]+)['"]/, verbose)
20
+ return version if version.length.positive?
18
21
 
19
- version=detect_from_file("#{name}.gemspec",/version\s?=\s?['|"]([.\d]+)['|"]/,verbose)
20
- return version if(version.length>0)
22
+ version = detect_from_file("#{name}.gemspec", /version\s?=\s?['|"]([.\d]+)['|"]/, verbose)
23
+ return version if version.length.positive?
21
24
 
22
- version=detect_from_file("#{name}.nuspec",/<[Vv]ersion>([\d.]+)</,verbose)
23
- return version if(version.length>0)
25
+ version = detect_from_file("#{name}.nuspec", /<[Vv]ersion>([\d.]+)</, verbose)
26
+ return version if version.length.positive?
24
27
 
25
- if(verbose)
26
- warning="\u26A0"
27
- symbol=Rainbow(warning.encode('utf-8')).yellow
28
- puts symbol + ' version not detected'
29
- end
30
- ''
31
- end
28
+ if verbose
29
+ warning = "\u26A0"
30
+ symbol = Rainbow(warning.encode("utf-8")).yellow
31
+ puts "#{symbol} version not detected"
32
+ end
33
+ ""
34
+ end
32
35
 
33
- def self.detect_from_file(filename,regex,verbose)
34
- version=''
35
- if(File.exists?(filename))
36
- match = IO.read(filename).match(regex)
37
- if(!match.nil? && match.captures.length>0)
38
- version = match.captures[0]
39
- end
40
- else
41
- return ''
42
- end
43
- if(verbose)
44
- if(version.length > 0)
45
- puts "version detected in #{filename}"
46
- else
47
- puts "no version detected in #{filename}, regex #{regex.source}"
48
- end
49
- end
50
- version
36
+ def self.detect_from_file(filename, regex, verbose)
37
+ version = ""
38
+ if File.exist?(filename)
39
+ match = IO.read(filename).match(regex)
40
+ version = match.captures[0] if !match.nil? && match.captures.length.positive?
41
+ else
42
+ return ""
43
+ end
44
+ if verbose
45
+ if version.length.positive?
46
+ puts "version detected in #{filename}"
47
+ else
48
+ puts "no version detected in #{filename}, regex #{regex.source}"
51
49
  end
50
+ end
51
+ version
52
+ end
52
53
 
53
- def self.set_version_in_file(filename,version)
54
- text=IO.read(filename)
55
- if(filename.include?('.gemspec'))
56
- new_text=text.gsub(/version\s?=\s?['|"]([.\d]+)['|"]/,"version='#{version}'")
57
- end
58
- if(filename.include?('.csproj'))
59
- new_text=text.gsub(/<Version>([-\w\d.]+)</,"<Version>#{version}<")
60
- end
61
- #new_text=text.gsub(/<Version>([-\w\d.]+)</,"<Version>#{version}<")
62
- #new_text=new_text.gsub(/version[\s]+=\s?['|"]([.\d]+)['|"]/,"version='#{version}'")
63
- #new_text=new_text.gsub(/Version="([.\d]+)"/,"Version=\"#{version}\"")
64
- File.open(filename,'w'){|f|f.write(new_text)} if(new_text!=text)
65
- end
54
+ def self.set_version_in_file(filename, version)
55
+ text = IO.read(filename)
56
+ new_text = text.gsub(/version\s?=\s?['|"]([.\d]+)['|"]/, "version='#{version}'") if filename.include?(".gemspec")
57
+ new_text = text.gsub(/<Version>([-\w\d.]+)</, "<Version>#{version}<") if filename.include?(".csproj")
58
+ # new_text=text.gsub(/<Version>([-\w\d.]+)</,"<Version>#{version}<")
59
+ # new_text=new_text.gsub(/version[\s]+=\s?['|"]([.\d]+)['|"]/,"version='#{version}'")
60
+ # new_text=new_text.gsub(/Version="([.\d]+)"/,"Version=\"#{version}\"")
61
+ File.open(filename, "w") { |f| f.write(new_text) } if new_text != text
62
+ end
66
63
 
67
- def self.sync_file_versions(source_filename,destination_filename)
68
- version = Version.detect_from_file(source_filename,/<Version>([-\w\d.]+)</,false)
69
- Version.set_version_in_file(destination_filename,version)
70
- end
64
+ def self.sync_file_versions(source_filename, destination_filename)
65
+ version = Version.detect_from_file(source_filename, /<Version>([-\w\d.]+)</, false)
66
+ Version.set_version_in_file(destination_filename, version)
67
+ end
71
68
 
72
- # increment to last digit of a version string
73
- def self.bump(version)
74
- # major.minor[.build[.revision]] (example: 1.2.12.102)
75
- version_ints = version.split('.').map{|s| s.to_i}
76
- version_ints[-1] = version_ints.last + 1;
77
- version_ints.map{|i| i.to_s}.join('.')
78
- end
69
+ # increment to last digit of a version string
70
+ def self.bump(version)
71
+ # major.minor[.build[.revision]] (example: 1.2.12.102)
72
+ version_ints = version.split(".").map(&:to_i)
73
+ version_ints[-1] = version_ints.last + 1
74
+ version_ints.map(&:to_s).join(".")
75
+ end
79
76
 
80
- def self.bump_file(filename)
81
- if(!File.exist?(filename))
82
- warn "Raykit::Version.bump_file filename '#{filename}' does not exist."
83
- end
84
-
85
- old_version=''
86
- if(filename.include?('.gemspec'))
87
- old_version=detect_from_file(filename,/version\s?=\s?['|"]([.\d]+)['|"]/,false)
88
- end
89
- if(filename.include?('.csproj'))
90
- old_version=detect_from_file(filename,/<Version>([-\w\d.]+)</,false)
91
- end
92
-
93
- if(old_version.length > 0)
94
- new_version = bump(old_version)
95
- set_version_in_file(filename,new_version)
96
- end
97
-
98
- new_version
99
- end
77
+ def self.bump_file(filename)
78
+ warn "Raykit::Version.bump_file filename '#{filename}' does not exist." unless File.exist?(filename)
79
+
80
+ old_version = ""
81
+ if filename.include?(".gemspec")
82
+ old_version = detect_from_file(filename, /version\s?=\s?['|"]([.\d]+)['|"]/, false)
83
+ end
84
+ old_version = detect_from_file(filename, /<Version>([-\w\d.]+)</, false) if filename.include?(".csproj")
85
+
86
+ if old_version.length.positive?
87
+ new_version = bump(old_version)
88
+ set_version_in_file(filename, new_version)
89
+ end
90
+
91
+ new_version
100
92
  end
101
- end
93
+ end
94
+ end
data/lib/raykit/vstest.rb CHANGED
@@ -1,19 +1,21 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Raykit
2
- class VsTest
3
- def self.vstest_path
4
- ['2019/Community/Common7/IDE/CommonExtensions/Microsoft',
5
- '2019/Professional/Common7/IDE/Extensions/TestPlatform',
6
- '2019/Community/Common7/IDE/Extensions',
7
- '2019/Community/Common7/IDE/Extensions/TestPlatform',
8
- '2022/Preview/Common7/IDE/Extensions/TestPlatform'].each{|relative_path|
9
- ['C:/Program Files (x86)/Microsoft Visual Studio/',
10
- 'C:/Program Files/Microsoft Visual Studio/'].each{|root_path|
11
- path = root_path + relative_path
12
- exe_path = path + '/vstest.console.exe'
13
- return path if(Dir.exists?(path)) && File.exist?(exe_path)
14
- }
15
- }
16
- return "vstest_path not found"
4
+ class VsTest
5
+ def self.vstest_path
6
+ ["2019/Community/Common7/IDE/CommonExtensions/Microsoft",
7
+ "2019/Professional/Common7/IDE/Extensions/TestPlatform",
8
+ "2019/Community/Common7/IDE/Extensions",
9
+ "2019/Community/Common7/IDE/Extensions/TestPlatform",
10
+ "2022/Preview/Common7/IDE/Extensions/TestPlatform"].each do |relative_path|
11
+ ["C:/Program Files (x86)/Microsoft Visual Studio/",
12
+ "C:/Program Files/Microsoft Visual Studio/"].each do |root_path|
13
+ path = root_path + relative_path
14
+ exe_path = "#{path}/vstest.console.exe"
15
+ return path if Dir.exist?(path) && File.exist?(exe_path)
17
16
  end
17
+ end
18
+ "vstest_path not found"
18
19
  end
20
+ end
19
21
  end
data/lib/raykit/zip.rb CHANGED
@@ -1,46 +1,44 @@
1
+ # frozen_string_literal: true
1
2
 
2
3
  module Raykit
3
- class Zip
4
- @filename
5
- @source_dir
6
- @include_globs
7
- @exclude_globs
8
-
9
- def initialize(filename)
10
- @filename = filename
11
- @source_dir = Dir.pwd
12
- @include_globs=Array::new
13
- @exclude_globs=Array::new
14
- self
15
- end
16
-
17
- def source_dir(dir)
18
- @source_dir=dir
19
- self
20
- end
4
+ class Zip
5
+ @filename
6
+ @source_dir
7
+ @include_globs
8
+ @exclude_globs
9
+
10
+ def initialize(filename)
11
+ @filename = filename
12
+ @source_dir = Dir.pwd
13
+ @include_globs = []
14
+ @exclude_globs = []
15
+ self
16
+ end
21
17
 
22
- def include_glob(glob)
23
- @include_globs << glob
24
- self
25
- end
18
+ def source_dir(dir)
19
+ @source_dir = dir
20
+ self
21
+ end
26
22
 
27
- def exclude_glob(glob)
28
- @exclude_globs << glob
29
- self
30
- end
23
+ def include_glob(glob)
24
+ @include_globs << glob
25
+ self
26
+ end
31
27
 
32
- def zip
33
- path = File.dirname(@filename)
34
- if !Dir.exists?(path)
35
- FileUtils.mkdir_p(path)
36
- end
28
+ def exclude_glob(glob)
29
+ @exclude_globs << glob
30
+ self
31
+ end
37
32
 
38
- Dir.chdir(@source_dir) do
39
- include_files=Array::new
40
- @include_globs.each{|include_glob|
33
+ def zip
34
+ path = File.dirname(@filename)
35
+ FileUtils.mkdir_p(path) unless Dir.exist?(path)
41
36
 
42
- }
43
- end
37
+ Dir.chdir(@source_dir) do
38
+ include_files = []
39
+ @include_globs.each do |include_glob|
44
40
  end
41
+ end
45
42
  end
46
- end
43
+ end
44
+ end
data/lib/raykit.rb CHANGED
@@ -1,17 +1,17 @@
1
- require 'rainbow'
2
- require 'rake/clean'
3
- require 'open3'
4
- require 'rake/testtask'
5
- require 'digest'
1
+ # frozen_string_literal: true
6
2
 
7
- lib_dir=File.dirname(__FILE__)
8
- Dir.glob(lib_dir + '/raykit/**/*.rb') {|file| require file}
3
+ require "rainbow"
4
+ require "rake/clean"
5
+ require "open3"
6
+ require "rake/testtask"
7
+ require "digest"
9
8
 
10
- PROJECT=Raykit::Project.new
11
- SECRETS=Raykit::Secrets.new
12
- #TIMER=Raykit::Timer.new
9
+ lib_dir = File.dirname(__FILE__)
10
+ Dir.glob("#{lib_dir}/raykit/**/*.rb").sort.each { |file| require file }
13
11
 
14
- REPOSITORIES = Raykit::Git::Repositories.new(Raykit::Environment::get_dev_dir('log') + "/Raykit.Git.Repositories.json")
15
- if(Dir.exist?('.git'))
16
- GIT_DIRECTORY=Raykit::Git::Directory.new(Rake.application.original_dir)
17
- end
12
+ PROJECT = Raykit::Project.new
13
+ SECRETS = Raykit::Secrets.new
14
+ # TIMER=Raykit::Timer.new
15
+
16
+ REPOSITORIES = Raykit::Git::Repositories.new("#{Raykit::Environment.get_dev_dir("log")}/Raykit.Git.Repositories.json")
17
+ GIT_DIRECTORY = Raykit::Git::Directory.new(Rake.application.original_dir) if Dir.exist?(".git")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: raykit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.304
4
+ version: 0.0.305
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lou Parslow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-14 00:00:00.000000000 Z
11
+ date: 2021-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -25,47 +25,47 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: yard
28
+ name: rainbow
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.9'
33
+ version: '3.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.9'
40
+ version: '3.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rainbow
42
+ name: slop
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '3.0'
47
+ version: '4.8'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '3.0'
54
+ version: '4.8'
55
55
  - !ruby/object:Gem::Dependency
56
- name: slop
56
+ name: yard
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '4.8'
61
+ version: '0.9'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '4.8'
68
+ version: '0.9'
69
69
  description: supports common ci/cd development tasks
70
70
  email: lou.parslow@gmail.com
71
71
  executables: