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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8722c026bbfaca997d52525490ea16ff8a0413dab7a5569d35121d6e193aad84
4
- data.tar.gz: bacade65e0371ccd42a93df06b3a180bd2e3ce4ab0d6ea61ce0bab2a6410bd14
3
+ metadata.gz: 165ee5b574d1d6b256e913e0fe8e17f476105f219f50473fd45051c5343fcf9d
4
+ data.tar.gz: e7a60c9d11f1e57afdb77f7511f0019f3b492d28709c2599e55975b9478523c7
5
5
  SHA512:
6
- metadata.gz: 5a3182cd71018558696df5a4c03e1a705ada096741f86fd3e0470d65fa5495c2be5e8ad4fbb224c025f1c074b2d7b46256bfe25652b74dff1967692690fb1656
7
- data.tar.gz: 0c40e658f52ac7a1316ef99b7280e0730814ce4ff83113cb6ef680b9755b211501ded836d25e00ad5a437ce430207ad345e15256c9c7c520cb8a05835402a728
6
+ metadata.gz: f92abea21333957147a923bd16a5d42c91d8dee6f49a377ffe5acc2479fbbaeb58d890f90dc748ae16b8a1a1ea46f75cc1a62a5b965d9c057c00995456d91a2b
7
+ data.tar.gz: f2e1644bc5498297e54165355805a8e4bcaf8ac810c2f301811b3df927baea5198806c228255d3304ddce44ee4021612f22ce040bc3fceaac99079b78ea8d6f6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- equestreum (0.1.0)
4
+ equestreum (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,43 +1,6 @@
1
- # Equestreum
2
-
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/equestreum`. To experiment with that code, run `bin/console` for an interactive prompt.
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
+ [![Coverage Status](http://img.shields.io/coveralls/hat-festival/equestreum.svg?style=flat-square)](https://coveralls.io/r/hat-festival/equestreum)
2
+ [![Code Climate](http://img.shields.io/codeclimate/github/hat-festival/equestreum.svg?style=flat-square)](https://codeclimate.com/github/hat-festival/equestreum)
3
+ [![Gem Version](http://img.shields.io/gem/v/equestreum.svg?style=flat-square)](https://rubygems.org/gems/equestreum)
4
+ [![License](http://img.shields.io/:license-mit-blue.svg?style=flat-square)](http://hat-festival.mit-license.org)
24
5
 
25
- TODO: Write usage instructions here
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
@@ -1,7 +1,9 @@
1
1
  module Equestreum
2
2
  class Chain < Array
3
+ private :push, :append, :<<
4
+
3
5
  def initialize genesis
4
- self.push genesis
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
- self.push block
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
@@ -1,3 +1,3 @@
1
1
  module Equestreum
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
data/lib/equestreum.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'digest'
2
2
 
3
3
  require 'equestreum/version'
4
+ require 'equestreum/config'
4
5
  require 'equestreum/block'
5
6
  require 'equestreum/chain'
6
7
 
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.0
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-27 00:00:00.000000000 Z
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: