c3d 0.4.19 → 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: 732bfef0a0d9ef6ddca346ede589b867a508d554
4
- data.tar.gz: 127eaab3487b080044f7cb1934bfaea7424696b3
3
+ metadata.gz: c3ec46264e71438151af388f23965d4c8d6f217b
4
+ data.tar.gz: 865d16441bc4f484658f46b23a905a2ce3c405b3
5
5
  SHA512:
6
- metadata.gz: dd7f39dfcca892b6223c284acc31e00df94078857b5a941b43e937d84ad4fb771546c71b098da64a0db76134a4f6316a0e4d39c37f74b7bd350c2e73ab034d2d
7
- data.tar.gz: 28268f2a22a87eecc4bcb57b3297c18bf40bc584c646a598f0fb75d2381f89e9a71355eed11dece95e8393a71c5b6ddf42718b54c8f0dd656daef15f56feca03
6
+ metadata.gz: bc3e8f1a3afcadad99c50a2f9e8736df31b1cbcee30b89a45c515985ab63e4dc44bfabda02cdbd687d8a88ddf48cbbfa40c23bf712c193d2665f9a1ba1a92900
7
+ data.tar.gz: a6dc2fa7781345d3ed4e5b82918d2db33d89b9f11de3ae024688da29e2f6cb4947f45b2b2a2031ccba9c29be9eba89b87489d01a0231354a14cc9ce4bc1feef2
data/bin/c3d CHANGED
@@ -10,12 +10,17 @@ program :description, 'Contract Controlled Content Dissemination Server.'
10
10
  ## Package Workflow Commands
11
11
  ##
12
12
  command :start do |c|
13
- c.syntax = 'c3d start [key]'
13
+ c.syntax = 'c3d start [key] [tr-override]'
14
14
  c.option '--key STRING', String, 'Start the server with a specific public key'
15
+ c.option '--tr BOOLEAN', false, 'Ignore the check for transmission'
15
16
  c.description = 'Start your default c3d server.'
16
17
  c.action do |args, options|
17
18
  print "Please be patient, this will take a few seconds.\n"
18
- C3D.start options.key, true
19
+ unless options.tr
20
+ C3D.start options.key, true
21
+ else
22
+ C3D.start options.key, false
23
+ end
19
24
  print "Server has started.\n"
20
25
  end
21
26
  end
@@ -31,7 +36,6 @@ end
31
36
 
32
37
  command :restart do |c|
33
38
  c.syntax = 'c3d restart'
34
- c.summary = ''
35
39
  c.description = 'Restart your default c3d server.'
36
40
  c.action do
37
41
  print "Please be patient, this will take a few seconds.\n"
@@ -40,12 +44,42 @@ command :restart do |c|
40
44
  end
41
45
  end
42
46
 
43
-
44
47
  command :blob do |c|
45
- c.syntax = 'c3d blob'
46
- c.summary = ''
48
+ c.syntax = 'c3d blob [FILE]'
47
49
  c.description = 'Blob a file and throw into the default torrent client.'
48
50
  c.action do |args|
49
51
  mag_link = C3D.blob args
50
52
  end
53
+ end
54
+
55
+ command :subscribe do |c|
56
+ c.syntax = 'c3d subscribe [CONTRACT(S)]'
57
+ c.description = 'Subscribe to a contract.'
58
+ c.action do |args|
59
+ C3D.subscribe args
60
+ end
61
+ end
62
+
63
+ command :unsubscribe do |c|
64
+ c.syntax = 'c3d unsubscribe [CONTRACT(S)]'
65
+ c.describption = 'Unsubscribe to a contract.'
66
+ c.action do |args|
67
+ C3D.unsubscribe args
68
+ end
69
+ end
70
+
71
+ command :ignore do |c|
72
+ c.syntax = 'c3d ignore [CONTRACT(S)]'
73
+ c.description = 'Ignore a contract.'
74
+ c.action do |args|
75
+ C3D.ignore args
76
+ end
77
+ end
78
+
79
+ command :unignore do |c|
80
+ c.syntax = 'c3d unignore [CONTRACT(S)]'
81
+ c.description = 'Unignore a contract.'
82
+ c.action do |args|
83
+ C3D.unignore args
84
+ end
51
85
  end
@@ -43,7 +43,7 @@ module C3D
43
43
  send_command request
44
44
  end
45
45
 
46
- def transact recipient, data='', value='', gas='100000', gas_price='100000000000000'
46
+ def transact recipient, data='', value='', gas_price=ENV['GAS_PRICE'], gas='100000'
47
47
  sleep 0.5 if ( Time.now - @last_push < 0.5 )
48
48
  recipient = guard_addresses recipient
49
49
  data = build_data data
@@ -12,7 +12,7 @@ module C3D
12
12
  end
13
13
 
14
14
  def is_trans_running? cli
15
- a = `ps ux`.split("\n").select{|e| e[/transmission-daemon/]}
15
+ a = `ps aux`.split("\n").select{|e| e[/transmission-daemon/]}
16
16
  if ! a.empty?
17
17
  if cli
18
18
  print "Please stop your default Transmission Server with `sudo service transmission-daemon stop` and then restart.\n"
@@ -60,6 +60,7 @@ module C3D
60
60
  ENV['ETH_HOST'] = config['eth_rpc_host']
61
61
  ENV['ETH_PORT'] = config['eth_rpc_port']
62
62
  ENV['ETH_KEY'] ||= config['primary_account_key']
63
+ ENV['GAS_PRICE'] = config['gas_price'] || '100000000000000'
63
64
  end
64
65
 
65
66
  def set_trans_config config
data/lib/c3d/version.rb CHANGED
@@ -1 +1 @@
1
- VERSION ||= "0.4.19"
1
+ VERSION ||= "0.5.0"
data/lib/c3d.rb CHANGED
@@ -13,6 +13,7 @@ require 'fileutils'
13
13
  require 'httparty'
14
14
  require 'bencode'
15
15
  require 'celluloid/autostart'
16
+ require 'timers'
16
17
 
17
18
  # This Gem
18
19
  Dir[File.dirname(__FILE__) + '/c3d/*.rb'].each {|file| require file }
@@ -35,7 +36,9 @@ module C3D
35
36
  url: ENV['TORRENT_RPC'] }
36
37
  C3D::ConnectEth.supervise_as :eth, :cpp
37
38
  C3D::Utility.save_key
38
- sleep
39
+ timers = Timers::Group.new
40
+ every_minute = timers.every(60) { C3D::Subscribe.new }
41
+ loop { timers.wait }
39
42
  end
40
43
 
41
44
  def stop
@@ -61,6 +64,34 @@ module C3D
61
64
  end
62
65
  end
63
66
 
67
+ def subscribe args
68
+ until args.empty?
69
+ contract = args.shift
70
+ C3D::EyeOfZorax.subscribe contract
71
+ end
72
+ end
73
+
74
+ def unsubscribe args
75
+ until args.empty?
76
+ contract = args.shift
77
+ C3D::EyeOfZorax.unsubscribe contract
78
+ end
79
+ end
80
+
81
+ def ignore args
82
+ until args.empty?
83
+ contract = args.shift
84
+ C3D::EyeOfZorax.ignore contract
85
+ end
86
+ end
87
+
88
+ def unignore args
89
+ until args.empty?
90
+ contract = args.shift
91
+ C3D::EyeOfZorax.unignore contract
92
+ end
93
+ end
94
+
64
95
  def version
65
96
  return VERSION
66
97
  end
@@ -22,6 +22,7 @@
22
22
  "download_dir": "{{USERHOME}}/.cache/c3d/downloading",
23
23
  "download-queue-size": "50",
24
24
  "queue-stalled-minutes": "98",
25
+ "gas_price":"100000000000000",
25
26
  "primary_account":"{{0xACCT}}",
26
27
  "primary_account_key":"{{0xSEC}}"
27
28
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: c3d
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.19
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Casey Kuhlman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-23 00:00:00.000000000 Z
11
+ date: 2014-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty