c3d 0.4.7 → 0.4.9

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: 8c496f93bbf5c8060470bf6d0615ae1842d1caf4
4
- data.tar.gz: f95355f2f631fbd5e656a7c5573c27ecf2756587
3
+ metadata.gz: 186a27dd5c70f1d4b4fd474b699fc194e588fea0
4
+ data.tar.gz: 1b60ed82f414718ca74112ca74407e7ba9922763
5
5
  SHA512:
6
- metadata.gz: 24cdc7831a657716a6fb42f098580c76039aeec2b6161e0623219ff295ed136ba2e84f68e67c9a10c60aa520e42e9bc1c0a0f5dba8ec2db8116266f13b036f34
7
- data.tar.gz: 7ca634f3b9eef8fd7cd5e2a778b32a2777b6456b28757f1e416e8f0b1f1b73ad946095f1a350a597fe32f9a13f894b5624402b05a01bc5d0cd43a48399fff76f
6
+ metadata.gz: 5ecda352a43aa3ef2c4338ea1258b1e17e6edaf241df0bcb59de5d4f0acd7b80221f393f12595854faaad1b658e03037cffc5dc182caae3c0105076e0cdd9df4
7
+ data.tar.gz: 5ebc156d74ce1f539608b57587e9dbddaca4cafee7ffdea1ea3243c76faaa0004dbabeb39bf4b8a4bf410ec6de49cceeffca9f128fa51452f32d606ffa0728d1
data/lib/c3d.rb CHANGED
@@ -31,11 +31,6 @@ module C3D
31
31
  password: ENV['TORRENT_PASS'],
32
32
  url: ENV['TORRENT_RPC'] }
33
33
  C3D::ConnectEth.supervise_as :eth, :cpp
34
-
35
- # todo, need to trap_exit on these actors if they crash
36
- $puller = Celluloid::Actor[:puller]
37
- $eth = Celluloid::Actor[:eth]
38
-
39
34
  C3D::Utility.save_key
40
35
  sleep
41
36
  end
@@ -51,10 +46,10 @@ module C3D
51
46
 
52
47
  def blob args
53
48
  C3D::SetupC3D.new
54
- opts = { username: ENV['TORRENT_USER'],
49
+ C3D::ConnectTorrent.supervise_as :puller, {
50
+ username: ENV['TORRENT_USER'],
55
51
  password: ENV['TORRENT_PASS'],
56
52
  url: ENV['TORRENT_RPC'] }
57
- $puller = C3D::ConnectTorrent.new opts
58
53
  until args.empty?
59
54
  file = args.shift
60
55
  c = C3D::Blobber.new file
@@ -80,7 +80,7 @@ module C3D
80
80
  end
81
81
 
82
82
  def send_query contract, storage
83
- $eth.get_storage_at contract, storage
83
+ Celluloid::Actor[:eth].get_storage_at contract, storage
84
84
  end
85
85
 
86
86
  def ab? contract
@@ -117,7 +117,7 @@ module C3D
117
117
  end
118
118
  else
119
119
  link = "magnet:?xt=urn:btih:" + btih + "&dn=" + dn
120
- torrent = $puller.create link
120
+ torrent = Celluloid::Actor[:puller].create link
121
121
  @content << { contract => "currently acquiring please check back." }
122
122
  end
123
123
  return false
@@ -24,7 +24,7 @@ module C3D
24
24
  end
25
25
 
26
26
  def send_query contract, storage
27
- $eth.get_storage_at contract, storage
27
+ Celluloid::Actor[:eth].get_storage_at contract, storage
28
28
  end
29
29
  end
30
30
  end
@@ -11,7 +11,7 @@ module C3D
11
11
  btih = blob_id[0..39]
12
12
  dn = blob_id[40..-1]
13
13
  mag_link = "magnet:?xt=urn:btih:" + btih + "&dn=" + dn
14
- $puller.create mag_link
14
+ Celluloid::Actor[:puller].create mag_link
15
15
  puts "[C3D::#{Time.now.strftime( "%F %T" )}] Getting >>\t\t" + mag_link
16
16
  end
17
17
  end
@@ -74,7 +74,7 @@ module C3D
74
74
  end
75
75
 
76
76
  def publish_torrent
77
- torrent = $puller.create @tor_file
77
+ torrent = Celluloid::Actor[:puller].create @tor_file
78
78
  begin
79
79
  @btih = torrent["torrent-added"]['hashString']
80
80
  rescue
@@ -7,9 +7,9 @@ module C3D
7
7
  def initialize blob
8
8
  begin
9
9
  dn = blob[14..-1]
10
- currently_downloading = $puller.all
10
+ currently_downloading = Celluloid::Actor[:puller].all
11
11
  downloading = currently_downloading.select{|t| t["name"] == dn}.first["id"]
12
- $puller.destroy downloading if downloading
12
+ Celluloid::Actor[:puller].destroy downloading if downloading
13
13
  blob_file = File.join(ENV['BLOBS_DIR'], dn)
14
14
  if File.exists? blob_file
15
15
  File.delete blob_file
@@ -148,7 +148,7 @@ module C3D
148
148
  end
149
149
 
150
150
  def send_query contract, storage
151
- $eth.get_storage_at contract, storage
151
+ Celluloid::Actor[:eth].get_storage_at contract, storage
152
152
  end
153
153
 
154
154
  def ab? contract
@@ -185,7 +185,7 @@ module C3D
185
185
  btih = blob[2..41]
186
186
  dn = blob[42..-1]
187
187
  link = "magnet:?xt=urn:btih:" + btih + "&dn=" + dn
188
- torrent = $puller.create link
188
+ torrent = Celluloid::Actor[:puller].create link
189
189
  return true
190
190
  rescue
191
191
  return false
data/lib/c3d/util/util.rb CHANGED
@@ -5,7 +5,7 @@ module C3D
5
5
  extend self
6
6
 
7
7
  def save_key
8
- key = $eth.get_key
8
+ key = Celluloid::Actor[:eth].get_key
9
9
  config_file = File.join(ENV['HOME'], '.epm', 'c3d-config.json')
10
10
  config = JSON.load(File.read(config_file))
11
11
  config["primary_account_key"] = key if config["primary_account_key"] != key
data/lib/c3d/version.rb CHANGED
@@ -1 +1 @@
1
- VERSION ||= "0.4.7"
1
+ VERSION ||= "0.4.9"
data/spec/spec_helper.rb CHANGED
@@ -22,10 +22,7 @@ def get_set_up
22
22
  username: ENV['TORRENT_USER'],
23
23
  password: ENV['TORRENT_PASS'],
24
24
  url: ENV['TORRENT_RPC'] }
25
- $puller = Celluloid::Actor[:puller]
26
-
27
25
  C3D::ConnectEth.supervise_as :eth, :cpp
28
- $eth = Celluloid::Actor[:eth]
29
26
 
30
27
  unless check_for_doug
31
28
  print "\nThere is No DOUG. Please Fix That."
@@ -43,7 +40,7 @@ def check_for_doug
43
40
  log = File.read log_file
44
41
  doug = log.split("\n").map{|l| l.split(',')}.select{|l| l[0] == ("Doug" || "DOUG" || "doug")}[-1][-1]
45
42
  end
46
- doug_check = $eth.get_storage_at doug, '0x10'
43
+ doug_check = Celluloid::Actor[:eth]h.get_storage_at doug, '0x10'
47
44
  if doug_check != '0x'
48
45
  return true
49
46
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: c3d
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7
4
+ version: 0.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Casey Kuhlman