toolrack 0.23.2 → 0.23.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: 7829bd272823dbd7bdf754bca5be1287b074486f99a33ee15bd2607cb391a2f5
4
- data.tar.gz: ea82bc8cca37d760813fb276e7540df2d80b11624c8e9760d6936cd4c86bf347
3
+ metadata.gz: 4ba701f80c017de64b440dfbd5388aef7ecf9e08200cf7fe4413a1e495ba5d27
4
+ data.tar.gz: 3d043a9e921cbec66a9c3fb760a10187cea1dcc0b25c990b66825b91eb051b43
5
5
  SHA512:
6
- metadata.gz: 2dc8a2048cb53ea6d6ed2bacaf3cbd7e2a1c8ea8a725c9657b5dd69fdcb49d9f4b6e3aeea12a36772ba54449d3b4cd47bf5be376d77e1b1fb6091ad5f68261d2
7
- data.tar.gz: 1ceb5fd6b3bdd488b1961bff52c7cce4d4e68f31f842f7029f4eeb73452d52c19a20b772d7ed1a8a11fbb6ffc83dd0474943131d304991e905ac87d97e95a2e1
6
+ metadata.gz: 56664034a546c17cfc0f58e6c4c220da5de164c4513d240ed2152c5cd1b3291f05ab1d662a6c1c1f8f53fa5a7a1e82fac105722cecc96f3bc773f58be04ec779
7
+ data.tar.gz: 439aaa664c77d76a334d6730bba5fa44a23aae15b0ca00fa8b3d41da93b06b5affc64fed2cd7acb53207ddb3cbe306cee2f5db92dc6ac9fd25d212ebdb0cd069
data/Gemfile.lock CHANGED
@@ -1,38 +1,25 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- toolrack (0.23.2)
4
+ toolrack (0.23.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
9
  colorize (1.1.0)
10
- devops_assist (0.3.11)
11
- git_cli
12
- git_cli_prompt (~> 0.3.3)
13
- gvcs
14
- teLogger
15
- toolrack
16
- tty-prompt
17
10
  diff-lcs (1.5.0)
18
- git_cli (0.12.0)
11
+ git_cli (0.13.6)
19
12
  ptools (~> 1.4.0)
20
- teLogger
21
- toolrack
22
- git_cli_prompt (0.3.4)
23
- teLogger
24
- toolrack
25
- tty-prompt
26
- gvcs (0.1.2)
27
- minitest (5.19.0)
13
+ teLogger (> 0.2)
14
+ toolrack (> 0.23)
15
+ minitest (5.20.0)
28
16
  pastel (0.8.0)
29
17
  tty-color (~> 0.5)
30
18
  ptools (1.4.3)
31
19
  rake (12.3.3)
32
- release-gem (0.1.25)
20
+ release-gem (0.1.30)
33
21
  colorize
34
22
  git_cli
35
- gvcs
36
23
  teLogger
37
24
  toolrack
38
25
  tty-command
@@ -69,7 +56,6 @@ PLATFORMS
69
56
  x86_64-linux
70
57
 
71
58
  DEPENDENCIES
72
- devops_assist
73
59
  minitest (~> 5.0)
74
60
  rake (~> 12.0)
75
61
  release-gem
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rake/testtask"
3
3
 
4
- require 'devops_assist'
4
+ #require 'devops_assist'
5
5
 
6
6
  Rake::TestTask.new(:test) do |t|
7
7
  t.libs << "test"
@@ -20,15 +20,15 @@ module Antrapol
20
20
 
21
21
  def opt(key, desc, opts = {}, &block)
22
22
  raise RequiredFieldEmpty, "Key field cannot be empty" if is_empty?(key)
23
- raise DuplicatedField, "Given key '#{key}' already exist" if options.keys.include?(key)
23
+ raise DuplicatedField, "Given key '#{key}' already exist" if arg_options.keys.include?(key)
24
24
  raise RequiredFieldEmpty, "Block is require" if not block
25
25
 
26
- options[key] = { key: key, desc: desc, options: opts, callback: block }
26
+ arg_options[key] = { key: key, desc: desc, arg_options: opts, callback: block }
27
27
  required << key if opts[:required] == true
28
28
  end
29
29
 
30
30
  def opt_alias(existing, new)
31
- raise InvalidKey, "Existing key '#{existing}'to map to new key '#{new}' not found" if not options.keys.include?(existing)
31
+ raise InvalidKey, "Existing key '#{existing}'to map to new key '#{new}' not found" if not arg_options.keys.include?(existing)
32
32
  aliases[new] = existing
33
33
  end
34
34
 
@@ -66,11 +66,11 @@ module Antrapol
66
66
  @_req
67
67
  end
68
68
 
69
- def options
70
- if @_options.nil?
71
- @_options = {}
69
+ def arg_options
70
+ if @_arg_options.nil?
71
+ @_arg_options = {}
72
72
  end
73
- @_options
73
+ @_arg_options
74
74
  end
75
75
 
76
76
  def aliases
@@ -152,10 +152,10 @@ module Antrapol
152
152
  logger.debug "Processing : #{a}"
153
153
 
154
154
  key = a
155
- conf = cls.options[key]
155
+ conf = cls.arg_options[key]
156
156
  if is_empty?(conf)
157
157
  al = cls.aliases[key]
158
- conf = cls.options[al] if not_empty?(al)
158
+ conf = cls.arg_options[al] if not_empty?(al)
159
159
  end
160
160
 
161
161
  if is_empty?(conf)
@@ -216,10 +216,10 @@ module Antrapol
216
216
 
217
217
  logger.debug "After separation : #{key}"
218
218
 
219
- conf = cls.options[key]
219
+ conf = cls.arg_options[key]
220
220
  if is_empty?(conf)
221
221
  al = cls.aliases[key]
222
- conf = cls.options[al] if not_empty?(al)
222
+ conf = cls.arg_options[al] if not_empty?(al)
223
223
  end
224
224
 
225
225
  if is_empty?(conf)
@@ -97,6 +97,37 @@ module Antrapol
97
97
  end
98
98
  end
99
99
 
100
+ def hex_to_bin(hex)
101
+ if not_empty?(hex)
102
+ # [abcd1234].pack('H*')
103
+ # turn hex to binary
104
+ case hex
105
+ when Array
106
+ hex.pack('H*')
107
+ else
108
+ hex.split.pack('H*')
109
+ end
110
+ else
111
+ hex
112
+ end
113
+ end
114
+
115
+ def bin_to_int(bin)
116
+ if not_empty?(bin)
117
+ bin.bytes.inject { |a,b| (a << 8) + b }
118
+ else
119
+ bin
120
+ end
121
+ end
122
+
123
+ def int_to_bin(intStr)
124
+ if not_empty?(intStr)
125
+ hex_to_bin(intStr.to_i.to_s(16))
126
+ else
127
+ intStr
128
+ end
129
+ end
130
+
100
131
  def string_to_bool(str)
101
132
  if not_empty?(str) and is_str_bool?(str)
102
133
  s = str.to_s.strip.downcase
@@ -1,6 +1,6 @@
1
1
  module Antrapol
2
2
  module ToolRack
3
- VERSION = "0.23.2"
3
+ VERSION = "0.23.3"
4
4
  end
5
5
  end
6
6
 
data/lib/toolrack.rb CHANGED
@@ -31,7 +31,12 @@ module Antrapol
31
31
  #
32
32
  def self.logger(tag = nil, &block)
33
33
  if @_logger.nil?
34
- @_logger = TeLogger::Tlogger.new
34
+ trLogout = ENV["TR_LOGOUT"]
35
+ if not_empty?(trLogout)
36
+ @_logger = TeLogger::Tlogger.new(trLogout, 5, 5*1024*1024)
37
+ else
38
+ @_logger = TeLogger::Tlogger.new('toolrack.log', 5, 5*1024*1024)
39
+ end
35
40
  end
36
41
 
37
42
  if block
@@ -67,6 +72,7 @@ ToolRack = Antrapol::ToolRack
67
72
 
68
73
  ToolRack::DataConvUtils = Antrapol::ToolRack::DataConversionUtils
69
74
  TR::DataConvUtils = ToolRack::DataConvUtils
75
+ TR::DCUtils = TR::DataConvUtils
70
76
 
71
77
  ToolRack::CondUtils = ToolRack::ConditionUtils
72
78
  TR::CondUtils = ToolRack::ConditionUtils
data/toolrack.gemspec CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
30
30
  #spec.add_dependency "base58"
31
31
 
32
32
  #spec.add_development_dependency "devops_helper" #, "~> 0.1.0"
33
- spec.add_development_dependency "devops_assist"
33
+ #spec.add_development_dependency "devops_assist"
34
34
  spec.add_development_dependency "rspec"
35
35
  spec.add_development_dependency "release-gem"
36
36
 
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toolrack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.2
4
+ version: 0.23.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: 2023-08-16 00:00:00.000000000 Z
11
+ date: 2023-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: devops_assist
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rspec
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -99,7 +85,7 @@ licenses: []
99
85
  metadata:
100
86
  homepage_uri: https://github.com/chrisliaw/toolrack
101
87
  source_code_uri: https://github.com/chrisliaw/toolrack
102
- post_install_message:
88
+ post_install_message:
103
89
  rdoc_options: []
104
90
  require_paths:
105
91
  - lib
@@ -114,8 +100,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
100
  - !ruby/object:Gem::Version
115
101
  version: '0'
116
102
  requirements: []
117
- rubygems_version: 3.4.18
118
- signing_key:
103
+ rubygems_version: 3.4.6
104
+ signing_key:
119
105
  specification_version: 4
120
106
  summary: Collection of simple utilities but I find it increase clarity
121
107
  test_files: []