Skip to content
This repository has been archived by the owner on Feb 17, 2024. It is now read-only.

Commit

Permalink
bundler optional (rename Gemfile), support ruby2.1 (ioconsole require…
Browse files Browse the repository at this point in the history
…), small refactoring
  • Loading branch information
makevoid committed Nov 22, 2014
1 parent 8784bb3 commit 1749449
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 30 deletions.
18 changes: 4 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
GIT
remote: https://github.com/lian/bitcoin-ruby.git
revision: b7bd36fe7e6ac30ad5910a73c527617974e3086e
revision: 4f9ea350aebccd4879a9fb887cc01ac1fab749b3
specs:
bitcoin-ruby (0.0.5)
bitcoin-ruby (0.0.6)

GEM
remote: http://rubygems.org/
specs:
chunky_png (1.3.1)
chunky_png (1.3.3)
escper (1.2.2)
rmagick
serialport
ffi (1.9.3)
ffi-compiler (0.1.3)
ffi (>= 1.0.0)
rake
rake (10.3.2)
rmagick (2.13.3)
rqrcode (0.4.2)
rqrcode_png (0.1.2)
rqrcode_png (0.1.5)
chunky_png
rqrcode
scrypt (1.2.1)
ffi-compiler (>= 0.0.2)
rake
serialport (1.3.1)

PLATFORMS
Expand All @@ -32,6 +24,4 @@ PLATFORMS
DEPENDENCIES
bitcoin-ruby!
escper
ffi
rqrcode_png
scrypt
6 changes: 2 additions & 4 deletions Gemfile → _Gemfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
source "http://rubygems.org"

gem "ffi"

# gem "ffi"

gem "escper"
gem "bitcoin-ruby", require: "bitcoin", git: "https://github.com/lian/bitcoin-ruby.git"
gem "rqrcode_png"


gem "scrypt"
# gem "scrypt"
26 changes: 16 additions & 10 deletions paperbank.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
require 'bundler/setup'
Bundler.require :default
if defined?(Bundler)
require 'bundler/setup'
Bundler.require :default
else
require 'escper' # https://github.com/michaelfranzl/ruby-escper
require 'rqrcode_png'
require 'bitcoin' # bitcoin-ruby
end

# require 'escper' # https://github.com/michaelfranzl/ruby-escper
# require 'rqrcode_png'
# require 'bitcoin' # bitcoin-ruby
require 'io/console'

require_relative "paperbank_lib"
include PaperBankLib
Expand All @@ -18,7 +22,7 @@
exit
end

# note: chmod 666 /dev/usb/lp0
# note: sudo chmod 666 /dev/usb/lp1
PRINTER = "/dev/usb/lp1" # lp0 on rasp pi, on debian 7 is lp1 by default


Expand All @@ -29,7 +33,7 @@ def initialize
# raise @key.to_bip38(BIP_38_PASS).inspect
end

def print_pairs
def print_sequence
prepare

print_one
Expand All @@ -50,7 +54,6 @@ def prepare
qr.save @image_pub
end


def print_one
# qr pub
print_send "BTC Paper Wallet"
Expand All @@ -66,7 +69,7 @@ def print_one
qr = qrcode_img priv
qr.save @image_priv
print_img_send @image_priv
#priv
# priv
print_send priv
line
line
Expand All @@ -79,5 +82,8 @@ def clean

end


# main

bank = PaperBank.new
bank.print_pairs
bank.print_sequence
2 changes: 0 additions & 2 deletions paperbank_lib.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ def print_img_send(path)
end

# view

def format_addr(addr)
spaces = 3
addr_fmt = addr.split("").each_slice(4).with_index.map do |a, idx|
Expand All @@ -29,7 +28,6 @@ def format_addr(addr)
end



# utils

def debug(file)
Expand Down

0 comments on commit 1749449

Please sign in to comment.