zold 0.11.1 → 0.11.2
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/INSTALL.md +8 -0
- data/Rakefile +1 -1
- data/bin/zold-nohup +42 -6
- data/features/cli.feature +2 -1
- data/features/step_definitions/steps.rb +3 -2
- data/lib/zold/commands/merge.rb +1 -1
- data/lib/zold/commands/remote.rb +2 -1
- 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: c5af52af45ba9dfdd220e85af79232f92b919255
|
4
|
+
data.tar.gz: '0880267133e607466adbadaa5d12ce8361ea7ab5'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f94d22443de183a1b6e2be4cabe0880384efd1941adbf082b865f5cabe91d735def081a18a045550fea718a8e8bebe34dc51778c55702e62137bcea147c10d0e
|
7
|
+
data.tar.gz: ccfcbbbc989f51cf00def91844f12ba763c66e9144990db8a43fddf17d7dac0a9c6b6391612cdb5bddf7a5938a441caa4d4e3ba1891bb4906d2b70a230d51e6c
|
data/INSTALL.md
CHANGED
@@ -10,6 +10,14 @@ install [Ruby 2.3+](https://www.ruby-lang.org/en/documentation/installation/),
|
|
10
10
|
[Rubygems](https://rubygems.org/pages/download), and
|
11
11
|
then the [gem](https://rubygems.org/gems/zold).
|
12
12
|
|
13
|
+
## Debian 9.4
|
14
|
+
|
15
|
+
```bash
|
16
|
+
$ sudo apt update -y
|
17
|
+
$ sudo apt install -y ruby-dev rubygems zlib1g-dev libssl-dev make
|
18
|
+
$ gem install zold
|
19
|
+
```
|
20
|
+
|
13
21
|
## Ubuntu 16.04
|
14
22
|
|
15
23
|
```bash
|
data/Rakefile
CHANGED
@@ -61,7 +61,7 @@ end
|
|
61
61
|
|
62
62
|
require 'cucumber/rake/task'
|
63
63
|
Cucumber::Rake::Task.new(:features) do |t|
|
64
|
-
t.cucumber_opts = 'features --format
|
64
|
+
t.cucumber_opts = 'features --format pretty'
|
65
65
|
Rake::Cleaner.cleanup_files(['coverage'])
|
66
66
|
end
|
67
67
|
Cucumber::Rake::Task.new(:'features:html') do |t|
|
data/bin/zold-nohup
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# encoding: utf-8
|
3
2
|
#
|
4
3
|
# Copyright (c) 2018 Yegor Bugayenko
|
5
4
|
#
|
@@ -21,10 +20,47 @@
|
|
21
20
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
21
|
# SOFTWARE.
|
23
22
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
STDOUT.sync = true
|
24
|
+
|
25
|
+
require 'slop'
|
26
|
+
require 'tempfile'
|
27
|
+
require 'open3'
|
28
|
+
|
29
|
+
$opts = Slop.parse(ARGV, strict: false, suppress_errors: true) do |o|
|
30
|
+
o.string '--log-file', 'The file to save logs into', default: 'zold-node.log'
|
31
|
+
o.bool '--skip-install', 'Don\'t re-install Zold gem', default: false
|
32
|
+
end
|
33
|
+
|
34
|
+
def log(line)
|
35
|
+
File.open($opts['log-file'], 'a') { |f| f.print(line) }
|
36
|
+
end
|
37
|
+
|
38
|
+
def exec(cmd)
|
39
|
+
Open3.popen2e(cmd) do |stdin, stdout, thr|
|
40
|
+
stdin.close
|
41
|
+
loop do
|
42
|
+
line = stdout.gets
|
43
|
+
break if line.nil?
|
44
|
+
log(line)
|
45
|
+
end
|
46
|
+
code = thr.value.exitstatus
|
47
|
+
raise "Exit code #{code} (non zero)" unless code.zero?
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
$pid = fork do
|
52
|
+
Signal.trap('HUP') do
|
53
|
+
print('Received HUP, ignoring...')
|
54
|
+
end
|
55
|
+
Signal.trap('TERM') do
|
56
|
+
print('Received TERM, terminating...')
|
57
|
+
exit(-1)
|
58
|
+
end
|
59
|
+
loop do
|
60
|
+
exec("zold #{$opts.arguments.join(' ')}")
|
61
|
+
exec('gem install zold') unless $opts['skip-install']
|
62
|
+
end
|
28
63
|
end
|
64
|
+
Process.detach($pid)
|
29
65
|
|
30
|
-
|
66
|
+
puts($pid)
|
data/features/cli.feature
CHANGED
@@ -16,5 +16,6 @@ Feature: Command Line Processing
|
|
16
16
|
Then Exit code is zero
|
17
17
|
|
18
18
|
Scenario: Failure through nohup
|
19
|
-
When I run bin/zold-nohup with "badcommand --skip-install"
|
19
|
+
When I run bin/zold-nohup with "badcommand --skip-install --log-file=log.txt; sleep 2; cat log.txt"
|
20
|
+
And Stdout contains "Command 'badcommand' is not supported"
|
20
21
|
Then Exit code is zero
|
@@ -39,13 +39,14 @@ end
|
|
39
39
|
|
40
40
|
When(%r{^I run ([a-z/-]+) with "([^"]*)"$}) do |cmd, args|
|
41
41
|
home = File.join(File.dirname(__FILE__), '../..')
|
42
|
-
@stdout = `ruby -I#{home}/lib #{home}/#{cmd} #{args}`
|
42
|
+
@stdout = `ruby -I#{home}/lib #{home}/#{cmd} #{args} 2>&1`
|
43
43
|
@exitstatus = $CHILD_STATUS.exitstatus
|
44
44
|
end
|
45
45
|
|
46
46
|
When(/^I run bash with:$/) do |text|
|
47
47
|
FileUtils.copy_entry(@cwd, File.join(@dir, 'zold'))
|
48
|
-
|
48
|
+
File.write('run.sh', text)
|
49
|
+
@stdout = `/bin/bash run.sh 2>&1`
|
49
50
|
@exitstatus = $CHILD_STATUS.exitstatus
|
50
51
|
end
|
51
52
|
|
data/lib/zold/commands/merge.rb
CHANGED
@@ -62,7 +62,7 @@ Available options:"
|
|
62
62
|
private
|
63
63
|
|
64
64
|
def merge(wallet, cps, _)
|
65
|
-
raise
|
65
|
+
raise "There are no remote copies of #{wallet.id}, try FETCH first" if cps.all.empty?
|
66
66
|
cps = cps.all.sort_by { |c| c[:score] }.reverse
|
67
67
|
patch = Patch.new
|
68
68
|
main = Wallet.new(cps[0][:path])
|
data/lib/zold/commands/remote.rb
CHANGED
@@ -148,7 +148,8 @@ Available options:"
|
|
148
148
|
raise "Masqueraded as #{score.host}:#{score.port}" if r.host != score.host || r.port != score.port
|
149
149
|
@remotes.rescore(score.host, score.port, score.value)
|
150
150
|
if opts['reboot'] && Semantic::Version.new(VERSION) < Semantic::Version.new(json['version'])
|
151
|
-
@log.info("#{r}: their version #{json['version']} is higher than mine #{VERSION}, reboot!
|
151
|
+
@log.info("#{r}: their version #{json['version']} is higher than mine #{VERSION}, reboot! \
|
152
|
+
(use --never-reboot to avoid this from happening)")
|
152
153
|
exit(0)
|
153
154
|
end
|
154
155
|
if deep
|
data/lib/zold/version.rb
CHANGED