parenting 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3cc74a4ff2b905440132cc497c0bbf8c161e8aac
4
+ data.tar.gz: 48fff464138060703071cc54711a78d5b74d5216
5
+ SHA512:
6
+ metadata.gz: ba134ce4d03e84abffae28e483033d9a5189c8c2a35c0bc38d49e6fc968cea9e904e29c842a19dabdbd358d7839d304e610eaf61f9720e54d244942bf2d0ec0e
7
+ data.tar.gz: 596f8f2a3367dda68f73e4fb12770d3848ca44578d9ff020432c49a686dce252348cbe2d1a7c45d76381ddafe40c571e3b6ddb05c4cc50ba6798a0e339b10e18
@@ -1,13 +1,18 @@
1
1
  module Parenting
2
2
  class Chore
3
- attr_accessor :on_success, :on_failure, :on_stderr, :exit_status
3
+ attr_accessor :on_start, :on_success, :on_failure, :on_stderr, :exit_status
4
4
  attr_accessor :command, :stdin, :stdout, :stderr
5
5
  attr_accessor :cost, :thread, :result
6
6
  attr_accessor :deps, :name, :completed
7
7
 
8
8
  def initialize(opts)
9
- [:on_success, :on_failure, :on_stderr].each do |cb|
10
- self.send :"#{cb}=", opts.fetch(cb).dup
9
+ [:on_start, :on_success, :on_failure, :on_stderr].each do |cb|
10
+ if opts.key?(cb)
11
+ self.send :"#{cb}=", opts.fetch(cb).dup
12
+ else
13
+ # no-op
14
+ self.send :"#{cb}=", lambda {|o|}
15
+ end
11
16
  end
12
17
 
13
18
  self.name = opts[:name] || nil
@@ -28,6 +33,8 @@ module Parenting
28
33
  end
29
34
 
30
35
  def run!
36
+ self.on_start.call(self)
37
+
31
38
  self.thread = Thread.new do
32
39
  cmd = [self.command].flatten
33
40
  Open3.popen3(* cmd) do |i, o, e, t|
@@ -1,3 +1,3 @@
1
1
  module Parenting
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parenting
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
5
- prerelease:
4
+ version: 0.1.7
6
5
  platform: ruby
7
6
  authors:
8
7
  - Eric Mueller
9
8
  autorequire:
10
9
  bindir: scripts
11
10
  cert_chain: []
12
- date: 2013-08-23 00:00:00.000000000 Z
11
+ date: 2015-02-19 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: Manage multiple child-processes via green threads
15
14
  email: emueller@emcien.com
@@ -19,31 +18,30 @@ extra_rdoc_files: []
19
18
  files:
20
19
  - README.md
21
20
  - lib/parenting.rb
22
- - lib/parenting/chore.rb
23
21
  - lib/parenting/boss.rb
22
+ - lib/parenting/chore.rb
24
23
  - lib/parenting/version.rb
25
24
  homepage: http://github.com/emcien/parenting
26
25
  licenses: []
26
+ metadata: {}
27
27
  post_install_message:
28
28
  rdoc_options: []
29
29
  require_paths:
30
30
  - lib
31
31
  required_ruby_version: !ruby/object:Gem::Requirement
32
- none: false
33
32
  requirements:
34
- - - ! '>='
33
+ - - ">="
35
34
  - !ruby/object:Gem::Version
36
35
  version: '0'
37
36
  required_rubygems_version: !ruby/object:Gem::Requirement
38
- none: false
39
37
  requirements:
40
- - - ! '>='
38
+ - - ">="
41
39
  - !ruby/object:Gem::Version
42
40
  version: '1'
43
41
  requirements: []
44
42
  rubyforge_project:
45
- rubygems_version: 1.8.24
43
+ rubygems_version: 2.4.3
46
44
  signing_key:
47
- specification_version: 3
45
+ specification_version: 4
48
46
  summary: Put those child-processes to WORK
49
47
  test_files: []