deadly_serious 0.1.0 → 0.2.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: ec9c559df6b61f7d20e04438c3dc3490980c8ada
4
- data.tar.gz: dff2f683847b2698ca28ec8d65a462b146459db0
3
+ metadata.gz: 6d49228267a17e2649bbc4809171dfc08bb7680e
4
+ data.tar.gz: a830668ca8fe3fc3bd571453abc4fdf398d17aae
5
5
  SHA512:
6
- metadata.gz: 4d184d82f4adcf1942ad52a12ba06e494b4d6de28dbfadaececf14363a91f4608d065aa0764041345c5497b1687e2c066cd74aca33c2091e85ba4cbf2f3fa80f
7
- data.tar.gz: a5cd61a69a593298904e9a7446496bd6bd77a2f6c4506ab45a8e7af69f7cdc2391d08f38635bb323497b1f0b64cee35dbd72b641201726b01f5fbedd58073309
6
+ metadata.gz: 78856ba4d5335ec4721c6f44c9abc8f2e85deacf439d98832aea4a65172c1eb653399b2f201317a8e3fa24e99543273d96679eb07f47a836b8e04e07aa8ca0b1
7
+ data.tar.gz: ee8f976cbb6e80a9cc9f9d5b9f3345e91bde39ddf92b14f1f9c446c828e1fab93d85dd4a22fb39e09cb08e02b5bd6a84189c5cd12c0f497cf0fb9988561a4cc4
@@ -1,11 +1,15 @@
1
1
  module DeadlySerious
2
2
  module Engine
3
3
  class Channel
4
- def initialize(name, dir: nil)
4
+ def initialize(name, data_dir: nil, pipe_dir: nil)
5
5
  matcher = name.match(/^(>?)(.*)$/)
6
6
  @type = matcher[1] == '>' ? :file : :pipe
7
7
  name = matcher[2]
8
- @io_name = "#{dir}/#{name}"
8
+ @io_name = if @type == :file
9
+ "#{data_dir}/#{name}"
10
+ else
11
+ "#{pipe_dir}/#{name}"
12
+ end
9
13
  end
10
14
 
11
15
  def create
@@ -4,7 +4,8 @@ require 'deadly_serious/engine/channel'
4
4
  module DeadlySerious
5
5
  module Engine
6
6
  class Spawner
7
- def initialize(pipe_dir: "/tmp/deadly_serious/#{Process.pid}", preserve_pipe_dir: false)
7
+ def initialize(data_dir: './data', pipe_dir: "/tmp/deadly_serious/#{Process.pid}", preserve_pipe_dir: false)
8
+ @data_dir = data_dir
8
9
  @pipe_dir = pipe_dir
9
10
  @ids = []
10
11
 
@@ -23,16 +24,20 @@ module DeadlySerious
23
24
  $0 = "ruby #{self.class.dasherize(name)}"
24
25
  end
25
26
 
27
+ def channel_for(pipe_name)
28
+ Channel.new(pipe_name, data_dir: @data_dir, pipe_dir: @pipe_dir)
29
+ end
30
+
26
31
  def create_pipe(pipe_name)
27
- Channel.new(pipe_name, dir: @pipe_dir).create
32
+ channel_for(pipe_name).create
28
33
  end
29
34
 
30
35
  def read_pipe(pipe_name)
31
- Channel.new(pipe_name, dir: @pipe_dir).open_reader
36
+ channel_for(pipe_name).open_reader
32
37
  end
33
38
 
34
39
  def write_pipe(pipe_name)
35
- channel = Channel.new(pipe_name, dir: @pipe_dir)
40
+ channel = channel_for(pipe_name)
36
41
  return channel.open_writer unless block_given?
37
42
 
38
43
  channel.open_writer do |io|
@@ -1,3 +1,3 @@
1
1
  module DeadlySerious
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deadly_serious
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ronie Uliana