c3d 0.4.13 → 0.4.14

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: 68fdaea8fa034d2aefb0e72483a761459e11dfcf
4
- data.tar.gz: f358999385e9dbf5a7d9be9f0d51da89bd1def5c
3
+ metadata.gz: 5be93f53fc41227b1b7b3bf8bbc420f05345a552
4
+ data.tar.gz: a984a1d9cacecf345fadabad3218fdd4f85477fd
5
5
  SHA512:
6
- metadata.gz: 997c6f2884c10755f65089e70da21b34e221da3ca26195e6ac00a62843504fcbfa17c29d98119130fb01e7a3f577d010fa4feffe839de8d4ed82ae1373425f35
7
- data.tar.gz: bf21fa0a59af1902efe071a91417d8443d8b284f46fa9cbe716ad68d7fe56c30bddc0f396799af1366f45c2dbf81b623e0ecd406d819fd29f4a208bce9458502
6
+ metadata.gz: dc9936b7dce8606813bb74f2fd24472eb9d7ec3e8e829cd723a3e03d6201fcdbb41ac8e4bd1e4b888416dfe66771ffb9b8e50dff11ecb97cdc0af3be679f5220
7
+ data.tar.gz: 8c488bc47f2e04477b0ec4be94cc2a66eca7989dd0d5f84e2cf269ca511d7e878f6ec7e476ac746bc1350eacb61bf0e4463e273aa1e9be902bc0dbc7d665d80e
data/bin/c3d CHANGED
@@ -15,7 +15,7 @@ command :start do |c|
15
15
  c.description = 'Start your default c3d server.'
16
16
  c.action do |args, options|
17
17
  print "Please be patient, this will take a few seconds.\n"
18
- C3D.start options.key
18
+ C3D.start options.key, true
19
19
  print "Server has started.\n"
20
20
  end
21
21
  end
data/lib/c3d.rb CHANGED
@@ -24,11 +24,11 @@ Dir[File.dirname(__FILE__) + '/c3d/util/*.rb'].each {|file| require file }
24
24
  module C3D
25
25
  extend self
26
26
 
27
- def start key=''
27
+ def start key='', cli=false
28
28
  unless key == ''
29
29
  ENV['ETH_KEY'] = key
30
30
  end
31
- C3D::SetupC3D.new
31
+ C3D::SetupC3D.new cli
32
32
  C3D::ConnectTorrent.supervise_as :puller, {
33
33
  username: ENV['TORRENT_USER'],
34
34
  password: ENV['TORRENT_PASS'],
@@ -49,7 +49,7 @@ module C3D
49
49
  end
50
50
 
51
51
  def blob args
52
- C3D::SetupC3D.new
52
+ C3D::SetupC3D.new true
53
53
  C3D::ConnectTorrent.supervise_as :puller, {
54
54
  username: ENV['TORRENT_USER'],
55
55
  password: ENV['TORRENT_PASS'],
@@ -3,24 +3,28 @@
3
3
  module C3D
4
4
  module TransmissionRunner
5
5
  extend self
6
- def start_transmission
7
- unless is_trans_running?
6
+ def start_transmission cli
7
+ unless is_trans_running? cli
8
8
  pid = spawn "transmission-daemon -f --no-incomplete-dir -o -C -p #{ENV['TORRENT_RPC'].split(':').last[0..3]} -w #{ENV['BLOBS_DIR']} -g #{File.join(ENV['HOME'], '.epm')}"
9
9
  sleep 3
10
10
  at_exit { Process.kill("INT", pid) }
11
11
  end
12
12
  end
13
13
 
14
- def is_trans_running?
14
+ def is_trans_running? cli
15
15
  a = `ps ux`.split("\n").select{|e| e[/transmission-daemon/]}
16
16
  if ! a.empty?
17
- print "Please stop your default Transmission Server with `sudo service transmission-daemon stop` and then restart.\n"
18
- print "Would you like to override this message and start c3d anyway? (Y/n)\n"
19
- override = STDIN.gets.chomp
20
- if override == 'Y' || override == 'y'
21
- return true
17
+ if cli
18
+ print "Please stop your default Transmission Server with `sudo service transmission-daemon stop` and then restart.\n"
19
+ print "Would you like to override this message and start c3d anyway? (Y/n)\n"
20
+ override = STDIN.gets.chomp
21
+ if override == 'Y' || override == 'y'
22
+ return true
23
+ else
24
+ exit 0
25
+ end
22
26
  else
23
- exit 0
27
+ return true
24
28
  end
25
29
  end
26
30
  return (! a.empty?)
@@ -4,13 +4,13 @@ module C3D
4
4
  class SetupC3D
5
5
  include Celluloid
6
6
 
7
- def initialize
7
+ def initialize cli
8
8
  set_deps
9
9
  config = get_config
10
10
  set_the_env config
11
11
  set_trans_config config
12
12
  set_c3d_config config
13
- start_processes config
13
+ start_processes config, cli
14
14
  end
15
15
 
16
16
  private
@@ -85,8 +85,8 @@ module C3D
85
85
  file_exist? ENV['IGNORE_FILE']
86
86
  end
87
87
 
88
- def start_processes config
89
- C3D::TransmissionRunner.start_transmission
88
+ def start_processes config, cli
89
+ C3D::TransmissionRunner.start_transmission, cli
90
90
  C3D::EthRunner.start_ethereum config
91
91
  end
92
92
 
data/lib/c3d/version.rb CHANGED
@@ -1 +1 @@
1
- VERSION ||= "0.4.13"
1
+ VERSION ||= "0.4.14"
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.13
4
+ version: 0.4.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Casey Kuhlman