bitcoin_testnet 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d564dbf12c8b0a40257516544733bf4c5aa3df1b
4
- data.tar.gz: ebc42bcb77d3c27ea4275513f8cfa4652e90510c
3
+ metadata.gz: 7d5173e6e93a3f993ae68de6e310a1441b48d33c
4
+ data.tar.gz: 0fc26b7a364b16cdd7ec2b7b649085f3aa1576b8
5
5
  SHA512:
6
- metadata.gz: 3f2583f643f18675658ffefe85e3a77001bda7d8e163074897dcb7e712454a88e0f438df29dd68d76e4499e32ad60ff014c16b7d52311d35e7f90fdecdafdc6c
7
- data.tar.gz: 2332de6147f4a7420305fa4b4e6a131697478a741314628eff74b99fc41f209e222bbd3bac15f95968fdbe4ab379eb8619654cbdacf6159d4d051ab7b0ac76c4
6
+ metadata.gz: 02f314f6cd294d0e47f40f347799ab6faafddb8a72108469cb5d5be8390b2d0b91dfdb22bc4b4aca94a9f318b48e3d19a18d6973b246aaa8a12a9b37f804f597
7
+ data.tar.gz: ca71d00a42d1f5502fa08bf922f1ee5eca9d7886870c80fddf5f4fed731f3611c4375e0115995719de5a6ff74a20547dd5d13608b768c9d8194dc9368f5e7268
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v0.5.0
2
+
3
+ - Redirect all bitcoin make logging to /dev/null -- makes things more quiet when running specs
4
+
1
5
  # v0.4.1
2
6
 
3
7
  - Loosen constraint on ActiveSupport version
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
10
10
  gem.email = ["ramon.tayag@gmail.com"]
11
11
  gem.description = %q{A gem of helpers for making integration tests with the Bitcoin testnet a little easier.}
12
12
  gem.summary = %q{A gem of helpers for making integration tests with the Bitcoin testnet a little easier.}
13
- gem.homepage = ""
13
+ gem.homepage = "https://github.com/ramontayag/ruby-bitcoin_testnet"
14
14
 
15
15
  testnet_files = `cd #{File.join(File.dirname(__FILE__), 'testnet')} && git ls-files`.split($/).map {|file| File.join('testnet', file)}
16
16
  gem.files = `git ls-files`.split($/) + testnet_files
@@ -20,4 +20,5 @@ Gem::Specification.new do |gem|
20
20
 
21
21
  gem.add_dependency 'activesupport'
22
22
  gem.add_dependency 'wait', '~> 0.5.1'
23
+ gem.add_development_dependency 'rspec'
23
24
  end
@@ -6,6 +6,8 @@ require 'bitcoin_testnet/detector'
6
6
  require 'bitcoin_testnet/executor'
7
7
  require 'bitcoin_testnet/booter'
8
8
  require 'bitcoin_testnet/stopper'
9
+ require 'bitcoin_testnet/executes'
10
+ require 'bitcoin_testnet/prepares_command'
9
11
  require 'bitcoin_testnet/vcr_integrator'
10
12
 
11
13
  module BitcoinTestnet
@@ -9,15 +9,15 @@ module BitcoinTestnet
9
9
  if Detector.exists?
10
10
  Stopper.stop
11
11
  else
12
- Executor.execute "make clean"
12
+ Executes.command "make clean"
13
13
  end
14
14
 
15
15
  thread = Thread.new do
16
- Executor.execute "make start"
16
+ Executes.command "make start"
17
17
  end
18
18
 
19
19
  Wait.new.until do
20
- thread.status == false && Executor.execute("make getinfo")
20
+ thread.status == false && Executes.command("make getinfo")
21
21
  end
22
22
 
23
23
  unless Detector.exists?
@@ -0,0 +1,11 @@
1
+ module BitcoinTestnet
2
+ class Executes
3
+
4
+ def self.command(c)
5
+ Dir.chdir BitcoinTestnet.dir
6
+ prepared_command = PreparesCommand.for_silence(c)
7
+ system prepared_command
8
+ end
9
+
10
+ end
11
+ end
@@ -11,7 +11,7 @@ module BitcoinTestnet
11
11
 
12
12
  def execute
13
13
  Dir.chdir BitcoinTestnet.dir do
14
- commands = @commands.map { |c| "#{c} > /dev/null"}
14
+ commands = @commands.map { |c| "#{c} > /dev/null 2>&1"}
15
15
  system commands.join(' && ')
16
16
  end
17
17
  end
@@ -0,0 +1,9 @@
1
+ module BitcoinTestnet
2
+ class PreparesCommand
3
+
4
+ def self.for_silence(command)
5
+ "#{command} > /dev/null 2>&1"
6
+ end
7
+
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module BitcoinTestnet
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5.0"
3
3
  end
@@ -0,0 +1,23 @@
1
+ require "spec_helper"
2
+
3
+ module BitcoinTestnet
4
+ describe Executes do
5
+
6
+ describe ".command" do
7
+ it "executes the prepared command in the BitcoinTestnet dir" do
8
+ in_dir = double
9
+ command = "do this"
10
+ prepared_command = "do this prepared"
11
+
12
+ allow(PreparesCommand).to receive(:for_silence).with(command).
13
+ and_return(prepared_command)
14
+
15
+ expect(Dir).to receive(:chdir).with(BitcoinTestnet.dir)
16
+ expect(described_class).to receive(:system).with(prepared_command)
17
+
18
+ described_class.command(command)
19
+ end
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,15 @@
1
+ require "spec_helper"
2
+
3
+ module BitcoinTestnet
4
+ describe Executor, ".execute" do
5
+
6
+ it "executes the given commands piping stderr and sdout each to /dev/null" do
7
+ commands = [
8
+ "command 1",
9
+ "comm2"
10
+ ]
11
+
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ require "spec_helper"
2
+
3
+ module BitcoinTestnet
4
+ describe PreparesCommand do
5
+
6
+ describe ".for_silence" do
7
+ it "redirects stdout and stderr to /dev/null" do
8
+ expect(described_class.for_silence("some command")).
9
+ to eq("some command > /dev/null 2>&1")
10
+ end
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,2 @@
1
+ require "bundler/setup"
2
+ Bundler.require(:default)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitcoin_testnet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ramon Tayag
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.5.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  description: A gem of helpers for making integration tests with the Bitcoin testnet
42
56
  a little easier.
43
57
  email:
@@ -57,10 +71,16 @@ files:
57
71
  - lib/bitcoin_testnet.rb
58
72
  - lib/bitcoin_testnet/booter.rb
59
73
  - lib/bitcoin_testnet/detector.rb
74
+ - lib/bitcoin_testnet/executes.rb
60
75
  - lib/bitcoin_testnet/executor.rb
76
+ - lib/bitcoin_testnet/prepares_command.rb
61
77
  - lib/bitcoin_testnet/stopper.rb
62
78
  - lib/bitcoin_testnet/vcr_integrator.rb
63
79
  - lib/bitcoin_testnet/version.rb
80
+ - spec/bitcoint_testnet/executes_spec.rb
81
+ - spec/bitcoint_testnet/executor_spec.rb
82
+ - spec/bitcoint_testnet/prepares_command_spec.rb
83
+ - spec/spec_helper.rb
64
84
  - testnet/1/bitcoin.conf
65
85
  - testnet/1/testnet3/blk0001.dat
66
86
  - testnet/1/testnet3/blkindex.dat
@@ -75,7 +95,7 @@ files:
75
95
  - testnet/2/testnet3/wallet.dat
76
96
  - testnet/Makefile
77
97
  - testnet/README.txt
78
- homepage: ''
98
+ homepage: https://github.com/ramontayag/ruby-bitcoin_testnet
79
99
  licenses: []
80
100
  metadata: {}
81
101
  post_install_message:
@@ -99,4 +119,8 @@ signing_key:
99
119
  specification_version: 4
100
120
  summary: A gem of helpers for making integration tests with the Bitcoin testnet a
101
121
  little easier.
102
- test_files: []
122
+ test_files:
123
+ - spec/bitcoint_testnet/executes_spec.rb
124
+ - spec/bitcoint_testnet/executor_spec.rb
125
+ - spec/bitcoint_testnet/prepares_command_spec.rb
126
+ - spec/spec_helper.rb