zold 0.1 → 0.1.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 +4 -4
- data/README.md +6 -0
- data/lib/zold/commands/fetch.rb +1 -1
- data/lib/zold/commands/remote.rb +22 -3
- data/lib/zold/http.rb +3 -1
- data/lib/zold/node/front.rb +10 -0
- data/lib/zold/remotes.rb +4 -0
- data/lib/zold/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45f2fb7dcf69ce479ef15281f2e2ac5e60347eac
|
4
|
+
data.tar.gz: f177e99ee0e5925fb55a8c151301bc6d0fdfffce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9444742027fab53cdbad0dbe72db8f0640c3e58a6b0c713e0f7e17dea39dc867cd9c44cdb0dfc4a695126a3ca3cd0dfa82cdf0629a560fc3f29c1dd1aec1fc48
|
7
|
+
data.tar.gz: 86ac46ae6fea92ea34f57a4d74ef06cbcffd7a807954ff4b74d16f541b76ac916b4222a760b1f588c63625d8aaeb5066a1b02ff3b1fb4626f8e0764579f187c3
|
data/README.md
CHANGED
@@ -37,6 +37,7 @@ Thus, the technical capacity of the currency is 549,755,813,888 ZLD (half a tril
|
|
37
37
|
Install Ruby 2.2+, [Rubygems](https://rubygems.org/pages/download), and then run:
|
38
38
|
|
39
39
|
```bash
|
40
|
+
$ sudo apt-get install ruby-dev rubygems zlib1g-dev
|
40
41
|
$ gem install zold
|
41
42
|
```
|
42
43
|
|
@@ -63,6 +64,11 @@ For more options and commands just run:
|
|
63
64
|
$ zold --help
|
64
65
|
```
|
65
66
|
|
67
|
+
You will need PGP keys in `~/.ssh`. To generate them, if you don't have them
|
68
|
+
yet, you can run:
|
69
|
+
|
70
|
+
|
71
|
+
|
66
72
|
## Glossary
|
67
73
|
|
68
74
|
**Node** is an HTTP server with a RESTful API, a maintainer of wallets
|
data/lib/zold/commands/fetch.rb
CHANGED
@@ -64,7 +64,7 @@ module Zold
|
|
64
64
|
@copies.add(json['body'], r[:host], r[:port], score.value)
|
65
65
|
@log.info(
|
66
66
|
"#{r[:host]}:#{r[:port]} #{json['body'].length}b/\
|
67
|
-
#{Rainbow(score.value).green}"
|
67
|
+
#{Rainbow(score.value).green} (v.#{json['version']})"
|
68
68
|
)
|
69
69
|
end
|
70
70
|
@log.debug("#{total} copies fetched, \
|
data/lib/zold/commands/remote.rb
CHANGED
@@ -75,7 +75,21 @@ module Zold
|
|
75
75
|
@log.debug("There are #{total} known remotes")
|
76
76
|
end
|
77
77
|
else
|
78
|
-
|
78
|
+
@log.info(
|
79
|
+
"Available commands:
|
80
|
+
#{Rainbow('remote show').green}
|
81
|
+
Show all registered remote nodes
|
82
|
+
#{Rainbow('remote clean').green}
|
83
|
+
Remove all registered remote nodes
|
84
|
+
#{Rainbow('remote reset').green}
|
85
|
+
Restore it back to the default list of nodes
|
86
|
+
#{Rainbow('remote add').green} host port
|
87
|
+
Add a new remote node
|
88
|
+
#{Rainbow('remote remove').green} host port
|
89
|
+
Remove the remote node
|
90
|
+
#{Rainbow('remote update').green}
|
91
|
+
Check each registered remote node for availability"
|
92
|
+
)
|
79
93
|
end
|
80
94
|
end
|
81
95
|
|
@@ -107,8 +121,13 @@ module Zold
|
|
107
121
|
next
|
108
122
|
end
|
109
123
|
@remotes.rescore(r[:host], r[:port], score.value)
|
110
|
-
json['all'].each
|
111
|
-
|
124
|
+
json['all'].each do |s|
|
125
|
+
unless @remotes.exists?(s['host'], s['port'])
|
126
|
+
run(['add', s['host'], s['port']])
|
127
|
+
end
|
128
|
+
end
|
129
|
+
@log.info("#{r[:host]}:#{r[:port]}: #{Rainbow(score.value).green} \
|
130
|
+
(v.#{json['version']})")
|
112
131
|
end
|
113
132
|
end
|
114
133
|
end
|
data/lib/zold/http.rb
CHANGED
data/lib/zold/node/front.rb
CHANGED
@@ -45,6 +45,7 @@ module Zold
|
|
45
45
|
# Web front
|
46
46
|
class Front < Sinatra::Base
|
47
47
|
configure do
|
48
|
+
set :bind, '0.0.0.0'
|
48
49
|
set :logging, true
|
49
50
|
set :start, Time.now
|
50
51
|
set :lock, Mutex.new
|
@@ -63,6 +64,11 @@ module Zold
|
|
63
64
|
end
|
64
65
|
end
|
65
66
|
|
67
|
+
after do
|
68
|
+
headers['Cache-Control'] = 'no-cache'
|
69
|
+
headers['X-Zold-Version'] = VERSION
|
70
|
+
end
|
71
|
+
|
66
72
|
get '/robots.txt' do
|
67
73
|
'User-agent: *'
|
68
74
|
end
|
@@ -84,6 +90,9 @@ module Zold
|
|
84
90
|
processors: Facter.value(:processors)['count'],
|
85
91
|
memory: Facter::Memory.mem_size
|
86
92
|
},
|
93
|
+
wallets: {
|
94
|
+
total: wallets.all.count
|
95
|
+
},
|
87
96
|
date: `date --iso-8601=seconds -u`.strip,
|
88
97
|
age: Time.now - settings.start,
|
89
98
|
home: 'https://www.zold.io'
|
@@ -114,6 +123,7 @@ module Zold
|
|
114
123
|
get '/remotes' do
|
115
124
|
content_type 'application/json'
|
116
125
|
JSON.pretty_generate(
|
126
|
+
version: VERSION,
|
117
127
|
score: score.to_h,
|
118
128
|
all: remotes.all.map do |r|
|
119
129
|
{
|
data/lib/zold/remotes.rb
CHANGED
data/lib/zold/version.rb
CHANGED