raykit 0.0.284 → 0.0.288
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/command.rb +24 -0
- data/lib/raykit/environment.rb +5 -2
- data/lib/raykit/logevent.rb +33 -0
- data/lib/raykit/secrets.rb +22 -0
- data/lib/raykit/tasks.rb +18 -4
- data/lib/raykit/vstest.rb +6 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca39389db5e0297bed811fe9d54bf3425dbf75efaa90035a4b2d8b96960b4c58
|
4
|
+
data.tar.gz: a7baabecf86d29b0cced7f7e6a06a0460640d9a58445788e637750eb755b7c38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3662fe9339f3398f23e5889d8ec8921cba8ebd3c437cc87805b0130c99cc78ee0dd61fff45e16d6bf2f47f88602b00d3c48f8eb1f597eb332438c9fb356d98c0
|
7
|
+
data.tar.gz: 5856978c20d77863834991ed75e7a4648d85c77b90000856d867707ef353c55baa4d60cbbe604b87ac6429ba25b0ae404bdafb2766883c563ca86a1b538ccf71
|
data/lib/raykit/command.rb
CHANGED
@@ -82,7 +82,31 @@ module Raykit
|
|
82
82
|
log
|
83
83
|
end
|
84
84
|
|
85
|
+
#@timeout=0
|
86
|
+
#@directory = Dir.pwd
|
87
|
+
#@output = ''
|
88
|
+
#@error = ''
|
89
|
+
#@exitstatus = 0
|
90
|
+
|
85
91
|
def log
|
92
|
+
# --- Rolling File JSON -----
|
93
|
+
log = Logger.new("#{Raykit::Environment::log_dir}/Raykit.Commands.txt",'daily')
|
94
|
+
log.formatter = proc do |severity,datetime,progname,msg|
|
95
|
+
"#{msg}\n"
|
96
|
+
end
|
97
|
+
secrets=Secrets.new()
|
98
|
+
msg =secrets.hide(@command)#"?"# self.summary(false)
|
99
|
+
level="Verbose"
|
100
|
+
level="Warning" if @exitstatus != 0
|
101
|
+
event = Raykit::LogEvent.new(level,msg,{
|
102
|
+
"Timeout"=>@timeout,
|
103
|
+
"Directory"=>@directory,
|
104
|
+
"Output"=>@output,
|
105
|
+
"Error"=>@error,
|
106
|
+
"ExitStatus"=>@exitstatus,
|
107
|
+
"Elapsed"=>elapsed_str})
|
108
|
+
log.info event.to_json
|
109
|
+
# ---------------------------
|
86
110
|
begin
|
87
111
|
json=JSON.generate(to_hash)
|
88
112
|
log_filename = Environment.get_dev_dir('log') + '/Raykit.Command/' + SecureRandom.uuid + '.json'
|
data/lib/raykit/environment.rb
CHANGED
@@ -25,15 +25,18 @@ module Raykit
|
|
25
25
|
normalize_path(ENV['HOME'])
|
26
26
|
end
|
27
27
|
|
28
|
+
def self.log_dir
|
29
|
+
return get_dev_dir('log')
|
30
|
+
end
|
28
31
|
# Get, and create if it does not exist, a specific development directory
|
29
32
|
def self.get_dev_dir(name)
|
30
33
|
dir = Pathname.new("#{Environment::root_dir}/#{name}")
|
31
34
|
dir.mkpath
|
32
|
-
dir.to_s
|
35
|
+
dir.to_s().gsub('//','/')
|
33
36
|
end
|
34
37
|
|
35
38
|
def self.get_work_dir(url)
|
36
|
-
Raykit::Environment::get_dev_dir('work') + url.gsub('://','/').gsub('.git','')
|
39
|
+
Raykit::Environment::get_dev_dir('work') +'/' + url.gsub('://','/').gsub('.git','')
|
37
40
|
end
|
38
41
|
# Get the size of a directory and its contents
|
39
42
|
def self.get_dir_size(dir)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'json'
|
2
|
+
module Raykit
|
3
|
+
# :verbose, :debug, :information, :error, :fatal
|
4
|
+
class LogEvent < Hash
|
5
|
+
def initialize(level,messageTemplate,properties)
|
6
|
+
self["Timestamp"] = DateTime.now.iso8601
|
7
|
+
self["Level"] = level
|
8
|
+
self["Message"] = messageTemplate
|
9
|
+
self["MessageTemplate"] = messageTemplate
|
10
|
+
properties["SourceContext"] = "Raykit" if !properties.has_key?('SourceContext')
|
11
|
+
properties["MachineName"] = Raykit::Environment::machine if !properties.has_key?('MachineName')
|
12
|
+
properties["UserName"] = Raykit::Environment::user if !properties.has_key?('UserName')
|
13
|
+
self["Properties"] = properties
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
#{
|
20
|
+
# "Timestamp": "2021-10-06T06:09:25.5275817-06:00",
|
21
|
+
# "Level": "Information",
|
22
|
+
# "MessageTemplate": "MachineName {machine}",
|
23
|
+
# "Properties": {
|
24
|
+
# "machine": "BLUEFIN",
|
25
|
+
# "SourceContext": "cslogging.Program",
|
26
|
+
# "ThreadId": 1,
|
27
|
+
# "ProcessId": 16764,
|
28
|
+
# "ProcessName": "cs-logging",
|
29
|
+
# "MachineName": "\"BLUEFIN\"",
|
30
|
+
# "UserName": "\"loupa\"",
|
31
|
+
# "OS": "Windows_NT"
|
32
|
+
# }
|
33
|
+
#}
|
data/lib/raykit/secrets.rb
CHANGED
@@ -3,6 +3,21 @@ require 'time'
|
|
3
3
|
module Raykit
|
4
4
|
# Provides functionality to record the time execution times
|
5
5
|
class Secrets < Hash
|
6
|
+
def initialize()
|
7
|
+
if ENV.has_key?('RAYKIT_SECRETS_PATH')
|
8
|
+
secrets_file = ENV['RAYKIT_SECRETS_PATH']
|
9
|
+
if File.exists?(secrets_file)
|
10
|
+
text = IO.read(secrets_file)
|
11
|
+
if (text.length > 7 )
|
12
|
+
data = JSON.parse(text)
|
13
|
+
data.each{|key,value|
|
14
|
+
self[key] = value
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
6
21
|
def hide(text)
|
7
22
|
hidden=text
|
8
23
|
self.each{|k,v|
|
@@ -12,5 +27,12 @@ module Raykit
|
|
12
27
|
}
|
13
28
|
hidden
|
14
29
|
end
|
30
|
+
|
31
|
+
def save()
|
32
|
+
if ENV.has_key?('RAYKIT_SECRETS_PATH')
|
33
|
+
secrets_file = ENV['RAYKIT_SECRETS_PATH']
|
34
|
+
File.open(secrets_file,"w") { |f| f.puts self.to_json }
|
35
|
+
end
|
36
|
+
end
|
15
37
|
end
|
16
38
|
end
|
data/lib/raykit/tasks.rb
CHANGED
@@ -9,7 +9,9 @@ task :integrate do
|
|
9
9
|
puts Rainbow(':integrate').blue.bright
|
10
10
|
|
11
11
|
git_dir=Raykit::Git::Directory.new(Rake.application.original_dir)
|
12
|
-
if(
|
12
|
+
if(git_dir.detached?)
|
13
|
+
puts "detached head state, skipping integrate operations"
|
14
|
+
else
|
13
15
|
if(PROJECT.outstanding_commit?)
|
14
16
|
if(Rake::Task.task_defined?("test"))
|
15
17
|
Rake::Task["test"].invoke
|
@@ -23,17 +25,29 @@ task :integrate do
|
|
23
25
|
puts "warning: .gitignore does not exist."
|
24
26
|
else
|
25
27
|
PROJECT.run('git add --all')
|
26
|
-
if(
|
28
|
+
if(!`git status`.include?('nothing to commit'))
|
29
|
+
#if(PROJECT.outstanding_commit?)
|
27
30
|
commit_message='integrate'
|
28
31
|
PROJECT.run("git commit -m\"#{commit_message}\"") if(PROJECT.outstanding_commit?)
|
29
32
|
PROJECT.run("git pull")
|
30
|
-
PROJECT.run("git push")
|
31
|
-
PROJECT.run("git push --tags")
|
33
|
+
#PROJECT.run("git push")
|
34
|
+
#PROJECT.run("git push --tags")
|
32
35
|
end
|
33
36
|
end
|
34
37
|
end
|
35
38
|
end
|
36
39
|
|
40
|
+
desc "push changes including tags"
|
41
|
+
task :push do
|
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")
|
47
|
+
PROJECT.run("git push --tags")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
37
51
|
desc "clean files not tracked by git"
|
38
52
|
task :clean do
|
39
53
|
puts Rainbow(':clean').blue.bright
|
data/lib/raykit/vstest.rb
CHANGED
@@ -2,14 +2,18 @@ module Raykit
|
|
2
2
|
class VsTest
|
3
3
|
def self.vstest_path
|
4
4
|
['2019/Community/Common7/IDE/CommonExtensions/Microsoft',
|
5
|
+
'2019/Professional/Common7/IDE/CommonExtensions/Microsoft/TestPlatform',
|
5
6
|
'2019/Community/Common7/IDE/Extensions',
|
7
|
+
'2019\Community\Common7\IDE\Extensions\TestPlatform',
|
6
8
|
'2022/Preview/Common7/IDE/Extensions/TestPlatform'].each{|relative_path|
|
7
9
|
['C:/Program Files (x86)/Microsoft Visual Studio/',
|
8
10
|
'C:/Program Files/Microsoft Visual Studio/'].each{|root_path|
|
9
|
-
|
10
|
-
|
11
|
+
path = root_path + relative_path
|
12
|
+
exe_path = path + '/vstest.console.exe'
|
13
|
+
return path if(Dir.exists?(path)) && File.exist?(exe_path)
|
11
14
|
}
|
12
15
|
}
|
16
|
+
return "vstest_path not found"
|
13
17
|
end
|
14
18
|
end
|
15
19
|
end
|
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.
|
4
|
+
version: 0.0.288
|
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-
|
11
|
+
date: 2021-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- lib/raykit/git/repositories.rb
|
89
89
|
- lib/raykit/git/repository.rb
|
90
90
|
- lib/raykit/log.rb
|
91
|
+
- lib/raykit/logevent.rb
|
91
92
|
- lib/raykit/logging.rb
|
92
93
|
- lib/raykit/msbuild.rb
|
93
94
|
- lib/raykit/nugetpackage.rb
|
@@ -123,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
124
|
- !ruby/object:Gem::Version
|
124
125
|
version: '0'
|
125
126
|
requirements: []
|
126
|
-
rubygems_version: 3.2.
|
127
|
+
rubygems_version: 3.2.22
|
127
128
|
signing_key:
|
128
129
|
specification_version: 4
|
129
130
|
summary: ruby gem to support rake ci/cd tasks
|