zold 0.9.5 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c5ceb71c345cd90ff80e00029ac5a6d265c3bf3
4
- data.tar.gz: 318ed11fd7706413ccb09eb014dcd0d776b832bc
3
+ metadata.gz: 03f770700b197238978800aa6bb79d2b65dc973a
4
+ data.tar.gz: 0cc1fcc216c91280b4a79b5fcc37b2acb3b71129
5
5
  SHA512:
6
- metadata.gz: 20d3b4781583bc883c2390336dd6411f661545a71e97e3cfe6c2fa29053db2b9ce0867503416f614394f301ee4bf19ff4064f0b96a74328e141561070eb7c708
7
- data.tar.gz: 66ae4c87859accbedb9fafff33f25673df8bb265e6c3407b21cae730937254841ec4b7588db97aeb3da901fa3e08275962d4e313df9b2e80a46df74a3276f119
6
+ metadata.gz: 3aca2c11779ca1fee660873ff96d46ef63dc300461cdf0893be52fb169dbe517e1aae726ca36e70ba9b78cc17a6c6bd7a98b449daa1e5fd4f5a2b9c761df490e
7
+ data.tar.gz: 33cf35b1d960adfeee89236e51589305eff0f7c361c693b95a4c7f02380b657401c55ee436782781cc4b147cebf1edb0c32f620b46660f1a69af289ad96ebe8f
data/bin/zold CHANGED
@@ -145,7 +145,7 @@ Available options:"
145
145
  Zold::Fetch.new(wallets: wallets, remotes: remotes, copies: copies, log: log).run(args)
146
146
  when 'clean'
147
147
  require_relative '../lib/zold/commands/clean'
148
- Zold::Clean.new(copies: copies, log: log).run(args)
148
+ Zold::Clean.new(wallets: wallets, copies: copies, log: log).run(args)
149
149
  when 'diff'
150
150
  require_relative '../lib/zold/commands/diff'
151
151
  Zold::Diff.new(wallets: wallets, copies: copies, log: log).run(args)
@@ -161,7 +161,7 @@ Available options:"
161
161
  require_relative '../lib/zold/commands/merge'
162
162
  Zold::Merge.new(wallets: wallets, copies: copies, log: log).run(args)
163
163
  require_relative '../lib/zold/commands/clean'
164
- Zold::Clean.new(copies: copies, log: log).run(args)
164
+ Zold::Clean.new(wallets: wallets, copies: copies, log: log).run(args)
165
165
  when 'taxes'
166
166
  require_relative '../lib/zold/commands/taxes'
167
167
  Zold::Taxes.new(wallets: wallets, log: log).run(args)
@@ -36,7 +36,8 @@ require_relative '../copies'
36
36
  module Zold
37
37
  # CLEAN command
38
38
  class Clean
39
- def initialize(copies:, log: Log::Quiet.new)
39
+ def initialize(wallets:, copies:, log: Log::Quiet.new)
40
+ @wallets = wallets
40
41
  @copies = copies
41
42
  @log = log
42
43
  end
@@ -97,7 +97,7 @@ module Zold
97
97
  invoice = opts[:invoice]
98
98
  unless invoice.include?('@')
99
99
  require_relative 'invoice'
100
- invoice = Invoice.new(wallets: @wallets, log: @log).run(['invoice', invoice])
100
+ invoice = Invoice.new(wallets: wallets, log: @log).run(['invoice', invoice])
101
101
  end
102
102
  farm = Farm.new(invoice, log: @log)
103
103
  farm.start(
@@ -82,7 +82,7 @@ module Zold
82
82
  Push.new(
83
83
  wallets: @wallets, remotes: @remotes, log: @log
84
84
  ).run(['push'] + modified.map(&:to_s))
85
- Clean.new(copies: copies.root, log: @log).run(['clean', id.to_s])
85
+ Clean.new(wallets: @wallets, copies: copies.root, log: @log).run(['clean', id.to_s])
86
86
  modified
87
87
  end
88
88
  end
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.9.5'.freeze
26
+ VERSION = '0.9.6'.freeze
27
27
  end
@@ -19,8 +19,8 @@
19
19
  # SOFTWARE.
20
20
 
21
21
  require 'minitest/autorun'
22
- require 'tmpdir'
23
22
  require 'time'
23
+ require_relative '../fake_home'
24
24
  require_relative '../test__helper'
25
25
  require_relative '../../lib/zold/copies'
26
26
  require_relative '../../lib/zold/commands/clean'
@@ -31,12 +31,12 @@ require_relative '../../lib/zold/commands/clean'
31
31
  # License:: MIT
32
32
  class TestClean < Minitest::Test
33
33
  def test_cleans_copies
34
- Dir.mktmpdir 'test' do |dir|
35
- id = Zold::Id.new
36
- copies = Zold::Copies.new(File.join(dir, "copies/#{id}"))
34
+ FakeHome.new.run do |home|
35
+ wallet = home.create_wallet
36
+ copies = home.copies(wallet)
37
37
  copies.add('a1', 'host-1', 80, 1, Time.now - 26 * 60 * 60)
38
38
  copies.add('a2', 'host-2', 80, 2, Time.now - 26 * 60 * 60)
39
- Zold::Clean.new(copies: copies.root, log: $log).run(['clean', id.to_s])
39
+ Zold::Clean.new(wallets: home.wallets, copies: copies.root, log: $log).run(['clean', wallet.id.to_s])
40
40
  assert(copies.all.empty?)
41
41
  end
42
42
  end
@@ -19,10 +19,8 @@
19
19
  # SOFTWARE.
20
20
 
21
21
  require 'minitest/autorun'
22
- require 'tmpdir'
23
- require 'json'
24
- require 'time'
25
22
  require 'webmock/minitest'
23
+ require_relative '../fake_home'
26
24
  require_relative '../test__helper'
27
25
  require_relative '../../lib/zold/wallet'
28
26
  require_relative '../../lib/zold/wallets'
@@ -37,16 +35,11 @@ require_relative '../../lib/zold/commands/push'
37
35
  # License:: MIT
38
36
  class TestPush < Minitest::Test
39
37
  def test_pushes_wallet
40
- Dir.mktmpdir 'test' do |dir|
41
- id = Zold::Id.new
42
- wallets = Zold::Wallets.new(dir)
43
- wallet = wallets.find(id)
44
- wallet.init(id, Zold::Key.new(file: 'fixtures/id_rsa.pub'))
45
- remotes = Zold::Remotes.new(File.join(dir, 'remotes.csv'))
46
- remotes.clean
47
- stub_request(:put, "http://fake-1/wallet/#{id}").to_return(status: 304)
48
- Zold::Push.new(wallets: wallets, remotes: remotes, log: $log).run(
49
- ['--ignore-this-stupid-option', 'push', id.to_s]
38
+ FakeHome.new.run do |home|
39
+ wallet = home.create_wallet
40
+ stub_request(:put, "http://fake-1/wallet/#{wallet.id}").to_return(status: 304)
41
+ Zold::Push.new(wallets: home.wallets, remotes: home.remotes, log: $log).run(
42
+ ['--ignore-this-stupid-option', 'push', wallet.id.to_s]
50
43
  )
51
44
  end
52
45
  end
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.9.5
4
+ version: 0.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko