toolrack 0.16.2 → 0.18.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab1dc47c48af6feb3a0aafffb05db94e72db915961c232e2c9574517cbd269fb
4
- data.tar.gz: e584df8293bc3c1dea88ae07a1eadc4ff8b73d8593d4dd9c4d5cd7e5fa8813f1
3
+ metadata.gz: b2a5e455da8f2fbd0f626cbed82cb82bc3be9041c99263f239c288a010712e9f
4
+ data.tar.gz: 5131ea33e5932391f8933654b1d705e71b7c28790b4f00b7360ff3bab2dfdedf
5
5
  SHA512:
6
- metadata.gz: 5c14eedd41bc09df2493b047b6641631c4f0144ddcd35bb48c5c8bcea16dee906cabe7f623141be8fa2b93d19677ea392d0de4a2d1ca64e71d45d42a077da972
7
- data.tar.gz: a5a0d2b72ef55a4111a77718416b773737630eaf488e0ddb640d1f3c6300ff75493e2e36b449c670c75ca491ba96e1c2ad6efd66331ce9f2c2f886090eb747d5
6
+ metadata.gz: bc0e28d24d046ce10e6b5db4a95d06f9609ca0b5bddbf3a478ca49ef6092779cbdaa9c6981fbde25122065cb9e39b1ea4cdb0e8346f1723d44223cef07fb9781
7
+ data.tar.gz: 2ce39e6d41f101efc1533ef2f64f27c506310228dc53b35ecae121c30201d16afca4b6a590c571a55b9ab113e2f98c76664d1e52857d070d18b752ad045f1c5c
data/.gitignore CHANGED
@@ -9,6 +9,5 @@
9
9
  *.gem
10
10
  *.log
11
11
  tags
12
- Gemfile.lock
13
12
  test.ssh
14
13
  test.ssh.pub
data/.release_history.yml CHANGED
@@ -2,3 +2,11 @@
2
2
  toolrack:
3
3
  - :version: 0.16.1
4
4
  :timestamp: 1635759283.7389827
5
+ - :version: 0.16.2
6
+ :timestamp: 1636343293.571501
7
+ - :version: 0.17.0
8
+ :timestamp: 1636636596.4561074
9
+ - :version: 0.18.0
10
+ :timestamp: 1637901331.2374165
11
+ - :version: 0.18.1
12
+ :timestamp: 1637901450.2854214
data/Gemfile.lock ADDED
@@ -0,0 +1,72 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ toolrack (0.18.1)
5
+ base58
6
+ tlogger
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ base58 (0.2.3)
12
+ devops_assist (0.1.4)
13
+ git_cli
14
+ git_cli_prompt
15
+ gvcs
16
+ tlogger
17
+ toolrack
18
+ tty-prompt
19
+ diff-lcs (1.4.4)
20
+ git_cli (0.9.0)
21
+ gvcs
22
+ ptools (~> 1.4.0)
23
+ tlogger
24
+ toolrack
25
+ git_cli_prompt (0.2.2)
26
+ tlogger
27
+ toolrack
28
+ tty-prompt
29
+ gvcs (0.1.0)
30
+ minitest (5.14.4)
31
+ pastel (0.8.0)
32
+ tty-color (~> 0.5)
33
+ ptools (1.4.2)
34
+ rake (12.3.3)
35
+ rspec (3.10.0)
36
+ rspec-core (~> 3.10.0)
37
+ rspec-expectations (~> 3.10.0)
38
+ rspec-mocks (~> 3.10.0)
39
+ rspec-core (3.10.1)
40
+ rspec-support (~> 3.10.0)
41
+ rspec-expectations (3.10.1)
42
+ diff-lcs (>= 1.2.0, < 2.0)
43
+ rspec-support (~> 3.10.0)
44
+ rspec-mocks (3.10.2)
45
+ diff-lcs (>= 1.2.0, < 2.0)
46
+ rspec-support (~> 3.10.0)
47
+ rspec-support (3.10.3)
48
+ tlogger (0.26.3)
49
+ tty-color (0.6.0)
50
+ tty-cursor (0.7.1)
51
+ tty-prompt (0.23.1)
52
+ pastel (~> 0.8)
53
+ tty-reader (~> 0.8)
54
+ tty-reader (0.9.0)
55
+ tty-cursor (~> 0.7)
56
+ tty-screen (~> 0.8)
57
+ wisper (~> 2.0)
58
+ tty-screen (0.8.1)
59
+ wisper (2.0.1)
60
+
61
+ PLATFORMS
62
+ x86_64-linux
63
+
64
+ DEPENDENCIES
65
+ devops_assist
66
+ minitest (~> 5.0)
67
+ rake (~> 12.0)
68
+ rspec
69
+ toolrack!
70
+
71
+ BUNDLED WITH
72
+ 2.2.22
@@ -0,0 +1,46 @@
1
+
2
+
3
+
4
+ module Antrapol
5
+ module ToolRack
6
+ module BlockParamsUtils
7
+ include ConditionUtils
8
+
9
+ def value_from_block(blockKey, defValue, opts = { }, &block)
10
+ if block
11
+ blockParams = nil
12
+ if not_empty?(opts)
13
+ blockParams = opts[:blockArgs]
14
+ end
15
+
16
+ value = nil
17
+ if blockParams.nil?
18
+ value = block.call(blockKey)
19
+ else
20
+ if blockParams.is_a?(Array)
21
+ value = block.call(blockKey, *blockParams)
22
+ else
23
+ value = block.casll(blockKey, blockParams)
24
+ end
25
+ end
26
+
27
+ block.call(:inspect_given_value, blockKey, opts, value)
28
+
29
+ value = defValue if is_empty?(value)
30
+
31
+ value
32
+ else
33
+ defValue
34
+ end
35
+ end
36
+
37
+
38
+ def self.included(klass)
39
+ klass.class_eval <<-END
40
+ extend Antrapol::ToolRack::BlockParamsUtils
41
+ END
42
+ end
43
+
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,72 @@
1
+
2
+ require 'openssl'
3
+
4
+ module Antrapol
5
+ module ToolRack
6
+ module FileUtils
7
+ include Antrapol::ToolRack::DataConversionUtils
8
+
9
+ class FileUtilsError < StandardError; end
10
+ module ClassMethods
11
+ def is_same?(*args, &block)
12
+ opts = { verbose: false }
13
+ if args.last.is_a?(Hash)
14
+ opts.merge!(args.last)
15
+ target = args[0..-2]
16
+ else
17
+ target = args
18
+ end
19
+
20
+ raise FileUtilsError, "is_same? requires at least 2 files" if target.length < 2
21
+
22
+ res = true
23
+ size = nil
24
+ target.each do |f|
25
+ raise FileUtilsError, "Given file #{f} to is_same? does not exist" if not File.exist?(f)
26
+
27
+ if size.nil?
28
+ size = File.size(f)
29
+ elsif File.size(f) != size
30
+ res = false
31
+ break
32
+ end
33
+
34
+ end
35
+
36
+ if res
37
+ prevDigRes = nil
38
+ target.each do |f|
39
+ dig = OpenSSL::Digest.new("SHA256")
40
+ bufSize = 2048*1000
41
+ File.open(f,"rb") do |f|
42
+ dig.update(f.read(bufSize))
43
+ end
44
+ digRes = dig.digest
45
+
46
+ STDOUT.puts "#{f} : #{to_hex(digRes)}" if opts[:verbose]
47
+
48
+ if prevDigRes.nil?
49
+ prevDigRes = digRes
50
+ elsif prevDigRes != digRes
51
+ res = false
52
+ break
53
+ end
54
+ end
55
+ end
56
+
57
+ res
58
+
59
+ end
60
+ end
61
+
62
+ def self.included(klass)
63
+ File.class_eval <<-END
64
+ extend Antrapol::ToolRack::FileUtils::ClassMethods
65
+ END
66
+ end
67
+
68
+ end
69
+ end
70
+ end
71
+
72
+
@@ -16,6 +16,10 @@ module Antrapol
16
16
  (RbConfig::CONFIG['host_os'] =~ /linux/) != nil
17
17
  end
18
18
 
19
+ def RuntimeUtils.os_string
20
+ RbConfig::CONFIG['host_os']
21
+ end
22
+
19
23
  def RuntimeUtils.on_ruby?
20
24
  not on_jruby?
21
25
  end
@@ -1,6 +1,6 @@
1
1
  module Antrapol
2
2
  module ToolRack
3
- VERSION = "0.16.2"
3
+ VERSION = "0.18.2"
4
4
  end
5
5
  end
6
6
 
data/lib/toolrack.rb CHANGED
@@ -16,6 +16,8 @@ require_relative 'toolrack/hash_config'
16
16
  require_relative 'toolrack/cli_utils'
17
17
  require_relative 'toolrack/null_output'
18
18
  require_relative 'toolrack/version_utils'
19
+ require_relative 'toolrack/file_utils'
20
+ require_relative 'toolrack/block_params_utils'
19
21
 
20
22
  module Antrapol
21
23
  module ToolRack
@@ -59,3 +61,7 @@ TR::NullOut = ToolRack::NullOutput
59
61
  TR::VerUtils = ToolRack::VersionUtils
60
62
  TR::VUtils = TR::VerUtils
61
63
 
64
+ TR::FileUtils = ToolRack::FileUtils
65
+
66
+ TR::BlockParamsUtils = ToolRack::BlockParamsUtils
67
+
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.16.2
4
+ version: 0.18.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-08 00:00:00.000000000 Z
11
+ date: 2021-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tlogger
@@ -79,15 +79,18 @@ files:
79
79
  - ".travis.yml"
80
80
  - CODE_OF_CONDUCT.md
81
81
  - Gemfile
82
+ - Gemfile.lock
82
83
  - README.md
83
84
  - Rakefile
84
85
  - bin/console
85
86
  - bin/setup
86
87
  - lib/toolrack.rb
88
+ - lib/toolrack/block_params_utils.rb
87
89
  - lib/toolrack/cli_utils.rb
88
90
  - lib/toolrack/condition_utils.rb
89
91
  - lib/toolrack/data_conversion_utils.rb
90
92
  - lib/toolrack/exception_utils.rb
93
+ - lib/toolrack/file_utils.rb
91
94
  - lib/toolrack/global.rb
92
95
  - lib/toolrack/hash_config.rb
93
96
  - lib/toolrack/null_output.rb