update readme and specs.

This commit is contained in:
ZippyDev 2020-07-18 11:47:59 -06:00
parent 465033fac3
commit 938dc32747
10 changed files with 136 additions and 9 deletions

2
.gitignore vendored
View File

@ -9,3 +9,5 @@
# rspec failure tracking
.rspec_status
coverage

View File

@ -13,6 +13,8 @@ GEM
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
ast (2.4.1)
coderay (1.1.3)
concurrent-ruby (1.1.6)
@ -28,6 +30,7 @@ GEM
faraday
mime-types
multi_json
hashdiff (1.0.1)
i18n (1.8.3)
concurrent-ruby (~> 1.0)
method_source (1.0.0)
@ -43,6 +46,7 @@ GEM
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (4.0.5)
rainbow (3.0.0)
rake (12.3.3)
regexp_parser (1.7.1)
@ -81,6 +85,11 @@ GEM
tzinfo (1.2.7)
thread_safe (~> 0.1)
unicode-display_width (1.7.0)
vcr (6.0.0)
webmock (3.8.3)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
zeitwerk (2.4.0)
PLATFORMS
@ -94,6 +103,8 @@ DEPENDENCIES
rspec (~> 3.0)
rubocop (> 0)
simplecov (> 0)
vcr (~> 6.0)
webmock (~> 3.8)
BUNDLED WITH
2.1.4

View File

@ -24,6 +24,16 @@ Or install it yourself as:
TODO: Write usage instructions here
### BtcPay Docker Compose
To get up and running locally quickly, a [BTCPayServer]((https://docs.btcpayserver.org/)) docker-compose file has been added to test local API interactions. To get up and running:
1. `$ docker-compose -f docker-compose.btcpay.yml up`
1. `$ open http://localhost:49392`
- Note: [`regtest`](https://bisq.network/blog/how-to-set-up-bitcoin-regtest/) environment default to allow for block/coin creation for test purpose
- `testnet` environment should be used for integration/staging testing prior to production promotion.
- `mainnet` is the **real** network.
## Development
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.

View File

@ -4,7 +4,7 @@ require_relative 'lib/btcpay/version'
Gem::Specification.new do |spec|
spec.name = 'btcpay'
spec.version = Btcpay::VERSION
spec.version = BtcPay::VERSION
spec.authors = ['snogrammer']
spec.email = ['btcpay-gem@snogram.com']
@ -34,4 +34,6 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'pry', '> 0'
spec.add_development_dependency 'rubocop', '> 0'
spec.add_development_dependency 'simplecov', '> 0'
spec.add_development_dependency 'vcr', '~> 6.0'
spec.add_development_dependency 'webmock', '~> 3.8'
end

93
docker-compose.btcpay.yml Normal file
View File

@ -0,0 +1,93 @@
version: "3"
services:
# Bitcoin daemon for blockchain transaction data
bitcoind:
container_name: bitcoind
restart: unless-stopped
image: btcpayserver/bitcoin:0.19.0.1
environment:
BITCOIN_NETWORK: regtest
BITCOIN_EXTRA_ARGS: |
debug=1
regtest=1
server=1
rpcport=43782
rpcbind=0.0.0.0:43782
port=39388
whitelist=0.0.0.0/0
rpcuser=rpcuser
rpcpassword=rpcpassword
expose:
- "43782" # rpc port
- "39388" # bitcoin node can communicate
ports:
- "43782:43782"
- "39388:39388"
volumes:
- "bitcoind_data:/data"
# Blockchain explorer
nbxplorer:
container_name: nbxplorer
restart: unless-stopped
image: nicolasdorier/nbxplorer:2.1.34
ports:
- "32838:32838"
environment:
NBXPLORER_NETWORK: regtest
NBXPLORER_BIND: 0.0.0.0:32838
NBXPLORER_SIGNALFILEDIR: /datadir
NBXPLORER_NOAUTH: 1
NBXPLORER_CHAINS: btc
NBXPLORER_BTCRPCURL: http://bitcoind:43782/
NBXPLORER_BTCRPCUSER: rpcuser
NBXPLORER_BTCRPCPASSWORD: rpcpassword
NBXPLORER_BTCNODEENDPOINT: bitcoind:39388
volumes:
- "bitcoind_data:/root/.bitcoin"
- "nbxplorer_data:/datadir"
links:
- bitcoind
btcpay:
container_name: btcpay
restart: unless-stopped
image: btcpayserver/btcpayserver:1.0.5.2
ports:
- "49392:49392"
environment:
BTCPAY_BIND: 0.0.0.0:49392
BTCPAY_POSTGRES: User ID=user;Password=password;Host=btcpay_db;Port=5432;Database=btcpay_regtest
BTCPAY_NETWORK: regtest
BTCPAY_CHAINS: btc
BTCPAY_ROOTPATH: /
BTCPAY_BTCEXPLORERURL: http://nbxplorer:32838/
BTCPAY_DEBUGLOG: btcpay.log
volumes:
- "btcpay_data:/datadir"
- "nbxplorer_data:/root/.nbxplorer"
links:
- btcpay_db
- bitcoind
- nbxplorer
btcpay_db:
container_name: btcpay_db
restart: unless-stopped
image: postgres:11.5-alpine
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
ports:
- "5432:5432"
volumes:
- /usr/local/var/postgres/data:/var/lib/postgresql/data
- /usr/local/var/postgres/docker/multi-db-entrypoint:/docker-entrypoint-initdb.d
volumes:
bitcoind_data:
nbxplorer_data:
btcpay_data:
networks: {}

View File

@ -2,7 +2,7 @@
require 'btcpay/version'
module Btcpay
module BtcPay
class Error < StandardError; end
# Your code goes here...
end

View File

@ -1,5 +1,5 @@
# frozen_string_literal: true
module Btcpay
module BtcPay
VERSION = '0.1.0'
end

View File

@ -1,11 +1,7 @@
# frozen_string_literal: true
RSpec.describe Btcpay do
RSpec.describe BtcPay do
it 'has a version number' do
expect(Btcpay::VERSION).not_to be nil
end
it 'does something useful' do
expect(false).to eq(true)
expect(BtcPay::VERSION).to eq('0.1.0')
end
end

View File

@ -1,8 +1,13 @@
# frozen_string_literal: true
require 'simplecov'
SimpleCov.start
require 'bundler/setup'
require 'btcpay'
require 'webmock/rspec'
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = '.rspec_status'

8
spec/support/vcr.rb Normal file
View File

@ -0,0 +1,8 @@
# frozen_string_literal: true
require 'vcr'
VCR.configure do |config|
config.cassette_library_dir = 'cassettes'
config.hook_into :webmock
end