sponges 1.1.2 → 1.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: 9bc5491b698ed4138e67bd7e8a2d4bca66d0cfa0
4
- data.tar.gz: 67344939a5c469aede6b5a40b947f2ef62a16fcd
3
+ metadata.gz: f551ee294a287cee6d1203194614d8b248502a6e
4
+ data.tar.gz: e83629c13573a38f4629fe65d6b48fe050d7c661
5
5
  SHA512:
6
- metadata.gz: 904154393bff8aa46081970a5fb9988c1839d8ed50e4d11cdce01b1adbd5eaae012f04985e407cf10a4bbb6a7320aeaa71b9b492bb72265824f21b6fb38d2cfb
7
- data.tar.gz: 4e96a0be0f0be7fbc49694bdfb63235a6dd1d9d4f5c7c40fcf2b19892c1231e40d802208aa6aa3b67133689024ce41ad732a95b751c2f489018c64d63a1de109
6
+ metadata.gz: 2e3f1989505d429e94d865711cfc1182bf5bf480f182b599d941cd9419d4875840134d0529e353dadf00d26bf0be54cf1278f0b98987c6416b2ea645ea521fe7
7
+ data.tar.gz: ceda65d4e04987e49e1640d8a7750a9e335778dc5824c38920fcfc6e9cdd0ab8a2d1bd0d28cc68c3e45e4fac81d31716b39d79941491f2aeeb090865ad274377
data/README.md CHANGED
@@ -72,6 +72,7 @@ Sponges.configure do |config|
72
72
  config.size = 3 # optionnal, default to cpu's size
73
73
  config.daemonize = true # optionnal, default to false
74
74
  config.port = 5032 # optionnal, default to 5032
75
+ config.env = :production # optionnal, default to nil
75
76
  # polling on supervisor, this is use to shutdown children in case supervisor
76
77
  # receive a `SIGKILL` signal.
77
78
  config.polling = 60 # optionnal, default to 60
@@ -1,43 +1,34 @@
1
1
  # encoding: utf-8
2
- require 'boson/runner'
3
- require 'socket'
4
- require 'logger'
5
- require 'machine'
6
- require 'forwardable'
7
- require 'socket'
8
- require 'json'
9
- require_relative 'sponges/version'
10
- require_relative 'sponges/alive'
11
- require_relative 'sponges/configuration'
12
- require_relative 'sponges/worker'
13
- require_relative 'sponges/handler'
14
- require_relative 'sponges/response'
15
- require_relative 'sponges/listener'
16
- require_relative 'sponges/supervisor'
17
- require_relative 'sponges/runner'
18
- require_relative 'sponges/commander'
19
- require_relative 'sponges/cli'
20
- require_relative 'sponges/store'
2
+ %w[boson/runner socket logger machine forwardable json].each do |lib|
3
+ require lib
4
+ end
5
+ %w[version alive configuration worker handler response listener supervisor
6
+ runner commander cli store].each do |lib|
7
+ require_relative "sponges/#{lib}"
8
+ end
21
9
 
22
10
  module Sponges
23
11
  STOP_SIGNALS = [:INT, :QUIT, :TERM]
24
12
  SIGNALS = STOP_SIGNALS + [:HUP, :TTIN, :TTOU, :CHLD]
25
13
 
14
+ module_function
15
+
26
16
  def configure(&block)
27
17
  Sponges::Configuration.configure &block
28
18
  end
29
- module_function :configure
30
19
 
31
20
  def start(worker_name, options = {}, argv = ARGV, &block)
32
21
  Sponges::Configuration.worker_name = worker_name
33
22
  Sponges::Configuration.worker = block
34
23
  Sponges::Cli.start(argv)
35
24
  end
36
- module_function :start
37
25
 
38
26
  def logger
39
27
  return @logger if @logger
40
28
  @logger = Sponges::Configuration.logger || Logger.new(STDOUT)
41
29
  end
42
- module_function :logger
30
+
31
+ def env
32
+ Sponges::Configuration.env
33
+ end
43
34
  end
@@ -6,7 +6,7 @@ module Sponges
6
6
  class << self
7
7
  ACCESSOR = [:worker_name, :worker, :logger, :size, :daemonize,
8
8
  :after_fork, :timeout, :gracefully, :store, :port,
9
- :polling
9
+ :polling, :env
10
10
  ]
11
11
  attr_accessor *ACCESSOR
12
12
 
@@ -38,11 +38,11 @@ module Sponges
38
38
  private
39
39
 
40
40
  def supervisor_name
41
- "#{name}_supervisor"
41
+ [name, Sponges.env, "supervisor"].compact.join("_")
42
42
  end
43
43
 
44
44
  def childs_name
45
- "#{name}_child"
45
+ [name, Sponges.env, "child"].compact.join("_")
46
46
  end
47
47
 
48
48
  def find_supervisor
@@ -8,7 +8,7 @@ module Sponges
8
8
 
9
9
  def initialize(name, options, store, block)
10
10
  @name, @options, @store, @block = name, options, store, block
11
- $PROGRAM_NAME = "#{@name}_supervisor"
11
+ $PROGRAM_NAME = [@name, Sponges.env, "supervisor"].compact.join("_")
12
12
  store.register Process.pid
13
13
  @children_seen = 0
14
14
  @handler = Handler.new self
@@ -38,7 +38,7 @@ module Sponges
38
38
  private
39
39
 
40
40
  def children_name
41
- "#{name}_child_#{@children_seen +=1}"
41
+ [name, Sponges.env, "child_#{@children_seen +=1}"].compact.join("_")
42
42
  end
43
43
 
44
44
  def trap_signals
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Sponges
3
- VERSION = "1.1.2"
3
+ VERSION = "1.2.0"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sponges
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - chatgris
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-24 00:00:00.000000000 Z
11
+ date: 2013-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: boson