equestreum 0.1.0 → 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/Gemfile.lock +1 -1
- data/README.md +5 -42
- data/config/equestreum.yaml +1 -0
- data/lib/equestreum/chain.rb +14 -2
- data/lib/equestreum/config.rb +20 -0
- data/lib/equestreum/version.rb +1 -1
- data/lib/equestreum.rb +1 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 165ee5b574d1d6b256e913e0fe8e17f476105f219f50473fd45051c5343fcf9d
|
4
|
+
data.tar.gz: e7a60c9d11f1e57afdb77f7511f0019f3b492d28709c2599e55975b9478523c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f92abea21333957147a923bd16a5d42c91d8dee6f49a377ffe5acc2479fbbaeb58d890f90dc748ae16b8a1a1ea46f75cc1a62a5b965d9c057c00995456d91a2b
|
7
|
+
data.tar.gz: f2e1644bc5498297e54165355805a8e4bcaf8ac810c2f301811b3df927baea5198806c228255d3304ddce44ee4021612f22ce040bc3fceaac99079b78ea8d6f6
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,43 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
gem 'equestreum'
|
13
|
-
```
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install equestreum
|
22
|
-
|
23
|
-
## Usage
|
1
|
+
[](https://coveralls.io/r/hat-festival/equestreum)
|
2
|
+
[](https://codeclimate.com/github/hat-festival/equestreum)
|
3
|
+
[](https://rubygems.org/gems/equestreum)
|
4
|
+
[](http://hat-festival.mit-license.org)
|
24
5
|
|
25
|
-
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
-
|
33
|
-
## Contributing
|
34
|
-
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/equestreum. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
-
|
37
|
-
## License
|
38
|
-
|
39
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
40
|
-
|
41
|
-
## Code of Conduct
|
42
|
-
|
43
|
-
Everyone interacting in the Equestreum project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/equestreum/blob/master/CODE_OF_CONDUCT.md).
|
6
|
+
# Equestreum
|
@@ -0,0 +1 @@
|
|
1
|
+
chain_path: tmp/equestreum.chain
|
data/lib/equestreum/chain.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
module Equestreum
|
2
2
|
class Chain < Array
|
3
|
+
private :push, :append, :<<
|
4
|
+
|
3
5
|
def initialize genesis
|
4
|
-
|
6
|
+
push genesis
|
5
7
|
end
|
6
8
|
|
7
9
|
def grow data
|
@@ -13,7 +15,7 @@ module Equestreum
|
|
13
15
|
|
14
16
|
block.mine
|
15
17
|
|
16
|
-
|
18
|
+
push block
|
17
19
|
end
|
18
20
|
|
19
21
|
def hash_ok? index
|
@@ -74,5 +76,15 @@ module Equestreum
|
|
74
76
|
end
|
75
77
|
true
|
76
78
|
end
|
79
|
+
|
80
|
+
def save
|
81
|
+
File.open Config.instance.config['chain_path'], 'w' do |f|
|
82
|
+
f.write Marshal.dump self
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.revive
|
87
|
+
Marshal.load File.read Config.instance.config['chain_path']
|
88
|
+
end
|
77
89
|
end
|
78
90
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Equestreum
|
2
|
+
class Config
|
3
|
+
include Singleton
|
4
|
+
|
5
|
+
def initialize custom = "#{ENV['HOME']}/.equestreum/config.yaml"
|
6
|
+
@config = fetch_yaml File.join(File.dirname(__FILE__), '..', '..', 'config/equestreum.yaml')
|
7
|
+
@config.merge! fetch_yaml custom
|
8
|
+
end
|
9
|
+
|
10
|
+
def config
|
11
|
+
@config
|
12
|
+
end
|
13
|
+
|
14
|
+
def fetch_yaml file
|
15
|
+
YAML.load File.open file
|
16
|
+
rescue Errno::ENOENT
|
17
|
+
{}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/equestreum/version.rb
CHANGED
data/lib/equestreum.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: equestreum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pikesley
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -113,10 +113,12 @@ files:
|
|
113
113
|
- Rakefile
|
114
114
|
- bin/console
|
115
115
|
- bin/setup
|
116
|
+
- config/equestreum.yaml
|
116
117
|
- equestreum.gemspec
|
117
118
|
- lib/equestreum.rb
|
118
119
|
- lib/equestreum/block.rb
|
119
120
|
- lib/equestreum/chain.rb
|
121
|
+
- lib/equestreum/config.rb
|
120
122
|
- lib/equestreum/version.rb
|
121
123
|
homepage: http://pikesley.org
|
122
124
|
licenses:
|