zold 0.18.0 → 0.18.1

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: 0ad2aeab01e066ea22a6fb9e5cd02c2d13a88e36f19e8ffc228c5f72d5b5bf1e
4
- data.tar.gz: f87c069877d7741c99a38ebfade27d41721f9347a996b6ef4640c899ebe558af
3
+ metadata.gz: 219994932a033cc330b4634c4a4d2345cc94ed3b1c5b0c9cbd30ec84ec09476c
4
+ data.tar.gz: b76b4323a3f3ba7f3c086c5efccca46d319fecaf82a16b5e66cbcb91f945ce40
5
5
  SHA512:
6
- metadata.gz: b47678bd890369fe2a3d09268c1f3ab35bb5e1707ae052353865c899334276b840099465e5a1be46537021e60a01891dafca7071b95a85ff8fe9fb90c02fcf9c
7
- data.tar.gz: 8769ceb3b043b1eb7fe0de15be8574ae1ff5f9191fadbe58daa6c1de25ca2768652faac9c636229d181ed0039352fffc75d5673b04de5c9f2ed953d009e2dd52
6
+ metadata.gz: 0140be60b68cdcd39da884f1eac46712a402168a6a6a0bb5738a6484d070130d7cab6843f6e1b5bf9f631a80a94a46dfcb838d387a7026de854fdd01633596ab
7
+ data.tar.gz: 2228eb60ffc8cbcbf9561e44c9d06b8a6aa102dd8441e9e03ed6f73a4a415f94c8651d6e58e2d8edbadf59659a93af0973e1143c220d6c80d2fdb60bd17d79c3
@@ -40,7 +40,8 @@ module Zold
40
40
  raise 'JSON is empty, can\'t parse' + (@uri.empty? ? '' : " at #{@uri}") if @text.empty?
41
41
  JSON.parse(@text)
42
42
  rescue JSON::ParserError => e
43
- raise "Failed to parse JSON #{@uri.empty? ? '' : "at #{@uri}"} (#{e.message}): #{@text.inspect}"
43
+ raise "Failed to parse JSON #{@uri.empty? ? '' : "at #{@uri}"} (#{e.message}): \
44
+ #{@text.inspect.gsub(/^.{200,}$/, '\1...')}"
44
45
  end
45
46
  end
46
47
  end
@@ -194,6 +194,7 @@ from #{request.ip} in #{Age.new(@start, limit: 1)}")
194
194
  get '/' do
195
195
  content_type('application/json')
196
196
  pretty(
197
+ repo: 'zold-io/zold',
197
198
  version: settings.opts['expose-version'],
198
199
  alias: settings.node_alias,
199
200
  network: settings.opts['network'],
data/lib/zold/remotes.rb CHANGED
@@ -103,7 +103,7 @@ module Zold
103
103
  end
104
104
 
105
105
  def assert_valid_score(score)
106
- raise "Invalid score #{score}" unless score.valid?
106
+ raise "Invalid score #{score.reduced(4)}" unless score.valid?
107
107
  raise "Expired score (#{Age.new(score.time)}) #{score.reduced(4)}" if score.expired?
108
108
  end
109
109
 
data/lib/zold/version.rb CHANGED
@@ -25,6 +25,6 @@
25
25
  # Copyright:: Copyright (c) 2018 Yegor Bugayenko
26
26
  # License:: MIT
27
27
  module Zold
28
- VERSION = '0.18.0'
28
+ VERSION = '0.18.1'
29
29
  PROTOCOL = 2
30
30
  end
@@ -61,6 +61,7 @@ class FrontTest < Zold::Test
61
61
  assert_equal(Zold::VERSION, json['version'])
62
62
  assert_equal(Zold::PROTOCOL, json['protocol'])
63
63
  assert_equal('foo', json['network'])
64
+ assert_equal('zold-io/zold', json['repo'])
64
65
  assert(json['pid'].positive?, json)
65
66
  assert(json['cpus'].positive?, json)
66
67
  assert(json['memory'].positive?, json)
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2018 Yegor Bugayenko
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the 'Software'), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
23
+ require 'minitest/autorun'
24
+ require_relative 'test__helper'
25
+ require_relative '../lib/zold/json_page'
26
+
27
+ # JsonPage test.
28
+ # Author:: Yegor Bugayenko (yegor256@gmail.com)
29
+ # Copyright:: Copyright (c) 2018 Yegor Bugayenko
30
+ # License:: MIT
31
+ class TestJsonPage < Zold::Test
32
+ def test_parses_json_page
33
+ assert_equal(1, Zold::JsonPage.new('{"x": 1}').to_hash['x'])
34
+ end
35
+
36
+ def test_parses_broken_json_page
37
+ assert_raises do
38
+ Zold::JsonPage.new('not json').to_hash
39
+ end
40
+ end
41
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.18.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-10 00:00:00.000000000 Z
11
+ date: 2018-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace
@@ -670,6 +670,7 @@ files:
670
670
  - test/test_hexnum.rb
671
671
  - test/test_http.rb
672
672
  - test/test_id.rb
673
+ - test/test_json_page.rb
673
674
  - test/test_key.rb
674
675
  - test/test_log.rb
675
676
  - test/test_metronome.rb
@@ -700,7 +701,7 @@ licenses:
700
701
  - MIT
701
702
  metadata: {}
702
703
  post_install_message: |-
703
- Thanks for installing Zold 0.18.0!
704
+ Thanks for installing Zold 0.18.1!
704
705
  Study our White Paper: https://papers.zold.io/wp.pdf
705
706
  Read our blog posts: https://blog.zold.io
706
707
  Try online wallet at: https://wts.zold.io
@@ -777,6 +778,7 @@ test_files:
777
778
  - test/test_hexnum.rb
778
779
  - test/test_http.rb
779
780
  - test/test_id.rb
781
+ - test/test_json_page.rb
780
782
  - test/test_key.rb
781
783
  - test/test_log.rb
782
784
  - test/test_metronome.rb