toolrack 0.5.0 → 0.5.3

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: 9b1c1f58f027b8a0b847c9c196c2f2e74ba75f2df78595cb1024f06560bf8ee6
4
- data.tar.gz: bdbb04df325bf9f979de7497051267e6925ffc74c8a91c2e49008f03c1021401
3
+ metadata.gz: 2b8060cf4deb99cad679a22d0e9d4fd85969e0f332361a3d1bd89c52fda8166f
4
+ data.tar.gz: 5af17bbfb37aa09f5df3c9c8f02f916357b281a262316a6d3a67a0c0ccc9c613
5
5
  SHA512:
6
- metadata.gz: 97627d8aba3e40cc3cba8f3fe3e0639f349001f548627267fca52d4ee820b8af027ebb33ae1dfff1b46f719b26d36d5aaaf4d2d7e392a918f59dc2bd4ec9e921
7
- data.tar.gz: 932804f41294d61ceaa32eec0bdb20a8e6eb32d9abb746861cf5591ab09b29aba2980ad3b4d0508d8d2881240d91e2a64d28d83a9552cca669f3fd54521a4c90
6
+ metadata.gz: 7fb7969942992c8163decf1d8a98200b7b719f3c6e5c1eda86ad833047b15e185fe9793ecd2876dca56921f9c80760efa08e75ba99e73e8a4af478d9365834f7
7
+ data.tar.gz: e081ff9358e5e9dabe48f6b41106cb0308f538c20b08753275b90ed54088b0463fe641cf5613ce23858374e6b36c2430329f2477260dc2f69493f1592dd9ed06
@@ -5,6 +5,7 @@ require 'singleton'
5
5
 
6
6
  require 'fileutils'
7
7
 
8
+ require_relative 'toolrack/global'
8
9
  require_relative 'toolrack/exception_utils'
9
10
  require_relative 'toolrack/condition_utils'
10
11
  require_relative 'toolrack/process_utils'
@@ -15,30 +16,7 @@ module Antrapol
15
16
  class Error < StandardError; end
16
17
  # Your code goes here...
17
18
 
18
- class Logger
19
- include Singleton
20
- include Antrapol::ToolRack::ConditionUtils
21
-
22
- attr_reader :glogger
23
- def initialize
24
- # boolean
25
- loggerDebug = ENV['TOOLRACK_DEBUG']
26
- logFile = ENV['TOOLRACK_LOGFILE'] || File.join(Dir.home, 'antrapol_logs','toolrack.log')
27
- maxLogNo = ENV['TOOLRACK_MAX_LOGFILE'] || 10
28
- logFileSize = ENV['TOOLRACK_MAX_LOGFILE_SIZE'] || 10*1024*1024
29
-
30
- logFileDir = File.dirname(logFile)
31
- if not File.exist?(logFileDir)
32
- FileUtils.mkdir_p(logFileDir)
33
- end
34
-
35
- if not_empty?(loggerDebug) and (loggerDebug.downcase == 'true')
36
- @glogger = Tlogger.new(STDOUT)
37
- else
38
- @glogger = Tlogger.new(logFile,maxLogNo,logFileSize)
39
- end
40
- end
41
- end
42
-
43
19
  end
44
20
  end
21
+
22
+
@@ -10,7 +10,11 @@ module Antrapol
10
10
  elsif obj.nil?
11
11
  true
12
12
  elsif obj.respond_to?(:empty?)
13
- obj.empty?
13
+ if obj.respond_to?(:strip)
14
+ obj.strip.empty?
15
+ else
16
+ obj.empty?
17
+ end
14
18
  else
15
19
  false
16
20
  end
@@ -0,0 +1,35 @@
1
+
2
+ require 'singleton'
3
+ require_relative 'condition_utils'
4
+
5
+ module Antrapol
6
+ module ToolRack
7
+
8
+ class Logger
9
+ include Singleton
10
+ include Antrapol::ToolRack::ConditionUtils
11
+
12
+ attr_reader :glogger
13
+ def initialize
14
+ # boolean
15
+ loggerDebug = ENV['TOOLRACK_DEBUG']
16
+ logFile = ENV['TOOLRACK_LOGFILE'] || File.join(Dir.home, 'antrapol_logs','toolrack.log')
17
+ maxLogNo = ENV['TOOLRACK_MAX_LOGFILE'] || 10
18
+ logFileSize = ENV['TOOLRACK_MAX_LOGFILE_SIZE'] || 10*1024*1024
19
+
20
+ logFileDir = File.dirname(logFile)
21
+ if not File.exist?(logFileDir)
22
+ FileUtils.mkdir_p(logFileDir)
23
+ end
24
+
25
+ if not_empty?(loggerDebug) and (loggerDebug.downcase == 'true')
26
+ @glogger = Tlogger.new(STDOUT)
27
+ else
28
+ @glogger = Tlogger.new(logFile,maxLogNo,logFileSize)
29
+ end
30
+ end
31
+ end
32
+
33
+ end
34
+ end
35
+
@@ -1,11 +1,21 @@
1
1
 
2
- require 'pty'
2
+ require_relative 'global'
3
+ require_relative 'runtime_utils'
4
+
5
+ if Antrapol::ToolRack::RuntimeUtils.on_windows?
6
+ # pty causing "function 'openpty' not found in msvcrt.dll" in some
7
+ # windows platform. Due to patches?
8
+ Antrapol::ToolRack::Logger.instance.glogger.debug "On Windows. Not going to load gem 'pty'"
9
+ else
10
+ require 'pty'
11
+ end
3
12
  require 'expect'
4
13
  require 'io/console'
5
14
  require 'tlogger'
6
15
  require 'open3'
7
16
 
8
17
 
18
+
9
19
  module Antrapol
10
20
  module ToolRack
11
21
  module ProcessUtils
@@ -79,6 +89,11 @@ module Antrapol
79
89
 
80
90
  Antrapol::ToolRack::Logger.instance.glogger.debug "PTY exec command : #{cmd}"
81
91
 
92
+ # pty seems error running on windows + jruby
93
+ if Antrapol::ToolRack::RuntimeUtils.on_windows?
94
+ raise Exception, "You're running on Windows. There have been report that error \"function 'openpty' not found in msvcrt.dll\". Probably due to patches. For now pty_exec() shall be halted"
95
+ end
96
+
82
97
  logger = opts[:logger] || Tlogger.new(STDOUT)
83
98
  expect = opts[:expect] || { }
84
99
  bufSize = opts[:intBufSize] || 1024000
@@ -1,6 +1,6 @@
1
1
  module Antrapol
2
2
  module ToolRack
3
- VERSION = "0.5.0"
3
+ VERSION = "0.5.3"
4
4
  end
5
5
  end
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toolrack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-02 00:00:00.000000000 Z
11
+ date: 2021-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tlogger
@@ -56,6 +56,7 @@ files:
56
56
  - lib/toolrack.rb
57
57
  - lib/toolrack/condition_utils.rb
58
58
  - lib/toolrack/exception_utils.rb
59
+ - lib/toolrack/global.rb
59
60
  - lib/toolrack/process_utils.rb
60
61
  - lib/toolrack/runtime_utils.rb
61
62
  - lib/toolrack/utils.rb
@@ -70,7 +71,7 @@ licenses: []
70
71
  metadata:
71
72
  homepage_uri: https://github.com/chrisliaw/toolrack
72
73
  source_code_uri: https://github.com/chrisliaw/toolrack
73
- post_install_message:
74
+ post_install_message:
74
75
  rdoc_options: []
75
76
  require_paths:
76
77
  - lib
@@ -85,8 +86,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
86
  - !ruby/object:Gem::Version
86
87
  version: '0'
87
88
  requirements: []
88
- rubygems_version: 3.1.2
89
- signing_key:
89
+ rubygems_version: 3.1.4
90
+ signing_key:
90
91
  specification_version: 4
91
92
  summary: Collection of simple utilities but I find it increase clarity
92
93
  test_files: []