hustle 0.0.1 → 0.0.2

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: 5d63d92d42cdec1d7a666e7357ab233f9455fa1c
4
- data.tar.gz: e1b6c7cc34b13eb0ef287d30e51b046b3a8be9b5
3
+ metadata.gz: 462fcf478bc5d9197719e9ef8bba3fe84b37feb0
4
+ data.tar.gz: f3fc2d990f6785078a950ba50db9ee054d1f2f3e
5
5
  SHA512:
6
- metadata.gz: 5b11f41b9b01350abda0fb40458d7aefb927b5628705f14996b4cdb29def0f00889e7d6c3ea0149549e598c837c59391882dc32d75df5593b44d67f4a27efc20
7
- data.tar.gz: b935918265827b097d6b6e6e9b9f802276d8301311c6fbac92ac95c9fb471002efddef4110b9b3da71e0aca74cc48ab49a1e461e793f3ada2eb461806cac0cbe
6
+ metadata.gz: 1622258db577a0920d424f748f8a69db14dcf25be289a49c788822badb6afa878913b131f8a66dec1efaeba7e7fd2d8caee9b366fe92b8780de7f366359223ad
7
+ data.tar.gz: caf7fc6a675195d560c795847ef2a1c59ac2a406dcf082156ffe6fb4d655026ee44ba7bb06be5e40a77b24130ad2a7814502b1640163a6cc030c3fbda1ee9277
data/lib/hustle.rb CHANGED
@@ -46,6 +46,9 @@ module Hustle
46
46
  runner = Runner.new(uri)
47
47
  runner.start_remote_instance
48
48
  sleep 0 while !runner.remote_instance_ready?
49
+ synchronize do
50
+ active_runners[runner.pid] = runner
51
+ end
49
52
  runner.run_remote(&block)
50
53
  finish runner, callback
51
54
  end
@@ -77,10 +80,6 @@ module Hustle
77
80
  end
78
81
  callback.call value
79
82
  end
80
-
81
- synchronize do
82
- active_runners[runner.pid] = runner
83
- end
84
83
  end
85
84
 
86
85
  end
data/lib/hustle/runner.rb CHANGED
@@ -60,7 +60,11 @@ module Hustle
60
60
 
61
61
  def run
62
62
  Thread.new do
63
- @value = yield
63
+ begin
64
+ @value = yield
65
+ rescue Exception => e
66
+ @value = e
67
+ end
64
68
  @finished = true
65
69
  end
66
70
  end
@@ -1,3 +1,3 @@
1
1
  module Hustle
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/test/hustle_test.rb CHANGED
@@ -37,5 +37,18 @@ class HustleTest < MicroTest::Test
37
37
  end
38
38
  end
39
39
 
40
+ test "error in block" do
41
+ error_message = "Error in the block!"
42
+
43
+ asserts = -> (value) do
44
+ assert value.is_a?(StandardError)
45
+ assert value.message == error_message
46
+ end
47
+
48
+ Hustle.go(callback: asserts) do
49
+ raise error_message
50
+ end
51
+ end
52
+
40
53
  end
41
54
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hustle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Hopkins