zold 0.31.5 → 0.31.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (183) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/codecov.yml +20 -0
  3. data/.github/workflows/pdd.yml +11 -0
  4. data/.github/workflows/rake.yml +23 -0
  5. data/.github/workflows/xcop.yml +11 -0
  6. data/.rubocop.yml +9 -5
  7. data/.ruby-version +1 -1
  8. data/.rultor.yml +4 -5
  9. data/.simplecov +15 -19
  10. data/Dockerfile +1 -1
  11. data/Gemfile +13 -13
  12. data/Guardfile +1 -1
  13. data/README.md +0 -5
  14. data/Rakefile +1 -1
  15. data/bin/zold +1 -1
  16. data/features/step_definitions/steps.rb +5 -5
  17. data/features/support/env.rb +1 -1
  18. data/fixtures/merge/asserts.rb +1 -1
  19. data/fixtures/merge/into_no_wallet/assert.rb +1 -1
  20. data/fixtures/merge/legacy_negatives_stay/assert.rb +2 -2
  21. data/fixtures/merge/missed_wallets/assert.rb +2 -2
  22. data/fixtures/merge/negative_overwriting/assert.rb +1 -1
  23. data/fixtures/merge/negatives_in_between/assert.rb +2 -2
  24. data/fixtures/merge/random_expenses/assert.rb +2 -2
  25. data/fixtures/merge/simple_case/assert.rb +1 -1
  26. data/fixtures/merge/unconfirmed_income/assert.rb +1 -1
  27. data/lib/zold/age.rb +1 -1
  28. data/lib/zold/amount.rb +3 -3
  29. data/lib/zold/cached_wallets.rb +1 -1
  30. data/lib/zold/commands/args.rb +1 -1
  31. data/lib/zold/commands/calculate.rb +2 -2
  32. data/lib/zold/commands/clean.rb +1 -1
  33. data/lib/zold/commands/create.rb +6 -2
  34. data/lib/zold/commands/diff.rb +3 -3
  35. data/lib/zold/commands/fetch.rb +3 -3
  36. data/lib/zold/commands/invoice.rb +1 -1
  37. data/lib/zold/commands/list.rb +1 -1
  38. data/lib/zold/commands/merge.rb +4 -4
  39. data/lib/zold/commands/next.rb +1 -1
  40. data/lib/zold/commands/node.rb +3 -3
  41. data/lib/zold/commands/pay.rb +2 -2
  42. data/lib/zold/commands/propagate.rb +2 -2
  43. data/lib/zold/commands/pull.rb +1 -1
  44. data/lib/zold/commands/push.rb +1 -1
  45. data/lib/zold/commands/remote.rb +1 -1
  46. data/lib/zold/commands/remove.rb +1 -1
  47. data/lib/zold/commands/routines/audit.rb +7 -8
  48. data/lib/zold/commands/routines/gc.rb +1 -1
  49. data/lib/zold/commands/routines/reconcile.rb +1 -1
  50. data/lib/zold/commands/routines/reconnect.rb +1 -1
  51. data/lib/zold/commands/routines/retire.rb +1 -1
  52. data/lib/zold/commands/routines.rb +1 -1
  53. data/lib/zold/commands/show.rb +5 -6
  54. data/lib/zold/commands/taxes.rb +2 -2
  55. data/lib/zold/commands/thread_badge.rb +1 -1
  56. data/lib/zold/copies.rb +4 -4
  57. data/lib/zold/dir_items.rb +2 -2
  58. data/lib/zold/endless.rb +3 -5
  59. data/lib/zold/gem.rb +1 -1
  60. data/lib/zold/hands.rb +4 -4
  61. data/lib/zold/head.rb +1 -1
  62. data/lib/zold/hexnum.rb +1 -1
  63. data/lib/zold/http.rb +5 -4
  64. data/lib/zold/hungry_wallets.rb +2 -2
  65. data/lib/zold/id.rb +3 -5
  66. data/lib/zold/json_page.rb +2 -2
  67. data/lib/zold/key.rb +5 -5
  68. data/lib/zold/log.rb +7 -7
  69. data/lib/zold/metronome.rb +2 -2
  70. data/lib/zold/node/async_entrance.rb +9 -9
  71. data/lib/zold/node/entrance.rb +5 -5
  72. data/lib/zold/node/farm.rb +4 -4
  73. data/lib/zold/node/farmers.rb +2 -4
  74. data/lib/zold/node/front.rb +23 -19
  75. data/lib/zold/node/journaled_pipeline.rb +6 -6
  76. data/lib/zold/node/nodup_entrance.rb +1 -1
  77. data/lib/zold/node/nospam_entrance.rb +2 -2
  78. data/lib/zold/node/pipeline.rb +6 -6
  79. data/lib/zold/node/safe_entrance.rb +2 -2
  80. data/lib/zold/node/soft_error.rb +1 -1
  81. data/lib/zold/node/spread_entrance.rb +3 -3
  82. data/lib/zold/node/sync_entrance.rb +1 -1
  83. data/lib/zold/node/trace.rb +1 -1
  84. data/lib/zold/patch.rb +14 -15
  85. data/lib/zold/prefixes.rb +1 -1
  86. data/lib/zold/remotes.rb +4 -6
  87. data/lib/zold/signature.rb +1 -1
  88. data/lib/zold/size.rb +1 -1
  89. data/lib/zold/sync_wallets.rb +1 -1
  90. data/lib/zold/tax.rb +6 -4
  91. data/lib/zold/thread_pool.rb +3 -3
  92. data/lib/zold/tree_wallets.rb +1 -1
  93. data/lib/zold/txn.rb +26 -19
  94. data/lib/zold/txns.rb +1 -1
  95. data/lib/zold/upgrades.rb +2 -2
  96. data/lib/zold/verbose_thread.rb +2 -2
  97. data/lib/zold/version.rb +2 -2
  98. data/lib/zold/version_file.rb +1 -1
  99. data/lib/zold/wallet.rb +3 -3
  100. data/lib/zold/wallets.rb +6 -1
  101. data/lib/zold.rb +1 -1
  102. data/renovate.json +6 -0
  103. data/test/commands/routines/test_audit.rb +2 -2
  104. data/test/commands/routines/test_gc.rb +2 -2
  105. data/test/commands/routines/test_reconcile.rb +2 -2
  106. data/test/commands/routines/test_reconnect.rb +2 -2
  107. data/test/commands/routines/test_retire.rb +2 -2
  108. data/test/commands/test_alias.rb +1 -1
  109. data/test/commands/test_calculate.rb +1 -1
  110. data/test/commands/test_clean.rb +4 -4
  111. data/test/commands/test_create.rb +1 -1
  112. data/test/commands/test_diff.rb +5 -5
  113. data/test/commands/test_fetch.rb +21 -21
  114. data/test/commands/test_invoice.rb +1 -1
  115. data/test/commands/test_list.rb +1 -1
  116. data/test/commands/test_merge.rb +11 -11
  117. data/test/commands/test_node.rb +1 -1
  118. data/test/commands/test_pay.rb +4 -4
  119. data/test/commands/test_propagate.rb +1 -1
  120. data/test/commands/test_pull.rb +1 -1
  121. data/test/commands/test_push.rb +1 -1
  122. data/test/commands/test_remote.rb +2 -2
  123. data/test/commands/test_remove.rb +1 -1
  124. data/test/commands/test_show.rb +1 -1
  125. data/test/commands/test_taxes.rb +2 -2
  126. data/test/fake_home.rb +4 -3
  127. data/test/node/fake_entrance.rb +1 -1
  128. data/test/node/fake_node.rb +2 -2
  129. data/test/node/test_async_entrance.rb +6 -4
  130. data/test/node/test_entrance.rb +4 -4
  131. data/test/node/test_farm.rb +2 -2
  132. data/test/node/test_farmers.rb +1 -1
  133. data/test/node/test_front.rb +4 -4
  134. data/test/node/test_nodup_entrance.rb +2 -2
  135. data/test/node/test_nospam_entrance.rb +1 -1
  136. data/test/node/test_safe_entrance.rb +3 -3
  137. data/test/node/test_spread_entrance.rb +2 -2
  138. data/test/node/test_sync_entrance.rb +1 -1
  139. data/test/node/test_trace.rb +1 -1
  140. data/test/test__helper.rb +5 -4
  141. data/test/test_age.rb +2 -2
  142. data/test/test_amount.rb +1 -1
  143. data/test/test_cached_wallets.rb +3 -3
  144. data/test/test_copies.rb +6 -6
  145. data/test/test_dir_items.rb +2 -4
  146. data/test/test_gem.rb +1 -1
  147. data/test/test_hands.rb +1 -1
  148. data/test/test_hexnum.rb +1 -1
  149. data/test/test_http.rb +5 -5
  150. data/test/test_hungry_wallets.rb +1 -1
  151. data/test/test_id.rb +1 -1
  152. data/test/test_json_page.rb +1 -1
  153. data/test/test_key.rb +5 -5
  154. data/test/test_log.rb +1 -1
  155. data/test/test_metronome.rb +2 -1
  156. data/test/test_patch.rb +9 -9
  157. data/test/test_prefixes.rb +1 -1
  158. data/test/test_remotes.rb +2 -2
  159. data/test/test_signature.rb +1 -1
  160. data/test/test_size.rb +1 -1
  161. data/test/test_sync_wallets.rb +1 -1
  162. data/test/test_tax.rb +4 -4
  163. data/test/test_thread_pool.rb +1 -1
  164. data/test/test_tree_wallets.rb +1 -1
  165. data/test/test_txn.rb +2 -2
  166. data/test/test_upgrades.rb +4 -4
  167. data/test/test_verbose_thread.rb +1 -1
  168. data/test/test_wallet.rb +14 -14
  169. data/test/test_wallets.rb +1 -1
  170. data/test/test_zold.rb +2 -2
  171. data/test/upgrades/test_delete_banned_wallets.rb +1 -1
  172. data/test/upgrades/test_protocol_up.rb +1 -1
  173. data/upgrades/2.rb +1 -1
  174. data/upgrades/delete_banned_wallets.rb +2 -2
  175. data/upgrades/move_wallets_into_tree.rb +1 -1
  176. data/upgrades/protocol_up.rb +3 -3
  177. data/upgrades/rename_foreign_wallets.rb +2 -2
  178. data/zold.gemspec +21 -24
  179. metadata +40 -117
  180. data/.github/CODE_OF_CONDUCT.md +0 -76
  181. data/.github/CONTRIBUTING.md +0 -11
  182. data/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
  183. data/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6837bb58081513d3421063ecaee8197ce5940fcb538ad1bdd38809351e780119
4
- data.tar.gz: ef50b2003f151e9c23dc76cddda7039b7b4bdeae78a0b960d2896825dcb5f49a
3
+ metadata.gz: 18c6e4f1386774fcd7a25433bd8211f5c2b0dc99fc61c97b82440148db58282c
4
+ data.tar.gz: f5d556bdff66fafbb6b0b831add370d90c2fd535fd41b23f404f8061e58ffc6e
5
5
  SHA512:
6
- metadata.gz: d20f8a8ead5f0ac8cd64a52cd35920d0c2e0563267e07a4670bd3ed4c60e0bf95061ea1980ceea1e8f019e7b09a3c0a1c421e48c5350b8d24fa3a9b382317175
7
- data.tar.gz: 642133a1466c7568548203410a99826025feecffe9e907e24f30003742116601ff877c8116df7970865a4e6ce50717616015f1d8a3eee71d1424bf035525f408
6
+ metadata.gz: 4dc26f43f869a10a4aaad3028241b3dbe7abe3323dde24252afad2ada84d82fc0de7ab70cf5862308eead9186f95954d6beb4a8fb62609bdec5cfb20856f8cce
7
+ data.tar.gz: 7f43aa3777ca221cf0b96941c8b1bece39950505d6ff8de7f43d5a0d971e66064378774020f469e160e8ea4dc396ba3302713b480308eef5bee5ebf020a6ff16
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: codecov
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ jobs:
8
+ codecov:
9
+ runs-on: ubuntu-20.04
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - uses: ruby/setup-ruby@v1
13
+ with:
14
+ ruby-version: 2.7
15
+ - run: bundle update
16
+ - run: bundle exec rake
17
+ - uses: codecov/codecov-action@v3
18
+ with:
19
+ file: coverage/.resultset.json
20
+ fail_ci_if_error: true
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: pdd
3
+ on:
4
+ push:
5
+ pull_request:
6
+ jobs:
7
+ pdd:
8
+ runs-on: ubuntu-20.04
9
+ steps:
10
+ - uses: actions/checkout@v4
11
+ - uses: g4s8/pdd-action@master
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: rake
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+ branches:
9
+ - master
10
+ jobs:
11
+ rake:
12
+ strategy:
13
+ matrix:
14
+ os: [ubuntu-22.04, macos-12]
15
+ ruby: [3.2]
16
+ runs-on: ${{ matrix.os }}
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: ${{ matrix.ruby }}
22
+ - run: bundle update
23
+ - run: bundle exec rake
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: xcop
3
+ on:
4
+ push:
5
+ pull_request:
6
+ jobs:
7
+ xcop:
8
+ runs-on: ubuntu-20.04
9
+ steps:
10
+ - uses: actions/checkout@v4
11
+ - uses: g4s8/xcop-action@master
data/.rubocop.yml CHANGED
@@ -4,17 +4,21 @@ AllCops:
4
4
  - 'assets/**/*'
5
5
  DisplayCopNames: true
6
6
  TargetRubyVersion: 2.5
7
+ NewCops: enable
8
+ SuggestExtensions: false
7
9
 
10
+ Gemspec/RequireMFA:
11
+ Enabled: false
8
12
  Lint/ToJSON:
9
13
  Enabled: false
10
- Layout/AlignArguments:
14
+ Layout/ArgumentAlignment:
11
15
  Enabled: false
12
16
  Style/ClassAndModuleChildren:
13
17
  Enabled: false
14
18
  Layout/EmptyLineAfterGuardClause:
15
19
  Enabled: false
16
20
  Metrics/CyclomaticComplexity:
17
- Max: 33
21
+ Max: 45
18
22
  Metrics/MethodLength:
19
23
  Enabled: false
20
24
  Layout/MultilineMethodCallIndentation:
@@ -31,15 +35,15 @@ Layout/EndOfLine:
31
35
  EnforcedStyle: lf
32
36
  Metrics/ParameterLists:
33
37
  Max: 10
34
- Layout/AlignParameters:
38
+ Layout/ParameterAlignment:
35
39
  Enabled: false
36
40
  Metrics/PerceivedComplexity:
37
- Max: 36
41
+ Max: 45
38
42
  Metrics/LineLength:
39
43
  Max: 120
40
44
  Style/MultilineBlockChain:
41
45
  Enabled: false
42
46
  Layout/MultilineOperationIndentation:
43
47
  Enabled: false
44
- Naming/UncommunicativeMethodParamName:
48
+ Naming/MethodParameterName:
45
49
  MinNameLength: 1
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.0
1
+ 2.7.8
data/.rultor.yml CHANGED
@@ -1,19 +1,19 @@
1
1
  docker:
2
- image: yegor256/rultor-image:1.9.1
2
+ image: yegor256/rultor-image:1.22.0
3
3
  architect:
4
4
  - yegor256
5
5
  - davvd
6
6
  assets:
7
7
  rubygems.yml: yegor256/home#assets/rubygems.yml
8
8
  install: |
9
+ pdd -f /dev/null -v
9
10
  sudo apt-get -y update
10
11
  sudo apt-get -y install libcurl4-openssl-dev
11
- sudo bundle install --no-color "--gemfile=$(pwd)/Gemfile"
12
- sudo rm -rf "$(pwd)/Gemfile.lock"
12
+ bundle install --no-color
13
+ rm -rf "$(pwd)/Gemfile.lock"
13
14
  release:
14
15
  script: |-
15
16
  [[ "${tag}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit -1
16
-
17
17
  export RUBYOPT="-W0"
18
18
  sed -i "s/0\.0\.0/${tag}/g" lib/zold/version.rb
19
19
  bundle exec rake --quiet
@@ -25,4 +25,3 @@ release:
25
25
  merge:
26
26
  script: |-
27
27
  bundle exec rake --quiet
28
- pdd -f /dev/null -v
data/.simplecov CHANGED
@@ -1,6 +1,7 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
+
2
3
  #
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
4
+ # Copyright (c) 2018-2023 Zerocracy
4
5
  #
5
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
7
  # of this software and associated documentation files (the 'Software'), to deal
@@ -20,21 +21,16 @@
20
21
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
22
  # SOFTWARE.
22
23
 
23
- if Gem.win_platform? then
24
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
25
- SimpleCov::Formatter::HTMLFormatter
26
- ]
27
- SimpleCov.start do
28
- add_filter "/test/"
29
- add_filter "/features/"
30
- end
31
- else
32
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
33
- [SimpleCov::Formatter::HTMLFormatter]
34
- )
35
- SimpleCov.start do
36
- add_filter "/test/"
37
- add_filter "/features/"
38
- # minimum_coverage 30
39
- end
24
+ SimpleCov.formatter = if Gem.win_platform?
25
+ SimpleCov::Formatter::MultiFormatter[
26
+ SimpleCov::Formatter::HTMLFormatter
27
+ ]
28
+ else
29
+ SimpleCov::Formatter::MultiFormatter.new(
30
+ [SimpleCov::Formatter::HTMLFormatter]
31
+ )
32
+ end
33
+ SimpleCov.start do
34
+ add_filter '/test/'
35
+ add_filter '/features/'
40
36
  end
data/Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM ruby:2.6
1
+ FROM ruby:2.7
2
2
 
3
3
  RUN gem install zold
4
4
  EXPOSE 4096
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -23,19 +23,19 @@
23
23
  source 'https://rubygems.org'
24
24
  gemspec
25
25
 
26
- gem 'cucumber', '3.1.2', require: false
27
- gem 'guard', '2.15.0', require: false
26
+ gem 'cucumber', '9.1.0', require: false
27
+ gem 'guard', '2.18.1', require: false
28
28
  gem 'guard-minitest', '2.4.6', require: false
29
- gem 'minitest', '5.11.3', require: false
29
+ gem 'minitest', '5.20.0', require: false
30
30
  gem 'minitest-fail-fast', '0.1.0', require: false
31
- gem 'minitest-hooks', '1.5.0', require: false
32
- gem 'minitest-reporters', '1.3.6', require: false
33
- gem 'rake', '12.3.2', require: false
34
- gem 'random-port', '0.3.1', require: false
35
- gem 'rdoc', '6.1.1', require: false
36
- gem 'rspec-rails', '3.8.2', require: false
37
- gem 'rubocop', '0.69.0', require: false
38
- gem 'rubocop-rspec', '1.33.0', require: false
31
+ gem 'minitest-hooks', '1.5.1', require: false
32
+ gem 'minitest-reporters', '1.6.1', require: false
33
+ gem 'rake', '13.1.0', require: false
34
+ gem 'random-port', '0.6.0', require: false
35
+ gem 'rdoc', '6.6.0', require: false
36
+ gem 'rspec-rails', '6.1.0', require: false
37
+ gem 'rubocop', '1.57.2', require: false
38
+ gem 'rubocop-rspec', '2.25.0', require: false
39
39
  gem 'simplecov', '0.22.0', require: false
40
- gem 'webmock', '3.5.1', require: false
40
+ gem 'webmock', '3.19.1', require: false
41
41
  gem 'xcop', '>=0.6', require: false
data/Guardfile CHANGED
@@ -3,7 +3,7 @@
3
3
  # Guardfile for Zold
4
4
  guard :minitest, all_after_pass: false, all_on_start: false do
5
5
  # with Minitest::Unit
6
- watch(%r{^test/(.*)\/?test_(.*)\.rb$})
6
+ watch(%r{^test/(.*)/?test_(.*)\.rb$})
7
7
  watch(%r{^lib/zold/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
8
8
  watch(%r{^test/test_helper\.rb$}) { 'test' }
9
9
  end
data/README.md CHANGED
@@ -1,17 +1,12 @@
1
1
  <img src="http://www.zold.io/logo.svg" width="92px" height="92px"/>
2
2
 
3
- [![Donate via Zerocracy](https://www.0crat.com/contrib-badge/CAZPZR9FS.svg)](https://www.0crat.com/contrib/CAZPZR9FS)
4
-
5
3
  [![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org)
6
- [![Managed by Zerocracy](https://www.0crat.com/badge/CAZPZR9FS.svg)](https://www.0crat.com/p/CAZPZR9FS)
7
4
  [![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/zold)](http://www.rultor.com/p/yegor256/zold)
8
5
  [![We recommend RubyMine](https://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
9
6
 
10
- [![Build Status](https://travis-ci.org/zold-io/zold.svg?branch=master)](https://travis-ci.org/zold-io/zold)
11
7
  [![PDD status](http://www.0pdd.com/svg?name=zold-io/zold)](http://www.0pdd.com/p?name=zold-io/zold)
12
8
  [![Gem Version](https://badge.fury.io/rb/zold.svg)](http://badge.fury.io/rb/zold)
13
9
  [![Test Coverage](https://img.shields.io/codecov/c/github/zold-io/zold.svg)](https://codecov.io/github/zold-io/zold?branch=master)
14
-
15
10
  [![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/github/zold-io/zold/master/frames)
16
11
  [![Maintainability](https://api.codeclimate.com/v1/badges/2861728929db934eb376/maintainability)](https://codeclimate.com/github/zold-io/zold/maintainability)
17
12
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/takes/blob/master/LICENSE.txt)
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
data/bin/zold CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
3
  #
4
- # Copyright (c) 2018-2023 Zerocracy, Inc.
4
+ # Copyright (c) 2018-2023 Zerocracy
5
5
  #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -30,13 +30,13 @@ Before do
30
30
  @dir = Dir.mktmpdir('test')
31
31
  FileUtils.copy('fixtures/id_rsa', @dir)
32
32
  FileUtils.copy('fixtures/id_rsa.pub', @dir)
33
- FileUtils.mkdir_p(@dir) unless File.exist?(@dir)
33
+ FileUtils.mkdir_p(@dir)
34
34
  Dir.chdir(@dir)
35
35
  end
36
36
 
37
37
  After do
38
38
  Dir.chdir(@cwd)
39
- FileUtils.rm_rf(@dir) if File.exist?(@dir)
39
+ FileUtils.rm_rf(@dir)
40
40
  end
41
41
 
42
42
  When(%r{^I run ([a-z/-]+) with "([^"]*)"$}) do |cmd, args|
@@ -47,7 +47,7 @@ end
47
47
 
48
48
  When(/^I run bash with:$/) do |text|
49
49
  FileUtils.copy_entry(@cwd, File.join(@dir, 'zold'))
50
- IO.write('run.sh', text)
50
+ File.write('run.sh', text)
51
51
  @stdout = `/bin/bash run.sh 2>&1`
52
52
  @exitstatus = $CHILD_STATUS.exitstatus
53
53
  end
@@ -55,7 +55,7 @@ end
55
55
  When(/^I have "([^"]*)" file with content:$/) do |file, text|
56
56
  FileUtils.mkdir_p(File.dirname(file)) unless File.exist?(file)
57
57
  File.open(file, 'w:ASCII-8BIT') do |f|
58
- f.write(text.gsub(/\\xFF/, 0xFF.chr))
58
+ f.write(text.gsub('\\xFF', 0xFF.chr))
59
59
  end
60
60
  end
61
61
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -20,6 +20,6 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  # SOFTWARE.
22
22
 
23
- require_relative 'asserts.rb'
23
+ require_relative 'asserts'
24
24
  wallet = Zold::Wallet.new('0123456789abcdef.z')
25
25
  assert_equal(Zold::Amount.new(zld: -9.0), wallet.balance)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -20,6 +20,6 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  # SOFTWARE.
22
22
 
23
- require_relative 'asserts.rb'
23
+ require_relative 'asserts'
24
24
  wallet = Zold::Wallet.new('0123456789abcdef.z')
25
25
  assert_equal(Zold::Amount.new(zld: 496.0), wallet.balance)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -20,6 +20,6 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  # SOFTWARE.
22
22
 
23
- require_relative 'asserts.rb'
23
+ require_relative 'asserts'
24
24
  wallet = Zold::Wallet.new('0123456789abcdef.z')
25
25
  assert_equal(Zold::Amount.new(zld: 512.0 - 16 - 32), wallet.balance)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -20,6 +20,6 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  # SOFTWARE.
22
22
 
23
- require_relative 'asserts.rb'
23
+ require_relative 'asserts'
24
24
  wallet = Zold::Wallet.new('0123456789abcdef.z')
25
25
  assert_equal(Zold::Amount.new(zld: 388.0), wallet.balance)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
data/lib/zold/age.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
data/lib/zold/amount.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -42,7 +42,7 @@ module Zold
42
42
  @zents = zents
43
43
  elsif !zld.nil?
44
44
  raise "Float is required, while #{zld.class} provided: #{zld}" unless zld.is_a?(Float)
45
- @zents = (zld * 2**FRACTION).to_i
45
+ @zents = (zld * (2**FRACTION)).to_i
46
46
  else
47
47
  raise 'You can\'t specify both coints and zld'
48
48
  end
@@ -60,7 +60,7 @@ module Zold
60
60
 
61
61
  # Convert to ZLD and return as a float.
62
62
  def to_f
63
- @zents.to_f / 2**FRACTION
63
+ @zents.to_f / (2**FRACTION)
64
64
  end
65
65
 
66
66
  # Convert to ZLD and return as a string. If you need float, you should use <tt>to_f()</tt> later.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -84,7 +84,7 @@ Available options:"
84
84
  )
85
85
  loop do
86
86
  msg = score.to_s
87
- msg += (score.value.positive? ? ' ' + score.hash : '') unless opts['hide-hash']
87
+ msg += (score.value.positive? ? " #{score.hash}" : '') unless opts['hide-hash']
88
88
  msg += " #{(Time.now - mstart).round(2)}s" unless opts['hide-time']
89
89
  @log.info(msg)
90
90
  break if score.value >= opts[:max].to_i
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -70,7 +70,11 @@ Available options:"
70
70
  loop do
71
71
  id = Id.new
72
72
  return id if opts['skip-test']
73
- found = false
73
+ found = @wallets.exists?(id)
74
+ if found
75
+ @log.debug("Wallet ID #{id} already exists locally, will try another one...")
76
+ next
77
+ end
74
78
  @remotes.iterate(@log) do |r|
75
79
  head = r.http("/wallet/#{id}/digest").get
76
80
  found = true if head.status == 200
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -70,12 +70,12 @@ Available options:"
70
70
  patch.join(Wallet.new(c[:path]))
71
71
  end
72
72
  before = @wallets.acq(id) do |wallet|
73
- IO.read(wallet.path)
73
+ File.read(wallet.path)
74
74
  end
75
75
  after = ''
76
76
  Tempfile.open(['', Wallet::EXT]) do |f|
77
77
  patch.save(f.path, overwrite: true)
78
- after = IO.read(f)
78
+ after = File.read(f)
79
79
  end
80
80
  diff = Diffy::Diff.new(before, after, context: 0).to_s(:color)
81
81
  @log.info(diff)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -170,7 +170,7 @@ run 'zold remote update' or use --tolerate-quorum=1"
170
170
  if wallet.balance.negative? && !wallet.root?
171
171
  raise FetchError, "The balance of #{id} is #{wallet.balance} and it's not a root wallet"
172
172
  end
173
- copy = cps.add(IO.read(f), score.host, score.port, score.value, master: r.master?)
173
+ copy = cps.add(File.read(f), score.host, score.port, score.value, master: r.master?)
174
174
  @log.debug("#{r} returned #{wallet.mnemo} #{Age.new(json['mtime'])}/#{json['copies']}c \
175
175
  as copy ##{copy}/#{cps.all.count} in #{Age.new(start, limit: 4)}: \
176
176
  #{Rainbow(score.value).green} (#{json['version']})")
@@ -204,7 +204,7 @@ as copy ##{copy}/#{cps.all.count} in #{Age.new(start, limit: 4)}: \
204
204
  cps.all.each do |c|
205
205
  next unless json['digest'] == OpenSSL::Digest::SHA256.file(c[:path]).hexdigest &&
206
206
  json['size'] == File.size(c[:path])
207
- copy = cps.add(IO.read(c[:path]), score.host, score.port, score.value, master: r.master?)
207
+ copy = cps.add(File.read(c[:path]), score.host, score.port, score.value, master: r.master?)
208
208
  @log.debug("No need to fetch #{id} from #{r}, it's the same content as copy ##{copy}")
209
209
  return true
210
210
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal