raykit 0.0.483 → 0.0.484

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +21 -21
  3. data/README.md +20 -20
  4. data/bin/raykit +6 -6
  5. data/lib/raykit/auto_setup.rb +43 -43
  6. data/lib/raykit/command.rb +341 -341
  7. data/lib/raykit/conan/buildinfo.rb +69 -69
  8. data/lib/raykit/conanpackage.rb +49 -49
  9. data/lib/raykit/console.rb +272 -272
  10. data/lib/raykit/default_content.rb +227 -227
  11. data/lib/raykit/dir.rb +49 -49
  12. data/lib/raykit/dotnet.rb +176 -174
  13. data/lib/raykit/environment.rb +109 -109
  14. data/lib/raykit/filesystem.rb +34 -34
  15. data/lib/raykit/git/commit.rb +16 -16
  16. data/lib/raykit/git/directory.rb +216 -216
  17. data/lib/raykit/git/files.rb +46 -46
  18. data/lib/raykit/git/repositories.rb +89 -89
  19. data/lib/raykit/git/repository.rb +244 -244
  20. data/lib/raykit/installer.rb +17 -17
  21. data/lib/raykit/log.rb +80 -80
  22. data/lib/raykit/logevent.rb +49 -49
  23. data/lib/raykit/logging.rb +57 -57
  24. data/lib/raykit/markdown.rb +21 -21
  25. data/lib/raykit/msbuild.rb +54 -54
  26. data/lib/raykit/nugetpackage.rb +54 -54
  27. data/lib/raykit/nunit.rb +13 -13
  28. data/lib/raykit/project.rb +339 -339
  29. data/lib/raykit/rake.rb +39 -39
  30. data/lib/raykit/runner.rb +42 -42
  31. data/lib/raykit/secrets.rb +38 -38
  32. data/lib/raykit/sourceImport.rb +74 -74
  33. data/lib/raykit/sourceImports.rb +43 -43
  34. data/lib/raykit/string.rb +18 -18
  35. data/lib/raykit/tasks.rb +99 -99
  36. data/lib/raykit/text.rb +32 -32
  37. data/lib/raykit/timer.rb +31 -31
  38. data/lib/raykit/version.rb +103 -103
  39. data/lib/raykit/vstest.rb +24 -24
  40. data/lib/raykit/wt.rb +28 -28
  41. data/lib/raykit/zip.rb +73 -73
  42. data/lib/raykit.rb +125 -125
  43. metadata +2 -2
data/lib/raykit/tasks.rb CHANGED
@@ -1,99 +1,99 @@
1
- # frozen_string_literal: true
2
-
3
- desc "Display project information"
4
- task :info do
5
- PROJECT.info
6
- end
7
-
8
- desc "integrate changes into the git repository"
9
- task :integrate do
10
- puts Rainbow(": integrate").blue.bright
11
-
12
- if PROJECT.read_only?
13
- puts " read only state, skipping integrate operations"
14
- else
15
- git_dir = Raykit::Git::Directory.new(Rake.application.original_dir)
16
- if git_dir.detached?
17
- puts " detached head state, skipping integrate operations"
18
- else
19
- if PROJECT.outstanding_commit?
20
- Rake::Task["test"].invoke if Rake::Task.task_defined?("test")
21
- else
22
- puts " no outstanding commits detected"
23
- end
24
-
25
- if !File.exist?(".gitignore")
26
- puts "warning: .gitignore does not exist."
27
- else
28
- PROJECT.run("git add --all")
29
- unless `git status`.include?("nothing to commit")
30
- commit_message = "integrate"
31
- PROJECT.run("git commit -m\"#{commit_message}\"") if PROJECT.outstanding_commit?
32
- end
33
- PROJECT.run("git pull", false)
34
- end
35
- end
36
- end
37
- end
38
-
39
- desc "push changes including tags"
40
- task :push do
41
- puts Rainbow(": push").blue.bright
42
- git_dir = Raykit::Git::Directory.new(Rake.application.original_dir)
43
- if git_dir.detached?
44
- puts "detached head state, skipping push operations"
45
- else
46
- PROJECT.run("git push") if (!PROJECT.read_only?)
47
- PROJECT.run("git push --tags") if (!PROJECT.read_only?)
48
- end
49
- end
50
-
51
- desc "clean files not tracked by git"
52
- task :clean do
53
- puts Rainbow(": clean").blue.bright
54
- PROJECT.run("git clean -dXf", false)
55
- end
56
-
57
- desc "tag the git repository at the current version"
58
- task :tag do
59
- puts Rainbow(": tag").blue.bright
60
- if PROJECT.read_only?
61
- puts " read only state, skipping tag operation"
62
- else
63
- if (GIT_DIRECTORY.has_tag "v#{PROJECT.version}")
64
- puts " tag #{PROJECT.latest_tag} already exists."
65
- else
66
- GIT_DIRECTORY.tag_version PROJECT.version
67
- try "git push --tags"
68
- end
69
- #if (PROJECT.latest_tag != "v#{PROJECT.version}")
70
- # GIT_DIRECTORY.tag_version PROJECT.version
71
- #if (PROJECT.version != PROJECT.latest_tag)
72
- #try "git tag -a #{PROJECT.version} -m\"version #{PROJECT.version}\""
73
- # try "git push --tags"
74
- #else
75
- # puts " tag #{PROJECT.latest_tag} already exists."
76
- #end
77
- end
78
- end
79
-
80
- desc "update_source from sourceImports.json"
81
- task :update_source do
82
- if File.exist?("sourceImports.json")
83
- puts Rainbow(":update_source").blue.bright
84
- sourceImports = Raykit::SourceImports.load("sourceImports.json")
85
- json = sourceImports.to_json
86
- sourceImports.update
87
-
88
- json2 = sourceImports.to_json
89
- if json2 != json || !sourceImports.targets_exist?
90
- sourceImports.save("sourceImports.json")
91
- sourceImports.copy
92
- else
93
- puts " no update required."
94
- end
95
- end
96
- end
97
-
98
- desc "update source files"
99
- task update: [:update_source]
1
+ # frozen_string_literal: true
2
+
3
+ desc "Display project information"
4
+ task :info do
5
+ PROJECT.info
6
+ end
7
+
8
+ desc "integrate changes into the git repository"
9
+ task :integrate do
10
+ puts Rainbow(": integrate").blue.bright
11
+
12
+ if PROJECT.read_only?
13
+ puts " read only state, skipping integrate operations"
14
+ else
15
+ git_dir = Raykit::Git::Directory.new(Rake.application.original_dir)
16
+ if git_dir.detached?
17
+ puts " detached head state, skipping integrate operations"
18
+ else
19
+ if PROJECT.outstanding_commit?
20
+ Rake::Task["test"].invoke if Rake::Task.task_defined?("test")
21
+ else
22
+ puts " no outstanding commits detected"
23
+ end
24
+
25
+ if !File.exist?(".gitignore")
26
+ puts "warning: .gitignore does not exist."
27
+ else
28
+ PROJECT.run("git add --all")
29
+ unless `git status`.include?("nothing to commit")
30
+ commit_message = "integrate"
31
+ PROJECT.run("git commit -m\"#{commit_message}\"") if PROJECT.outstanding_commit?
32
+ end
33
+ PROJECT.run("git pull", false)
34
+ end
35
+ end
36
+ end
37
+ end
38
+
39
+ desc "push changes including tags"
40
+ task :push do
41
+ puts Rainbow(": push").blue.bright
42
+ git_dir = Raykit::Git::Directory.new(Rake.application.original_dir)
43
+ if git_dir.detached?
44
+ puts "detached head state, skipping push operations"
45
+ else
46
+ PROJECT.run("git push") if (!PROJECT.read_only?)
47
+ PROJECT.run("git push --tags") if (!PROJECT.read_only?)
48
+ end
49
+ end
50
+
51
+ desc "clean files not tracked by git"
52
+ task :clean do
53
+ puts Rainbow(": clean").blue.bright
54
+ PROJECT.run("git clean -dXf", false)
55
+ end
56
+
57
+ desc "tag the git repository at the current version"
58
+ task :tag do
59
+ puts Rainbow(": tag").blue.bright
60
+ if PROJECT.read_only?
61
+ puts " read only state, skipping tag operation"
62
+ else
63
+ if (GIT_DIRECTORY.has_tag "v#{PROJECT.version}")
64
+ puts " tag #{PROJECT.latest_tag} already exists."
65
+ else
66
+ GIT_DIRECTORY.tag_version PROJECT.version
67
+ try "git push --tags"
68
+ end
69
+ #if (PROJECT.latest_tag != "v#{PROJECT.version}")
70
+ # GIT_DIRECTORY.tag_version PROJECT.version
71
+ #if (PROJECT.version != PROJECT.latest_tag)
72
+ #try "git tag -a #{PROJECT.version} -m\"version #{PROJECT.version}\""
73
+ # try "git push --tags"
74
+ #else
75
+ # puts " tag #{PROJECT.latest_tag} already exists."
76
+ #end
77
+ end
78
+ end
79
+
80
+ desc "update_source from sourceImports.json"
81
+ task :update_source do
82
+ if File.exist?("sourceImports.json")
83
+ puts Rainbow(":update_source").blue.bright
84
+ sourceImports = Raykit::SourceImports.load("sourceImports.json")
85
+ json = sourceImports.to_json
86
+ sourceImports.update
87
+
88
+ json2 = sourceImports.to_json
89
+ if json2 != json || !sourceImports.targets_exist?
90
+ sourceImports.save("sourceImports.json")
91
+ sourceImports.copy
92
+ else
93
+ puts " no update required."
94
+ end
95
+ end
96
+ end
97
+
98
+ desc "update source files"
99
+ task update: [:update_source]
data/lib/raykit/text.rb CHANGED
@@ -1,32 +1,32 @@
1
- # frozen_string_literal: true
2
-
3
- module Raykit
4
- class Text
5
- def self.replace_in_glob(glob, search, replace)
6
- Dir.glob(glob).each { |f| replace_in_file(f, search, replace) }
7
- end
8
-
9
- def self.replace_in_file(filename, search, replace)
10
- text1 = IO.read(filename)
11
- text2 = text1.gsub(search) { |_str| str = replace }
12
- unless text1 == text2
13
- File.open(filename, "w") { |f| f.puts text2 }
14
- return true
15
- end
16
- false
17
- end
18
-
19
- def self.copy_if_different(source, destination)
20
- if !File.exist?(destination)
21
- FileUtils.cp source, destination
22
- else
23
- source_text = IO.read(source)
24
- destination_text = IO.read(destination)
25
- if source_text != destination_text
26
- FileUtils.rm destination
27
- FileUtils.cp source, destination
28
- end
29
- end
30
- end
31
- end
32
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Raykit
4
+ class Text
5
+ def self.replace_in_glob(glob, search, replace)
6
+ Dir.glob(glob).each { |f| replace_in_file(f, search, replace) }
7
+ end
8
+
9
+ def self.replace_in_file(filename, search, replace)
10
+ text1 = IO.read(filename)
11
+ text2 = text1.gsub(search) { |_str| str = replace }
12
+ unless text1 == text2
13
+ File.open(filename, "w") { |f| f.puts text2 }
14
+ return true
15
+ end
16
+ false
17
+ end
18
+
19
+ def self.copy_if_different(source, destination)
20
+ if !File.exist?(destination)
21
+ FileUtils.cp source, destination
22
+ else
23
+ source_text = IO.read(source)
24
+ destination_text = IO.read(destination)
25
+ if source_text != destination_text
26
+ FileUtils.rm destination
27
+ FileUtils.cp source, destination
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
data/lib/raykit/timer.rb CHANGED
@@ -1,31 +1,31 @@
1
- # frozen_string_literal: true
2
-
3
- require "time"
4
-
5
- module Raykit
6
- # Provides functionality to record the time execution times
7
- class Timer
8
- # The time at which start occurred
9
- attr_accessor :start_time
10
-
11
- def initialize
12
- @start_time = Time.now
13
- end
14
-
15
- # The elapsed time, in seconds, since the timer started
16
- def elapsed
17
- Time.now - @start_time
18
- end
19
-
20
- # The elapsed time, in seconds, as a formatted string
21
- def elapsed_str(pad = 0)
22
- Timer.get_elapsed_str(elapsed, pad)
23
- end
24
-
25
- # Converts a time span in seconds to a formatted string
26
- def self.get_elapsed_str(elapsed, pad = 0)
27
- # "[" + "%.0f" % (elapsed) + "s]".ljust(pad)
28
- format("%.0f", elapsed) + "s".ljust(pad)
29
- end
30
- end
31
- end
1
+ # frozen_string_literal: true
2
+
3
+ require "time"
4
+
5
+ module Raykit
6
+ # Provides functionality to record the time execution times
7
+ class Timer
8
+ # The time at which start occurred
9
+ attr_accessor :start_time
10
+
11
+ def initialize
12
+ @start_time = Time.now
13
+ end
14
+
15
+ # The elapsed time, in seconds, since the timer started
16
+ def elapsed
17
+ Time.now - @start_time
18
+ end
19
+
20
+ # The elapsed time, in seconds, as a formatted string
21
+ def elapsed_str(pad = 0)
22
+ Timer.get_elapsed_str(elapsed, pad)
23
+ end
24
+
25
+ # Converts a time span in seconds to a formatted string
26
+ def self.get_elapsed_str(elapsed, pad = 0)
27
+ # "[" + "%.0f" % (elapsed) + "s]".ljust(pad)
28
+ format("%.0f", elapsed) + "s".ljust(pad)
29
+ end
30
+ end
31
+ end
@@ -1,103 +1,103 @@
1
- # frozen_string_literal: true
2
-
3
- # warn "[DEPRECATION] Raykit::VersionHelper is deprecated. Use bump gem for better transparency."
4
-
5
- module Raykit
6
- # Version functionality
7
- class Version
8
- attr_accessor :start_time
9
-
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?
14
-
15
- version = detect_from_file("#{name}/Properties/AssemblyInfo.cs", /^\[assembly: AssemblyVersion\("([.\w]+)/,
16
- verbose)
17
- return version if version.length.positive?
18
-
19
- version = detect_from_file("#{name}.gemspec", /version\s+=\s+['"]([\w.]+)['"]/, verbose)
20
- return version if version.length.positive?
21
-
22
- version = detect_from_file("#{name}.gemspec", /version\s?=\s?['|"]([.\d]+)['|"]/, verbose)
23
- return version if version.length.positive?
24
-
25
- version = detect_from_file("#{name}.nuspec", /<[Vv]ersion>([\d.]+)</, verbose)
26
- return version if version.length.positive?
27
-
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
35
-
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 "dete in #{filename}"
47
- else
48
- puts "no version detected in #{filename}, regex #{regex.source}"
49
- end
50
- end
51
- version
52
- end
53
-
54
- def self.set_version_in_glob(glob_pattern, version)
55
- Dir.glob(glob_pattern).each { |f|
56
- Raykit::Version::set_version_in_file(f, version)
57
- }
58
- end
59
-
60
- def self.set_version_in_file(filename, version)
61
- text = IO.read(filename)
62
- new_text = text
63
- new_text = text.gsub(/version\s?=\s?['|"]([.\d]+)['|"]/, "version='#{version}'") if filename.include?(".gemspec")
64
- new_text = text.gsub(/<Version>([-\w\d.]+)</, "<Version>#{version}<") if filename.include?(".csproj")
65
- new_text = text.gsub(/<version>([-\w\d.]+)</, "<version>#{version}<") if filename.include?(".nuspec")
66
- new_text = text.gsub(/Version="([\d\.]+)"/, "Version=\"#{version}\"") if filename.include?(".wxs")
67
- # new_text=text.gsub(/<Version>([-\w\d.]+)</,"<Version>#{version}<")
68
- # new_text=new_text.gsub(/version[\s]+=\s?['|"]([.\d]+)['|"]/,"version='#{version}'")
69
- # new_text=new_text.gsub(/Version="([.\d]+)"/,"Version=\"#{version}\"")
70
- File.open(filename, "w") { |f| f.write(new_text) } if new_text != text
71
- end
72
-
73
- def self.sync_file_versions(source_filename, destination_filename)
74
- version = Version.detect_from_file(source_filename, /<Version>([-\w\d.]+)</, false)
75
- Version.set_version_in_file(destination_filename, version)
76
- end
77
-
78
- # increment to last digit of a version string
79
- def self.bump(version)
80
- # major.minor[.build[.revision]] (example: 1.2.12.102)
81
- version_ints = version.split(".").map(&:to_i)
82
- version_ints[-1] = version_ints.last + 1
83
- version_ints.map(&:to_s).join(".")
84
- end
85
-
86
- def self.bump_file(filename)
87
- warn "Raykit::Version.bump_file filename '#{filename}' does not exist." unless File.exist?(filename)
88
-
89
- old_version = ""
90
- if filename.include?(".gemspec")
91
- old_version = detect_from_file(filename, /version\s?=\s?['|"]([.\d]+)['|"]/, false)
92
- end
93
- old_version = detect_from_file(filename, /<Version>([-\w\d.]+)</, false) if filename.include?(".csproj")
94
-
95
- if old_version.length.positive?
96
- new_version = bump(old_version)
97
- set_version_in_file(filename, new_version)
98
- end
99
-
100
- new_version
101
- end
102
- end
103
- end
1
+ # frozen_string_literal: true
2
+
3
+ # warn "[DEPRECATION] Raykit::VersionHelper is deprecated. Use bump gem for better transparency."
4
+
5
+ module Raykit
6
+ # Version functionality
7
+ class Version
8
+ attr_accessor :start_time
9
+
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?
14
+
15
+ version = detect_from_file("#{name}/Properties/AssemblyInfo.cs", /^\[assembly: AssemblyVersion\("([.\w]+)/,
16
+ verbose)
17
+ return version if version.length.positive?
18
+
19
+ version = detect_from_file("#{name}.gemspec", /version\s+=\s+['"]([\w.]+)['"]/, verbose)
20
+ return version if version.length.positive?
21
+
22
+ version = detect_from_file("#{name}.gemspec", /version\s?=\s?['|"]([.\d]+)['|"]/, verbose)
23
+ return version if version.length.positive?
24
+
25
+ version = detect_from_file("#{name}.nuspec", /<[Vv]ersion>([\d.]+)</, verbose)
26
+ return version if version.length.positive?
27
+
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
35
+
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 "dete in #{filename}"
47
+ else
48
+ puts "no version detected in #{filename}, regex #{regex.source}"
49
+ end
50
+ end
51
+ version
52
+ end
53
+
54
+ def self.set_version_in_glob(glob_pattern, version)
55
+ Dir.glob(glob_pattern).each { |f|
56
+ Raykit::Version::set_version_in_file(f, version)
57
+ }
58
+ end
59
+
60
+ def self.set_version_in_file(filename, version)
61
+ text = IO.read(filename)
62
+ new_text = text
63
+ new_text = text.gsub(/version\s?=\s?['|"]([.\d]+)['|"]/, "version='#{version}'") if filename.include?(".gemspec")
64
+ new_text = text.gsub(/<Version>([-\w\d.]+)</, "<Version>#{version}<") if filename.include?(".csproj")
65
+ new_text = text.gsub(/<version>([-\w\d.]+)</, "<version>#{version}<") if filename.include?(".nuspec")
66
+ new_text = text.gsub(/Version="([\d\.]+)"/, "Version=\"#{version}\"") if filename.include?(".wxs")
67
+ # new_text=text.gsub(/<Version>([-\w\d.]+)</,"<Version>#{version}<")
68
+ # new_text=new_text.gsub(/version[\s]+=\s?['|"]([.\d]+)['|"]/,"version='#{version}'")
69
+ # new_text=new_text.gsub(/Version="([.\d]+)"/,"Version=\"#{version}\"")
70
+ File.open(filename, "w") { |f| f.write(new_text) } if new_text != text
71
+ end
72
+
73
+ def self.sync_file_versions(source_filename, destination_filename)
74
+ version = Version.detect_from_file(source_filename, /<Version>([-\w\d.]+)</, false)
75
+ Version.set_version_in_file(destination_filename, version)
76
+ end
77
+
78
+ # increment to last digit of a version string
79
+ def self.bump(version)
80
+ # major.minor[.build[.revision]] (example: 1.2.12.102)
81
+ version_ints = version.split(".").map(&:to_i)
82
+ version_ints[-1] = version_ints.last + 1
83
+ version_ints.map(&:to_s).join(".")
84
+ end
85
+
86
+ def self.bump_file(filename)
87
+ warn "Raykit::Version.bump_file filename '#{filename}' does not exist." unless File.exist?(filename)
88
+
89
+ old_version = ""
90
+ if filename.include?(".gemspec")
91
+ old_version = detect_from_file(filename, /version\s?=\s?['|"]([.\d]+)['|"]/, false)
92
+ end
93
+ old_version = detect_from_file(filename, /<Version>([-\w\d.]+)</, false) if filename.include?(".csproj")
94
+
95
+ if old_version.length.positive?
96
+ new_version = bump(old_version)
97
+ set_version_in_file(filename, new_version)
98
+ end
99
+
100
+ new_version
101
+ end
102
+ end
103
+ end
data/lib/raykit/vstest.rb CHANGED
@@ -1,24 +1,24 @@
1
- # frozen_string_literal: true
2
-
3
- module Raykit
4
- class VsTest
5
- def self.vstest_path
6
- ["2022/Community/Common7/IDE/CommonExtensions/Microsoft/TestWindow",
7
- "2022/Professional/Common7/IDE/CommonExtensions/Microsoft/TestWindow",
8
- "2022/Enterprise/Common7/IDE/CommonExtensions/Microsoft/TestWindow",
9
- "2019/Community/Common7/IDE/CommonExtensions/Microsoft",
10
- "2019/Professional/Common7/IDE/Extensions/TestPlatform",
11
- "2019/Community/Common7/IDE/Extensions",
12
- "2019/Community/Common7/IDE/Extensions/TestPlatform",
13
- "2022/Preview/Common7/IDE/Extensions/TestPlatform"].each do |relative_path|
14
- ["C:/Program Files (x86)/Microsoft Visual Studio/",
15
- "C:/Program Files/Microsoft Visual Studio/"].each do |root_path|
16
- path = root_path + relative_path
17
- exe_path = "#{path}/vstest.console.exe"
18
- return path if Dir.exist?(path) && File.exist?(exe_path)
19
- end
20
- end
21
- "vstest_path not found"
22
- end
23
- end
24
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Raykit
4
+ class VsTest
5
+ def self.vstest_path
6
+ ["2022/Community/Common7/IDE/CommonExtensions/Microsoft/TestWindow",
7
+ "2022/Professional/Common7/IDE/CommonExtensions/Microsoft/TestWindow",
8
+ "2022/Enterprise/Common7/IDE/CommonExtensions/Microsoft/TestWindow",
9
+ "2019/Community/Common7/IDE/CommonExtensions/Microsoft",
10
+ "2019/Professional/Common7/IDE/Extensions/TestPlatform",
11
+ "2019/Community/Common7/IDE/Extensions",
12
+ "2019/Community/Common7/IDE/Extensions/TestPlatform",
13
+ "2022/Preview/Common7/IDE/Extensions/TestPlatform"].each do |relative_path|
14
+ ["C:/Program Files (x86)/Microsoft Visual Studio/",
15
+ "C:/Program Files/Microsoft Visual Studio/"].each do |root_path|
16
+ path = root_path + relative_path
17
+ exe_path = "#{path}/vstest.console.exe"
18
+ return path if Dir.exist?(path) && File.exist?(exe_path)
19
+ end
20
+ end
21
+ "vstest_path not found"
22
+ end
23
+ end
24
+ end
data/lib/raykit/wt.rb CHANGED
@@ -1,28 +1,28 @@
1
- module Raykit
2
- class Wt
3
- def self.open(names)
4
- if names.is_a? String
5
- cmd = Raykit::Command.new("wt --maximized #{get_tab_arg(names)}").run
6
- end
7
- if names.is_a?(Array)
8
- cmd = "wt --maximized "
9
- index = 0
10
- names.each { |url|
11
- if index <= 0
12
- cmd += get_tab_arg(url)
13
- else
14
- cmd += ";new-tab " + get_tab_arg(url)
15
- end
16
- index = index + 1
17
- }
18
- Raykit::Command.new(cmd).run
19
- end
20
- end
21
-
22
- def self.get_tab_arg(url)
23
- dir = Raykit::Git::Repository.new(url).get_dev_dir("work")
24
- name = File.basename(dir)
25
- "-d #{dir} --title #{name}"
26
- end
27
- end
28
- end
1
+ module Raykit
2
+ class Wt
3
+ def self.open(names)
4
+ if names.is_a? String
5
+ cmd = Raykit::Command.new("wt --maximized #{get_tab_arg(names)}").run
6
+ end
7
+ if names.is_a?(Array)
8
+ cmd = "wt --maximized "
9
+ index = 0
10
+ names.each { |url|
11
+ if index <= 0
12
+ cmd += get_tab_arg(url)
13
+ else
14
+ cmd += ";new-tab " + get_tab_arg(url)
15
+ end
16
+ index = index + 1
17
+ }
18
+ Raykit::Command.new(cmd).run
19
+ end
20
+ end
21
+
22
+ def self.get_tab_arg(url)
23
+ dir = Raykit::Git::Repository.new(url).get_dev_dir("work")
24
+ name = File.basename(dir)
25
+ "-d #{dir} --title #{name}"
26
+ end
27
+ end
28
+ end