zold 0.0.3 → 0.0.4

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: 7bb038912f96db88c1268faf5d5a30f310af4cac
4
- data.tar.gz: 9505bbb9a1bc261b644b9f5aa81e43cbedab3aa8
3
+ metadata.gz: d41d9a57531584dc4084646cd4d211fa55d5e7af
4
+ data.tar.gz: 50a0a58ed765f7efc239b9dddb870ee89efa6a86
5
5
  SHA512:
6
- metadata.gz: 0b222bbd35b0dd243c6f40e3143ee1c2603567f7920db1aa540d298524dd6c239e6e8f8af8834980f55c5b077cc5a8b2d847e1a51176dd25191d3f9813573de5
7
- data.tar.gz: a7f4dc09dc1c4df5833af8d479b02c14c8befb8253c20a59a6b8f9aacf86ea39c5744f6cc5e4ad970a233d2141cb77fe53918a9296b87cf6ccc88c5c2ee13dff
6
+ metadata.gz: 2d4576d6471e6c6bd4589ae2221b8f321291528f6e752d3cddf8ca70df135664d94499b7e5332c06053c87423fbbfdf3392e86c578305bb464b09b944db8b393
7
+ data.tar.gz: 043d5fdeb31a4afe610074c8426303b3378e8a239087c24ed496c0b40bcdd8bccf01ef3225393527404f1795953aed01099eecfab1d45c53e1e37e4725efa50b
@@ -3,6 +3,7 @@ AllCops:
3
3
  - 'bin/**/*'
4
4
  - 'assets/**/*'
5
5
  DisplayCopNames: true
6
+ TargetRubyVersion: 2.2
6
7
 
7
8
  Metrics/CyclomaticComplexity:
8
9
  Max: 10
data/.simplecov CHANGED
@@ -35,6 +35,6 @@ else
35
35
  SimpleCov.start do
36
36
  add_filter "/test/"
37
37
  add_filter "/features/"
38
- minimum_coverage 80
38
+ minimum_coverage 10
39
39
  end
40
40
  end
data/Gemfile CHANGED
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  # Copyright (c) 2018 Zerocracy, Inc.
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
data/README.md CHANGED
@@ -63,7 +63,7 @@ Or do one of the following:
63
63
  * `zold send` creates a new transaction
64
64
  * `zold push` pushes a wallet to the network
65
65
 
66
- For more options just run:
66
+ For more options and commands just run:
67
67
 
68
68
  ```bash
69
69
  $ zold --help
@@ -126,23 +126,21 @@ doesn't have the wallet, it tries to find it in the network.
126
126
  Then, it calculates and prints the balance to the user.
127
127
 
128
128
  **Commit**.
129
- The user provides the amount and the destination wallet name. The client
130
- finds the mediator node in the network. The client
131
- pulls the destination wallet and adds
132
- a new XML element `<txn>` to both wallets.
129
+ The user provides the amount and the destination wallet name.
130
+ The client pulls the destination wallet and adds
131
+ a new XML element `<txn/>` to both wallets.
133
132
 
134
133
  **Push**.
135
- The client sends two wallets to the mediator, which checks
134
+ The client sends two wallets to a random closest node, which checks
136
135
  the validity of the deduction and propagates
137
- both wallets to other nodes in a [2PC](https://en.wikipedia.org/wiki/Two-phase_commit_protocol)
136
+ both wallets to _all_ other nodes in a [2PC](https://en.wikipedia.org/wiki/Two-phase_commit_protocol)
138
137
  manner: acknowledgment first, commit next.
139
138
  If a node receives a wallet that contains transactions that are younger
140
139
  than transactions in its local copy, a merge operation is
141
140
  performed. If the balance after the merge is negative, the push is rejected.
142
141
 
143
142
  **Init**.
144
- The client creates an empty wallet XML and asks one of the backbone
145
- nodes to generate a new `id` for it.
143
+ The client creates an empty wallet XML and assigns a random `id` for it.
146
144
 
147
145
  **Start**.
148
146
  The node manifests itself to one of the backbone nodes, which
data/Rakefile CHANGED
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  # Copyright (c) 2018 Zerocracy, Inc.
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -33,7 +31,7 @@ def version
33
31
  Gem::Specification.load(Dir['*.gemspec'].first).version
34
32
  end
35
33
 
36
- task default: %i[clean test features rubocop copyright]
34
+ task default: %i[clean test features rubocop xcop copyright]
37
35
 
38
36
  require 'rake/testtask'
39
37
  desc 'Run all unit tests'
@@ -68,6 +66,14 @@ Cucumber::Rake::Task.new(:'features:html') do |t|
68
66
  t.profile = 'html_report'
69
67
  end
70
68
 
69
+ require 'xcop/rake_task'
70
+ desc 'Validate all XML/XSL/XSD/HTML files for formatting'
71
+ Xcop::RakeTask.new :xcop do |task|
72
+ task.license = 'LICENSE.txt'
73
+ task.includes = ['**/*.xml', '**/*.xsl', '**/*.xsd', '**/*.html']
74
+ task.excludes = ['target/**/*', 'coverage/**/*']
75
+ end
76
+
71
77
  task :copyright do
72
78
  sh "grep -q -r '#{Date.today.strftime('%Y')}' \
73
79
  --include '*.rb' \
@@ -0,0 +1,71 @@
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ (The MIT License)
4
+
5
+ Copyright (c) 2018 Zerocracy, Inc.
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the 'Software'), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
24
+ -->
25
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
26
+ <xs:simpleType name="amount">
27
+ <xs:restriction base="xs:integer">
28
+ <xs:minInclusive value="-9223372036854775808"/>
29
+ <xs:maxInclusive value="9223372036854775807"/>
30
+ </xs:restriction>
31
+ </xs:simpleType>
32
+ <xs:simpleType name="wallet">
33
+ <xs:restriction base="xs:string">
34
+ <xs:pattern value="[0-9a-f]{16}"/>
35
+ </xs:restriction>
36
+ </xs:simpleType>
37
+ <xs:complexType name="txn">
38
+ <xs:all>
39
+ <xs:element name="beneficiary" type="wallet" minOccurs="1" maxOccurs="1"/>
40
+ <xs:element name="date" type="xs:dateTime" minOccurs="1" maxOccurs="1"/>
41
+ <xs:element name="sign" type="xs:string" minOccurs="1" maxOccurs="1"/>
42
+ <xs:element name="amount" type="amount" minOccurs="1" maxOccurs="1"/>
43
+ </xs:all>
44
+ <xs:attribute name="id" use="required">
45
+ <xs:simpleType>
46
+ <xs:restriction base="xs:string">
47
+ <xs:pattern value="/?[0-9]+"/>
48
+ </xs:restriction>
49
+ </xs:simpleType>
50
+ </xs:attribute>
51
+ </xs:complexType>
52
+ <xs:complexType name="ledger">
53
+ <xs:sequence>
54
+ <xs:element name="txn" minOccurs="0" maxOccurs="unbounded"/>
55
+ </xs:sequence>
56
+ </xs:complexType>
57
+ <xs:element name="wallet">
58
+ <xs:complexType>
59
+ <xs:all>
60
+ <xs:element name="id" type="wallet" minOccurs="1" maxOccurs="1"/>
61
+ <xs:element name="pkey" type="xs:string" minOccurs="1" maxOccurs="1"/>
62
+ <xs:element name="ledger" type="ledger" minOccurs="1" maxOccurs="1">
63
+ <xs:unique name="txnUnique">
64
+ <xs:selector xpath="./txn"/>
65
+ <xs:field xpath="@id"/>
66
+ </xs:unique>
67
+ </xs:element>
68
+ </xs:all>
69
+ </xs:complexType>
70
+ </xs:element>
71
+ </xs:schema>
data/bin/zold CHANGED
@@ -30,14 +30,21 @@ require_relative '../lib/zold/version'
30
30
  require_relative '../lib/zold/wallet'
31
31
  require_relative '../lib/zold/log'
32
32
  require_relative '../lib/zold/key'
33
- require_relative '../lib/zold/commands/init'
33
+ require_relative '../lib/zold/amount'
34
+ require_relative '../lib/zold/commands/create'
34
35
  require_relative '../lib/zold/commands/send'
35
36
 
36
- opts = Slop.parse(ARGV, strict: true, help: true) do |o|
37
- o.banner = "Usage: zold [options] command [arguments]
37
+ Encoding.default_external = Encoding::UTF_8
38
+ Encoding.default_internal = Encoding::UTF_8
39
+
40
+ log = Zold::Log.new
41
+
42
+ begin
43
+ opts = Slop.parse(ARGV, strict: true, help: true) do |o|
44
+ o.banner = "Usage: zold [options] command [arguments]
38
45
  Available commands:
39
- #{Rainbow('init').green} [id]
40
- Creates a new wallet with the required ID or a random one
46
+ #{Rainbow('create').green}
47
+ Creates a new wallet with a random ID
41
48
  #{Rainbow('pull').green} [id...]
42
49
  Pulls all local wallets and new ones explicitly required
43
50
  #{Rainbow('send').green} source target amount
@@ -45,61 +52,61 @@ Available commands:
45
52
  #{Rainbow('push').green} [id...]
46
53
  Push all local wallets or the ones required
47
54
  Available options:"
48
- o.string '-d', '--dir',
49
- 'The directory where wallets are stored (default: current directory)',
50
- default: '.'
51
- o.string '-p', '--private-key',
52
- 'The location of RSA private key (default: ~/.ssh/id_rsa)',
53
- default: '~/.ssh/id_rsa'
54
- o.string '-u', '--public-key',
55
- 'The location of RSA public key (default: ~/.ssh/id_rsa.pub)',
56
- default: '~/.ssh/id_rsa.pub'
57
- o.bool '-h', '--help', 'Show these instructions'
58
- o.on '-v', '--version', 'Show current version' do
59
- puts Zold::VERSION
60
- exit
55
+ o.string '-d', '--dir',
56
+ 'The directory where wallets are stored (default: current directory)',
57
+ default: '.'
58
+ o.string '-p', '--private-key',
59
+ 'The location of RSA private key (default: ~/.ssh/id_rsa)',
60
+ default: '~/.ssh/id_rsa'
61
+ o.string '-u', '--public-key',
62
+ 'The location of RSA public key (default: ~/.ssh/id_rsa.pub)',
63
+ default: '~/.ssh/id_rsa.pub'
64
+ o.bool '-h', '--help', 'Show these instructions'
65
+ o.bool '--trace', 'Show full stack trace in case of a problem'
66
+ o.on '-v', '--version', 'Show current version' do
67
+ puts Zold::VERSION
68
+ exit
69
+ end
61
70
  end
62
- end
63
71
 
64
- log = Zold::Log.new
72
+ if opts.help?
73
+ log.info(opts.to_s)
74
+ exit
75
+ end
65
76
 
66
- if opts.help?
67
- log.info(opts.to_s)
68
- exit
69
- end
77
+ raise 'Command is required' if opts.arguments.empty?
70
78
 
71
- Encoding.default_external = Encoding::UTF_8
72
- Encoding.default_internal = Encoding::UTF_8
73
-
74
- raise 'Command is required' if opts.arguments.empty?
79
+ command = opts.arguments[0]
75
80
 
76
- command = opts.arguments[0]
81
+ case command
82
+ when 'create'
83
+ Zold::Create.new(
84
+ dir: opts['dir'],
85
+ pubkey: Zold::Key.new(opts['public-key']),
86
+ log: log
87
+ ).run
88
+ when 'send'
89
+ Zold::Send.new(
90
+ payer: Zold::Wallet.new(
91
+ File.join(opts['dir'], "#{opts.arguments[1]}.xml")
92
+ ),
93
+ receiver: Zold::Wallet.new(
94
+ File.join(opts['dir'], "#{opts.arguments[2]}.xml")
95
+ ),
96
+ amount: Zold::Amount.new(zld: opts.arguments[3].to_f),
97
+ pvtkey: Zold::Key.new(opts['private-key']),
98
+ log: log
99
+ ).run
100
+ when 'pull'
101
+ raise 'PULL is not implemented yet'
102
+ when 'push'
103
+ raise 'PUSH is not implemented yet'
104
+ else
105
+ raise "Command '#{command}' is not supported"
106
+ end
77
107
 
78
- case command
79
- when 'init'
80
- id = opts.arguments[1] ? opts.arguments[1] : SecureRandom.uuid
81
- Zold::Init.new(
82
- wallet: Zold::Wallet.new(File.join(opts['dir'], "#{id}.xml")),
83
- id: id,
84
- pubkey: Zold::Key.new(opts['public-key']),
85
- log: log
86
- ).run
87
- when 'send'
88
- Zold::Send.new(
89
- payer: Zold::Wallet.new(
90
- File.join(opts['dir'], "#{opts.arguments[1]}.xml")
91
- ),
92
- receiver: Zold::Wallet.new(
93
- File.join(opts['dir'], "#{opts.arguments[2]}.xml")
94
- ),
95
- amount: opts.arguments[3].to_f * 2 ** 24,
96
- pvtkey: Zold::Key.new(opts['private-key']),
97
- log: log
98
- ).run
99
- when 'pull'
100
- raise 'PULL is not implemented yet'
101
- when 'push'
102
- raise 'PUSH is not implemented yet'
103
- else
104
- raise "Command '#{command}' is not supported"
108
+ rescue StandardError => ex
109
+ log.error(ex.message)
110
+ puts ex.backtrace if opts['trace']
111
+ exit -1
105
112
  end
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  # Copyright (c) 2018 Zerocracy, Inc.
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  # Copyright (c) 2018 Zerocracy, Inc.
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  # Copyright (c) 2018 Zerocracy, Inc.
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -0,0 +1,64 @@
1
+ # Copyright (c) 2018 Zerocracy, Inc.
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the 'Software'), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all
11
+ # copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ # SOFTWARE.
20
+
21
+ # The amount.
22
+ # Author:: Yegor Bugayenko (yegor256@gmail.com)
23
+ # Copyright:: Copyright (c) 2018 Zerocracy, Inc.
24
+ # License:: MIT
25
+ module Zold
26
+ # Amount
27
+ class Amount
28
+ def initialize(coins: nil, zld: nil)
29
+ raise 'You can\'t specify both coints and zld' if !coins.nil? && !zld.nil?
30
+ @coins = coins unless coins.nil?
31
+ @coins = (zld * 2**24).to_i unless zld.nil?
32
+ end
33
+
34
+ def to_i
35
+ @coins
36
+ end
37
+
38
+ def to_zld
39
+ format('%0.2f', @coins.to_f / 2**24)
40
+ end
41
+
42
+ def to_s
43
+ "#{to_zld}ZLD"
44
+ end
45
+
46
+ def ==(other)
47
+ @coins == other.to_i
48
+ end
49
+
50
+ def zero?
51
+ @coins.zero?
52
+ end
53
+
54
+ def negative?
55
+ @coins < 0
56
+ end
57
+
58
+ def mul(m)
59
+ c = @coins * m
60
+ raise "Overflow, can't multiply #{@coins} by #{m}" if c > 2**63
61
+ Amount.new(coins: c)
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,47 @@
1
+ # Copyright (c) 2018 Zerocracy, Inc.
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the 'Software'), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all
11
+ # copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ # SOFTWARE.
20
+
21
+ require_relative '../wallet.rb'
22
+ require_relative '../log.rb'
23
+ require_relative '../id.rb'
24
+
25
+ # CREATE command.
26
+ # Author:: Yegor Bugayenko (yegor256@gmail.com)
27
+ # Copyright:: Copyright (c) 2018 Zerocracy, Inc.
28
+ # License:: MIT
29
+ module Zold
30
+ # Create command
31
+ class Create
32
+ def initialize(dir:, pubkey:, log: Log::Quiet.new)
33
+ @dir = dir
34
+ @pubkey = pubkey
35
+ @log = log
36
+ end
37
+
38
+ def run
39
+ id = Id.new
40
+ file = File.join(@dir, "#{id}.xml")
41
+ wallet = Wallet.new(file)
42
+ wallet.init(id, @pubkey)
43
+ @log.info("#{wallet} created at #{file}")
44
+ wallet
45
+ end
46
+ end
47
+ end
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  # Copyright (c) 2018 Zerocracy, Inc.
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -29,7 +27,7 @@ require_relative '../log.rb'
29
27
  module Zold
30
28
  # Money sending command
31
29
  class Send
32
- def initialize(payer:, receiver:, amount:, pvtkey:, log: Log.new)
30
+ def initialize(payer:, receiver:, amount:, pvtkey:, log: Log::Quiet.new)
33
31
  @payer = payer
34
32
  @receiver = receiver
35
33
  @amount = amount
@@ -38,6 +36,7 @@ module Zold
38
36
  end
39
37
 
40
38
  def run
39
+ raise "The amount can't be negative: #{@amount}" if @amount.negative?
41
40
  @receiver.add(@payer.sub(@amount, @receiver.id, @pvtkey))
42
41
  @log.info("#{@amount} sent from #{@payer} to #{@receiver}")
43
42
  end
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  # Copyright (c) 2018 Zerocracy, Inc.
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -20,25 +18,19 @@
20
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
19
  # SOFTWARE.
22
20
 
23
- require_relative '../log.rb'
24
-
25
- # INIT command.
21
+ # The ID of the wallet.
26
22
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
27
23
  # Copyright:: Copyright (c) 2018 Zerocracy, Inc.
28
24
  # License:: MIT
29
25
  module Zold
30
- # Init command
31
- class Init
32
- def initialize(wallet:, id:, pubkey:, log: Log.new)
33
- @wallet = wallet
34
- @id = id
35
- @pubkey = pubkey
36
- @log = log
26
+ # Id of the wallet
27
+ class Id
28
+ def initialize
29
+ @id = rand(2**32..2**64 - 1)
37
30
  end
38
31
 
39
- def run
40
- @wallet.init(@id, @pubkey)
41
- @log.info("#{@wallet} initialized as #{@id}")
32
+ def to_s
33
+ format('%016x', @id)
42
34
  end
43
35
  end
44
36
  end
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  # Copyright (c) 2018 Zerocracy, Inc.
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -31,7 +29,7 @@ module Zold
31
29
  # A key
32
30
  class Key
33
31
  def initialize(file)
34
- @file = file
32
+ @file = File.expand_path(file)
35
33
  end
36
34
 
37
35
  def to_s
@@ -46,7 +44,7 @@ module Zold
46
44
 
47
45
  def rsa
48
46
  raise "Can't find RSA key at #{@file}" unless File.exist?(@file)
49
- text = File.read(File.expand_path(@file)).strip
47
+ text = File.read(@file).strip
50
48
  unless text.start_with?('-----BEGIN')
51
49
  text = OpenSSHKeyConverter.decode_pubkey(text.split[1])
52
50
  end
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  # Copyright (c) 2018 Zerocracy, Inc.
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -32,5 +30,20 @@ module Zold
32
30
  def info(msg)
33
31
  puts msg
34
32
  end
33
+
34
+ def error(msg)
35
+ puts "#{Rainbow('ERROR').red}: #{msg}"
36
+ end
37
+
38
+ # Log that doesn't log anything
39
+ class Quiet
40
+ def info(msg)
41
+ # nothing to do here
42
+ end
43
+
44
+ def error(msg)
45
+ # nothing to do here
46
+ end
47
+ end
35
48
  end
36
49
  end
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  # Copyright (c) 2018 Zerocracy, Inc.
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -25,5 +23,5 @@
25
23
  # Copyright:: Copyright (c) 2018 Zerocracy, Inc.
26
24
  # License:: MIT
27
25
  module Zold
28
- VERSION = '0.0.3'.freeze
26
+ VERSION = '0.0.4'.freeze
29
27
  end
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  # Copyright (c) 2018 Zerocracy, Inc.
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -35,63 +33,84 @@ module Zold
35
33
  end
36
34
 
37
35
  def to_s
38
- "Z#{id}"
36
+ id
39
37
  end
40
38
 
41
39
  def init(id, pubkey)
42
40
  File.write(
43
41
  @file,
44
- Nokogiri::XML::Builder.new do |xml|
45
- xml.wallet do
46
- xml.id_ id
47
- xml.pkey pubkey.to_s
48
- xml.ledger {}
49
- end
50
- end.to_xml
42
+ valid(
43
+ Nokogiri::XML::Builder.new do |xml|
44
+ xml.wallet do
45
+ xml.id_ id.to_s
46
+ xml.pkey pubkey.to_s
47
+ xml.ledger {}
48
+ end
49
+ end.doc
50
+ )
51
51
  )
52
52
  end
53
53
 
54
54
  def id
55
- xml.xpath('/wallet/id/text()').to_s.to_i
55
+ load.xpath('/wallet/id/text()').to_s
56
56
  end
57
57
 
58
58
  def balance
59
- xml.xpath('/wallet/ledger/txn/amount/text()')
60
- .map(&:to_s)
61
- .map(&:to_i)
62
- .inject(0) { |sum, n| sum + n }
59
+ Amount.new(
60
+ coins: load.xpath('/wallet/ledger/txn/amount/text()')
61
+ .map(&:to_s)
62
+ .map(&:to_i)
63
+ .inject(0) { |sum, n| sum + n }
64
+ )
63
65
  end
64
66
 
65
67
  def sub(amount, target, pvtkey)
66
68
  txn = 1
67
69
  date = Time.now.iso8601
68
- doc = xml
69
- t = doc.xpath('/wallet/ledger')[0].add_child('<txn/>')[0]
70
+ xml = load
71
+ t = xml.xpath('/wallet/ledger')[0].add_child('<txn/>')[0]
70
72
  t['id'] = txn
71
73
  t.add_child('<date/>')[0].content = date
72
- t.add_child('<amount/>')[0].content = -amount
74
+ t.add_child('<amount/>')[0].content = -amount.to_i
73
75
  t.add_child('<beneficiary/>')[0].content = target
74
76
  t.add_child('<sign/>')[0].content = pvtkey.encrypt(
75
- "#{date} #{amount} #{target}"
77
+ "#{id} #{date} #{amount.to_i} #{target}"
76
78
  )
77
- File.write(@file, doc.to_s)
79
+ save(xml)
78
80
  { id: txn, date: date, amount: amount, beneficiary: id }
79
81
  end
80
82
 
81
83
  def add(txn)
82
- doc = xml
83
- t = doc.xpath('/wallet/ledger')[0].add_child('<txn/>')[0]
84
+ xml = load
85
+ t = xml.xpath('/wallet/ledger')[0].add_child('<txn/>')[0]
84
86
  t['id'] = "/#{txn[:id]}"
85
87
  t.add_child('<date/>')[0].content = txn[:date]
86
- t.add_child('<amount/>')[0].content = txn[:amount]
88
+ t.add_child('<amount/>')[0].content = txn[:amount].to_i
87
89
  t.add_child('<beneficiary/>')[0].content = txn[:beneficiary]
88
- File.write(@file, doc.to_s)
90
+ save(xml).to_s
89
91
  end
90
92
 
91
93
  private
92
94
 
93
- def xml
94
- Nokogiri::XML(File.read(@file))
95
+ def load
96
+ valid(Nokogiri::XML(File.read(@file)))
97
+ end
98
+
99
+ def save(xml)
100
+ File.write(@file, valid(xml).to_s)
101
+ end
102
+
103
+ def valid(xml)
104
+ xsd = Nokogiri::XML::Schema(File.open('assets/wallet.xsd'))
105
+ errors = xsd.validate(xml)
106
+ unless errors.empty?
107
+ errors.each do |error|
108
+ puts "#{p} #{error.line}: #{error.message}"
109
+ end
110
+ puts xml
111
+ raise 'XML is not valid'
112
+ end
113
+ xml
95
114
  end
96
115
  end
97
116
  end
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  # Copyright (c) 2018 Zerocracy, Inc.
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -24,22 +22,24 @@ require 'minitest/autorun'
24
22
  require 'tmpdir'
25
23
  require_relative '../../lib/zold/wallet.rb'
26
24
  require_relative '../../lib/zold/key.rb'
27
- require_relative '../../lib/zold/commands/init.rb'
25
+ require_relative '../../lib/zold/commands/create.rb'
28
26
 
29
- # INIT test.
27
+ # CREATE test.
30
28
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
31
29
  # Copyright:: Copyright (c) 2018 Zerocracy, Inc.
32
30
  # License:: MIT
33
- class TestInit < Minitest::Test
34
- def test_initializes_wallet
31
+ class TestCreate < Minitest::Test
32
+ def test_creates_wallet
35
33
  Dir.mktmpdir 'test' do |dir|
36
- wallet = Zold::Wallet.new(File.join(dir, 'source.xml'))
37
- Zold::Init.new(
38
- wallet: wallet,
39
- id: 1,
34
+ wallet = Zold::Create.new(
35
+ dir: dir,
40
36
  pubkey: Zold::Key.new('fixtures/id_rsa.pub')
41
37
  ).run
42
38
  assert wallet.balance.zero?
39
+ assert(
40
+ File.exist?(File.join(dir, "#{wallet.id}.xml")),
41
+ "Wallet file not found: #{wallet.id}.xml"
42
+ )
43
43
  end
44
44
  end
45
45
  end
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  # Copyright (c) 2018 Zerocracy, Inc.
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -24,6 +22,7 @@ require 'minitest/autorun'
24
22
  require 'tmpdir'
25
23
  require_relative '../../lib/zold/wallet.rb'
26
24
  require_relative '../../lib/zold/key.rb'
25
+ require_relative '../../lib/zold/id.rb'
27
26
  require_relative '../../lib/zold/commands/send.rb'
28
27
 
29
28
  # SEND test.
@@ -34,17 +33,18 @@ class TestSend < Minitest::Test
34
33
  def test_sends_from_wallet_to_wallet
35
34
  Dir.mktmpdir 'test' do |dir|
36
35
  source = Zold::Wallet.new(File.join(dir, 'source.xml'))
37
- source.init(1, Zold::Key.new('fixtures/id_rsa.pub'))
36
+ source.init(Zold::Id.new, Zold::Key.new('fixtures/id_rsa.pub'))
38
37
  target = Zold::Wallet.new(File.join(dir, 'target.xml'))
39
- target.init(2, Zold::Key.new('fixtures/id_rsa.pub'))
38
+ target.init(Zold::Id.new, Zold::Key.new('fixtures/id_rsa.pub'))
39
+ amount = Zold::Amount.new(zld: 14.95)
40
40
  Zold::Send.new(
41
41
  payer: source,
42
42
  receiver: target,
43
- amount: 100,
43
+ amount: amount,
44
44
  pvtkey: Zold::Key.new('fixtures/id_rsa')
45
45
  ).run
46
- assert source.balance == -100
47
- assert target.balance == 100
46
+ assert source.balance == amount.mul(-1)
47
+ assert target.balance == amount
48
48
  end
49
49
  end
50
50
  end
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  # Copyright (c) 2018 Zerocracy, Inc.
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -0,0 +1,45 @@
1
+ # Copyright (c) 2018 Zerocracy, Inc.
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the 'Software'), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all
11
+ # copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ # SOFTWARE.
20
+
21
+ require 'minitest/autorun'
22
+ require 'tmpdir'
23
+ require_relative '../lib/zold/amount.rb'
24
+
25
+ # Amount test.
26
+ # Author:: Yegor Bugayenko (yegor256@gmail.com)
27
+ # Copyright:: Copyright (c) 2018 Zerocracy, Inc.
28
+ # License:: MIT
29
+ class TestAmount < Minitest::Test
30
+ def test_parses_zld
31
+ amount = Zold::Amount.new(zld: 14.95)
32
+ assert(
33
+ amount.to_s == '14.95ZLD',
34
+ "#{amount} is not equal to '14.95ZLD'"
35
+ )
36
+ end
37
+
38
+ def test_parses_coins
39
+ amount = Zold::Amount.new(coins: 900_000_000)
40
+ assert(
41
+ amount.to_s == '53.64ZLD',
42
+ "#{amount} is not equal to '53.64ZLD'"
43
+ )
44
+ end
45
+ end
@@ -0,0 +1,44 @@
1
+ # Copyright (c) 2018 Zerocracy, Inc.
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the 'Software'), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all
11
+ # copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ # SOFTWARE.
20
+
21
+ require 'minitest/autorun'
22
+ require 'tmpdir'
23
+ require_relative '../lib/zold/id.rb'
24
+
25
+ # ID test.
26
+ # Author:: Yegor Bugayenko (yegor256@gmail.com)
27
+ # Copyright:: Copyright (c) 2018 Zerocracy, Inc.
28
+ # License:: MIT
29
+ class TestId < Minitest::Test
30
+ def test_generates_new_id
31
+ 50.times do
32
+ id = Zold::Id.new
33
+ assert id.to_s.length == 16
34
+ end
35
+ end
36
+
37
+ def test_generates_id_only_once
38
+ id = Zold::Id.new
39
+ before = id.to_s
40
+ 5.times do
41
+ assert id.to_s == before
42
+ end
43
+ end
44
+ end
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  # Copyright (c) 2018 Zerocracy, Inc.
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  # Copyright (c) 2018 Zerocracy, Inc.
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -23,7 +21,9 @@
23
21
  require 'minitest/autorun'
24
22
  require 'tmpdir'
25
23
  require_relative '../lib/zold/key.rb'
24
+ require_relative '../lib/zold/id.rb'
26
25
  require_relative '../lib/zold/wallet.rb'
26
+ require_relative '../lib/zold/amount.rb'
27
27
 
28
28
  # Wallet test.
29
29
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
@@ -34,10 +34,26 @@ class TestWallet < Minitest::Test
34
34
  Dir.mktmpdir 'test' do |dir|
35
35
  file = File.join(dir, 'source.xml')
36
36
  wallet = Zold::Wallet.new(file)
37
- wallet.init(1, Zold::Key.new('fixtures/id_rsa.pub'))
38
- amount = 123
37
+ wallet.init(Zold::Id.new, Zold::Key.new('fixtures/id_rsa.pub'))
38
+ amount = Zold::Amount.new(zld: 39.99)
39
39
  wallet.sub(amount, 100, Zold::Key.new('fixtures/id_rsa'))
40
- assert wallet.balance == -amount
40
+ assert(
41
+ wallet.balance == amount.mul(-1),
42
+ "#{wallet.balance} is not equal to #{amount.mul(-1)}"
43
+ )
44
+ end
45
+ end
46
+
47
+ def test_initializes_it
48
+ Dir.mktmpdir 'test' do |dir|
49
+ file = File.join(dir, 'source.xml')
50
+ wallet = Zold::Wallet.new(file)
51
+ id = Zold::Id.new.to_s
52
+ wallet.init(id, Zold::Key.new('fixtures/id_rsa.pub'))
53
+ assert(
54
+ wallet.id == id,
55
+ "#{wallet.id} is not equal to #{id}"
56
+ )
41
57
  end
42
58
  end
43
59
  end
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  # Copyright (c) 2018 Zerocracy, Inc.
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  # Copyright (c) 2018 Zerocracy, Inc.
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -31,8 +29,8 @@ Gem::Specification.new do |s|
31
29
  if s.respond_to? :required_rubygems_version=
32
30
  s.required_rubygems_version = Gem::Requirement.new('>= 0')
33
31
  end
34
- s.rubygems_version = '2.2.2'
35
- s.required_ruby_version = '>= 1.9.3'
32
+ s.rubygems_version = '2.2'
33
+ s.required_ruby_version = '>= 2.2'
36
34
  s.name = 'zold'
37
35
  s.version = Zold::VERSION
38
36
  s.license = 'MIT'
@@ -47,14 +45,15 @@ Gem::Specification.new do |s|
47
45
  s.rdoc_options = ['--charset=UTF-8']
48
46
  s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
49
47
  s.add_runtime_dependency 'nokogiri', '~>1.8'
48
+ s.add_runtime_dependency 'rainbow', '~>3.0'
50
49
  s.add_runtime_dependency 'slop', '~>4.4'
51
- s.add_runtime_dependency 'rainbow', '~>2.2'
52
- s.add_development_dependency 'rake', '12.0.0'
53
50
  s.add_development_dependency 'codecov', '0.1.10'
54
- s.add_development_dependency 'rdoc', '4.2.0'
55
51
  s.add_development_dependency 'cucumber', '1.3.17'
56
52
  s.add_development_dependency 'minitest', '5.5.0'
57
- s.add_development_dependency 'rubocop', '~>0.49.0'
58
- s.add_development_dependency 'rubocop-rspec', '1.5.1'
53
+ s.add_development_dependency 'rake', '12.0.0'
54
+ s.add_development_dependency 'rdoc', '4.2.0'
59
55
  s.add_development_dependency 'rspec-rails', '3.1.0'
56
+ s.add_development_dependency 'rubocop', '~>0.52.0'
57
+ s.add_development_dependency 'rubocop-rspec', '1.5.1'
58
+ s.add_development_dependency 'xcop', '~>0.5'
60
59
  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.0.3
4
+ version: 0.0.4
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-02-02 00:00:00.000000000 Z
11
+ date: 2018-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -25,117 +25,131 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.8'
27
27
  - !ruby/object:Gem::Dependency
28
- name: slop
28
+ name: rainbow
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '4.4'
33
+ version: '3.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '4.4'
40
+ version: '3.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rainbow
42
+ name: slop
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '2.2'
47
+ version: '4.4'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '2.2'
54
+ version: '4.4'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rake
56
+ name: codecov
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 12.0.0
61
+ version: 0.1.10
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 12.0.0
68
+ version: 0.1.10
69
69
  - !ruby/object:Gem::Dependency
70
- name: codecov
70
+ name: cucumber
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 0.1.10
75
+ version: 1.3.17
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: 0.1.10
82
+ version: 1.3.17
83
83
  - !ruby/object:Gem::Dependency
84
- name: rdoc
84
+ name: minitest
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: 4.2.0
89
+ version: 5.5.0
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 4.2.0
96
+ version: 5.5.0
97
97
  - !ruby/object:Gem::Dependency
98
- name: cucumber
98
+ name: rake
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 1.3.17
103
+ version: 12.0.0
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - '='
109
109
  - !ruby/object:Gem::Version
110
- version: 1.3.17
110
+ version: 12.0.0
111
111
  - !ruby/object:Gem::Dependency
112
- name: minitest
112
+ name: rdoc
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: 5.5.0
117
+ version: 4.2.0
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: 5.5.0
124
+ version: 4.2.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: rspec-rails
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '='
130
+ - !ruby/object:Gem::Version
131
+ version: 3.1.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '='
137
+ - !ruby/object:Gem::Version
138
+ version: 3.1.0
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: rubocop
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
143
  - - "~>"
130
144
  - !ruby/object:Gem::Version
131
- version: 0.49.0
145
+ version: 0.52.0
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
150
  - - "~>"
137
151
  - !ruby/object:Gem::Version
138
- version: 0.49.0
152
+ version: 0.52.0
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: rubocop-rspec
141
155
  requirement: !ruby/object:Gem::Requirement
@@ -151,19 +165,19 @@ dependencies:
151
165
  - !ruby/object:Gem::Version
152
166
  version: 1.5.1
153
167
  - !ruby/object:Gem::Dependency
154
- name: rspec-rails
168
+ name: xcop
155
169
  requirement: !ruby/object:Gem::Requirement
156
170
  requirements:
157
- - - '='
171
+ - - "~>"
158
172
  - !ruby/object:Gem::Version
159
- version: 3.1.0
173
+ version: '0.5'
160
174
  type: :development
161
175
  prerelease: false
162
176
  version_requirements: !ruby/object:Gem::Requirement
163
177
  requirements:
164
- - - '='
178
+ - - "~>"
165
179
  - !ruby/object:Gem::Version
166
- version: 3.1.0
180
+ version: '0.5'
167
181
  description: Non-blockchain cryptocurrency
168
182
  email: yegor256@gmail.com
169
183
  executables:
@@ -187,6 +201,7 @@ files:
187
201
  - README.md
188
202
  - Rakefile
189
203
  - appveyor.yml
204
+ - assets/wallet.xsd
190
205
  - bin/zold
191
206
  - cucumber.yml
192
207
  - features/cli.feature
@@ -196,15 +211,19 @@ files:
196
211
  - fixtures/id_rsa
197
212
  - fixtures/id_rsa.pub
198
213
  - lib/zold.rb
199
- - lib/zold/commands/init.rb
214
+ - lib/zold/amount.rb
215
+ - lib/zold/commands/create.rb
200
216
  - lib/zold/commands/send.rb
217
+ - lib/zold/id.rb
201
218
  - lib/zold/key.rb
202
219
  - lib/zold/log.rb
203
220
  - lib/zold/version.rb
204
221
  - lib/zold/wallet.rb
205
- - test/commands/test_init.rb
222
+ - test/commands/test_create.rb
206
223
  - test/commands/test_send.rb
207
224
  - test/test__helper.rb
225
+ - test/test_amount.rb
226
+ - test/test_id.rb
208
227
  - test/test_key.rb
209
228
  - test/test_wallet.rb
210
229
  - test/test_zold.rb
@@ -222,7 +241,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
222
241
  requirements:
223
242
  - - ">="
224
243
  - !ruby/object:Gem::Version
225
- version: 1.9.3
244
+ version: '2.2'
226
245
  required_rubygems_version: !ruby/object:Gem::Requirement
227
246
  requirements:
228
247
  - - ">="
@@ -239,9 +258,11 @@ test_files:
239
258
  - features/gem_package.feature
240
259
  - features/step_definitions/steps.rb
241
260
  - features/support/env.rb
242
- - test/commands/test_init.rb
261
+ - test/commands/test_create.rb
243
262
  - test/commands/test_send.rb
244
263
  - test/test__helper.rb
264
+ - test/test_amount.rb
265
+ - test/test_id.rb
245
266
  - test/test_key.rb
246
267
  - test/test_wallet.rb
247
268
  - test/test_zold.rb