zold 0.10.23 → 0.11

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
  SHA1:
3
- metadata.gz: e30d98a4da1d87b1ce38880416a575dd2af3be96
4
- data.tar.gz: ebcaf1841cdab89dee4a72f043a88eb8f16d72f9
3
+ metadata.gz: 6ce4ce27a96a2d3e7a2963085d9e8491e05da7ad
4
+ data.tar.gz: 9d076c04d1069838250f23e2aadeaab2fe82885b
5
5
  SHA512:
6
- metadata.gz: c25ba428d69f5464b526147b5029b7cf25ad8cad869e6f4c34d798d3c2f4cfdbae671e77ef526cb2cab7b6292b6e44852b545a241f538ee3af7620d3cbf54076
7
- data.tar.gz: 4c7c227f8b02521a4561a967394c2384f56fa76bde901dad51fc9a5f427d593cb09282f38f8566435fae31faf2903348af7793de1e9faaf5c1900a0a566ae69f
6
+ metadata.gz: 7d31759b7f5e16ed3701b05a97599dbf65172afc36ff72f7df85892cf123cd8c0cda09565b60ebe433c0593b56be397a73c19ddf30bc48097dee91b1eb9d40cc
7
+ data.tar.gz: 2fa2524412411a98fdf9c90e34655913e83e2081c1fe1db1873ed6a7cf2d0d8ea80a26053018889ad82779817c3252f2e3d1f39d3bb703e6d83fa55157f93bac
data/README.md CHANGED
@@ -91,25 +91,26 @@ In order to do that just run (with your own wallet ID, of course,
91
91
  and your own public IP address instead of `4.4.4.4`):
92
92
 
93
93
  ```bash
94
- $ zold node --trace --verbose --invoice=5f96e731e48ae21f --host=4.4.4.4
94
+ $ zold --trace --verbose --invoice=5f96e731e48ae21f --host=4.4.4.4
95
95
  ```
96
96
 
97
97
  Then, open the page `4.4.4.4:4096` in your browser
98
98
  (you may need to open the inbound port at your
99
99
  [IP firewall](https://www.howtogeek.com/177621/the-beginners-guide-to-iptables-the-linux-firewall/)).
100
100
  If you see a simple JSON document, everything is fine.
101
- Next, hit <kbd>Ctrl</kbd>+<kbd>c</kbd> and run this line, in order
102
- to start the node and make sure it will be online even when you log off
103
- (replace `CMD` with the command you just executed before):
101
+ Next, hit <kbd>Ctrl</kbd>+<kbd>c</kbd> and run it again, but instead
102
+ of `zold` say `zold-nohup` and add an ampersand (`&`) at the end:
104
103
 
105
104
  ```bash
106
- $ nohup bash -c 'while CMD; do gem install zold; done' &
105
+ $ zold-nohup --trace --verbose --invoice=5f96e731e48ae21f --host=4.4.4.4 &
107
106
  ```
108
107
 
109
- The software will update itself automatically to new versions.
108
+ Now you can close console, it will work in the background, saving the
109
+ output logs to `nohup.out`. The software will update itself automatically to new versions.
110
110
 
111
111
  Grateful users of the system will pay "taxes" to your wallet
112
- for the maintenance of their wallets.
112
+ for the maintenance of their wallets, and the system will occasionally
113
+ send you rewards for keeping the node online (approximately 1 ZLD per day).
113
114
 
114
115
  ## Frequently Asked Questions
115
116
 
data/bin/zold-nohup ADDED
@@ -0,0 +1,24 @@
1
+ #!/bin/bash
2
+ # Copyright (c) 2018 Yegor Bugayenko
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ # of this software and associated documentation files (the 'Software'), to deal
6
+ # in the Software without restriction, including without limitation the rights
7
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ # copies of the Software, and to permit persons to whom the Software is
9
+ # furnished to do so, subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in all
12
+ # copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
17
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ # SOFTWARE.
21
+
22
+ args=$@
23
+
24
+ nohup bash -c 'while zold ${args}; do gem install zold; done'
data/lib/zold/amount.rb CHANGED
@@ -53,8 +53,8 @@ module Zold
53
53
  @coins
54
54
  end
55
55
 
56
- def to_zld
57
- format('%0.2f', @coins.to_f / 2**Amount::FRACTION)
56
+ def to_zld(digits = 2)
57
+ format("%0.#{digits}f", @coins.to_f / 2**Amount::FRACTION)
58
58
  end
59
59
 
60
60
  def to_s
data/lib/zold/version.rb CHANGED
@@ -23,5 +23,5 @@
23
23
  # Copyright:: Copyright (c) 2018 Yegor Bugayenko
24
24
  # License:: MIT
25
25
  module Zold
26
- VERSION = '0.10.23'.freeze
26
+ VERSION = '0.11'.freeze
27
27
  end
data/test/test_amount.rb CHANGED
@@ -35,6 +35,20 @@ class TestAmount < Minitest::Test
35
35
  )
36
36
  end
37
37
 
38
+ def test_prints_zld_with_many_digits
39
+ amount = Zold::Amount.new(zld: 0.12345678)
40
+ assert_equal('0.123', amount.to_zld(3))
41
+ assert_equal('0.1235', amount.to_zld(4))
42
+ assert_equal('0.12346', amount.to_zld(5))
43
+ assert_equal('0.123457', amount.to_zld(6))
44
+ end
45
+
46
+ def test_compares_with_zero
47
+ amount = Zold::Amount.new(zld: 0.00001)
48
+ assert(!amount.zero?)
49
+ assert(amount != Zold::Amount::ZERO)
50
+ end
51
+
38
52
  def test_parses_coins
39
53
  amount = Zold::Amount.new(coins: 900_000_000)
40
54
  assert(
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.23
4
+ version: '0.11'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
@@ -266,6 +266,7 @@ description: Non-blockchain cryptocurrency
266
266
  email: yegor256@gmail.com
267
267
  executables:
268
268
  - zold
269
+ - zold-nohup
269
270
  extensions: []
270
271
  extra_rdoc_files:
271
272
  - README.md
@@ -289,6 +290,7 @@ files:
289
290
  - Rakefile
290
291
  - appveyor.yml
291
292
  - bin/zold
293
+ - bin/zold-nohup
292
294
  - cucumber.yml
293
295
  - deploy.sh
294
296
  - features/cli.feature