raykit 0.0.292 → 0.0.296

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8cf809b8d58ba93ff0722006674d2a60cc95f4891e32f516eb666f8e8d4e1f8c
4
- data.tar.gz: c0f6c85bad11623688e5329000f3bffb2cce09447edc2a2668b1b1a2f0461f57
3
+ metadata.gz: 7fd42edf229b6649271f97fd4433975e6bd843f877f37bdd02ea496b1cd2c05e
4
+ data.tar.gz: 72c395999f191fc67eda334b79630641f026274e734b1947802e3a964a495e88
5
5
  SHA512:
6
- metadata.gz: b0c6a0f4b7909c4bae0281db12f17b4ae315541687cc269b17e4cd12701629f7c9c50e6ef4b59983c971e304cfb1e97f0aa3aefba09e26811293313ae6ad4da4
7
- data.tar.gz: 3d3141e44ac13643d564887daf2feff0f46f1faac90af01b13cc28ceb9847009df593e1068fe39a3d047c47ab5d45ed83a615c661e90a92e848d7694aff4e9f7
6
+ metadata.gz: c57390ca7fb1f6ec46e76ab075f8b889e7fec39eff9c44a414a6f682f589023028378d7d9d67647858f1755822541dbcdfadd08949e1b18cf1da84861f079de6
7
+ data.tar.gz: ab071d35efdf8b913f5318bfeedbdad3cb8e4b19f67c8abb4c57a0e20527b0749f63280c8849ef33cc603d5184be745896fb4d8964cb8c812e4f827fb355f672
@@ -20,6 +20,8 @@ module Raykit
20
20
  attr_accessor :elapsed
21
21
  attr_accessor :command,:output,:error,:exitstatus
22
22
  attr_accessor :user,:machine
23
+ attr_accessor :logging_enabled
24
+ attr_accessor :success_log_level
23
25
 
24
26
  def init_defaults
25
27
  @timeout=0
@@ -29,11 +31,13 @@ module Raykit
29
31
  @exitstatus = 0
30
32
  @user = Environment.user
31
33
  @machine=Environment.machine
34
+ @logging_enabled = true
32
35
  end
33
36
 
34
- def initialize(command,timeout=0)
37
+ def initialize(command,timeout=0,success_log_level=nil,logging_enabled=true)
35
38
  @@commands=Array.new
36
39
  init_defaults
40
+ @logging_enabled=logging_enabled
37
41
  @command=command
38
42
  @timeout=timeout
39
43
  if(@command.length > 0)
@@ -73,14 +77,27 @@ module Raykit
73
77
  Process.kill("TERM", pid)
74
78
  end
75
79
  @exitstatus=5
80
+ @error="timed out"
76
81
  else
77
82
  @exitstatus=thread.value.exitstatus
78
83
  end
79
84
  }
80
85
  end
81
86
  @elapsed = timer.elapsed
82
- log
83
- to_log_event.to_seq if @exisstatus != 0
87
+ if @logging_enabled
88
+ log
89
+ if @exitstatus != 0
90
+ to_log_event.to_seq
91
+ else
92
+ if !@success_log_level.nil?
93
+ e = to_log_event
94
+ e.level = "Verbose" if @success_log_level = Logging::Verbose
95
+ e.level = "Debug" if @success_log_level = Logging::Debug
96
+ e.level = "Information" if @success_log_level = Logging::Information
97
+ e.to_seq
98
+ end
99
+ end
100
+ end
84
101
  end
85
102
 
86
103
  def to_log_event
@@ -90,6 +107,7 @@ module Raykit
90
107
  level="Warning" if @exitstatus != 0
91
108
  Raykit::LogEvent.new(level,msg,{
92
109
  "SourceContext"=>"Raykit::Command",
110
+ "Category"=>"Command",
93
111
  "Timeout"=>@timeout,
94
112
  "Directory"=>@directory,
95
113
  "Output"=>@output,
@@ -89,7 +89,7 @@ module Raykit
89
89
  end
90
90
 
91
91
  def get_tag_commit_id(name)
92
- cmd = Raykit::Command.new("git rev-parse \"#{name}\"")
92
+ cmd = Raykit::Command.new("git rev-parse \"#{name}\"",0,nil,false)
93
93
  if !cmd.output.include?('fatal') && !cmd.error.include?('fatal')
94
94
  cmd.output.strip()
95
95
  else
@@ -9,27 +9,17 @@ module Raykit
9
9
  self["MessageTemplate"] = messageTemplate
10
10
  properties["MachineName"] = Raykit::Environment::machine if !properties.has_key?('MachineName')
11
11
  properties["UserName"] = Raykit::Environment::user if !properties.has_key?('UserName')
12
+ properties["RakeDirectory"] = ::Rake.application.original_dir
12
13
  self["Properties"] = properties
13
14
  end
14
15
 
15
16
  def to_seq
16
- #ENV.each{|ek,ev|
17
- # puts "#{ek} #{ev}"
18
- #}
19
- if !ENV['SEQ_SERVER'].nil?# != nil# && ENV['SEQ_SERVER'].is_set?
17
+ if !ENV['SEQ_SERVER'].nil?
20
18
  cmd_str="seqcli log -m \"#{self['Message']}\" -l #{self['Level']} -s #{ENV['SEQ_SERVER']}"
21
19
  self["Properties"].each{|k,v|
22
20
  cmd_str=cmd_str + " -p \"#{k}=#{v}\""
23
21
  }
24
22
  puts `#{cmd_str}`
25
- # puts cmd_str
26
- #puts `#{cmd_str}`
27
- #cmd=Raykit::Command.new(cmd_str)
28
- #cmd.run
29
- #puts cmd.summary
30
- #puts cmd.details
31
- #else
32
- #puts 'SEQ_SERVER env var not found'
33
23
  end
34
24
  end
35
25
  end
@@ -282,12 +282,11 @@ module Raykit
282
282
  self
283
283
  end
284
284
 
285
- def run(command,quit_on_failure=true)
286
- #log.update_command_time(command,DateTime.now)
285
+ def run(command,quit_on_failure=true,success_log_level=nil)
287
286
  if(command.kind_of?(Array))
288
287
  command.each{|subcommand| run(subcommand,quit_on_failure)}
289
288
  else
290
- cmd = Command.new(command)
289
+ cmd = Command.new(command,0,success_log_level)
291
290
  cmd.summary
292
291
  cmd.save
293
292
  elapsed_str = Timer.get_elapsed_str(cmd.elapsed,0)
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.292
4
+ version: 0.0.296
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-09 00:00:00.000000000 Z
11
+ date: 2021-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler