eac_ruby_utils 0.25.0 → 0.26.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7cabdae188319f61b679959d393db04a8a1cd5a2512ab0b066c2caf2cdde1fb6
4
- data.tar.gz: 4de1897fe89b9a7c894767c1f1c1462a29d9205b208ac9bb3b5e89ccbb9d7d6d
3
+ metadata.gz: 637988e74b9a30818ce5ee3aac3518a19bd06d6fd54f0beeb4454e8a22be8aa2
4
+ data.tar.gz: 68e8326e06264390c21d39ac34f0e45e5a4be8eabfaa7e6e4d0c588361d39bac
5
5
  SHA512:
6
- metadata.gz: 2037c2506e2ca31ccec2eeb76f1885679bf952be2522d186552fb36facbcde2724422bc13f851a71b8077371ff81c629bd9b07022356c59a6797c9417906a762
7
- data.tar.gz: 0f696918564763beadf879d721d22bfec98253f3147d2b966af08772d46e5b25f92027c96c7fbd9fe8ee8b7cf41f0eb71f1bd64baaaee1f1cbe07ab1b804a241
6
+ metadata.gz: 7609e6ed7d307f7a70e25ecd4fe19281627bb7cbb4f8738c1c42184112707ca770ec67bb5f250a9ada3f3482957960cba757cae729bc4a09138a593b541ca7c6
7
+ data.tar.gz: e61d1df96f1bcc092bbbed5bfb9a824a9bdbb0915f17da21f3bfeded8ed779713835d58917ca1d36b201b6d393d9dd33ee67b30e5a7c697ba90fda58ac321999
@@ -7,7 +7,7 @@ module EacRubyUtils
7
7
  end
8
8
 
9
9
  def method_missing(method_name, *arguments, &block)
10
- return object.send(method_name, *arguments) if object.respond_to?(method_name)
10
+ return object.send(method_name, *arguments, &block) if object.respond_to?(method_name)
11
11
 
12
12
  super
13
13
  end
@@ -4,6 +4,7 @@ require 'active_support/core_ext/hash/indifferent_access'
4
4
  require 'eac_ruby_utils/console/speaker'
5
5
  require 'eac_ruby_utils/envs/command/extra_options'
6
6
  require 'eac_ruby_utils/envs/process'
7
+ require 'eac_ruby_utils/envs/spawn'
7
8
  require 'pp'
8
9
  require 'shellwords'
9
10
 
@@ -69,6 +70,12 @@ module EacRubyUtils
69
70
  r
70
71
  end
71
72
 
73
+ def spawn(options = {})
74
+ c = command(options)
75
+ puts "SPAWN: #{c}".light_red if debug?
76
+ ::EacRubyUtils::Envs::Spawn.new(c)
77
+ end
78
+
72
79
  def system!(options = {})
73
80
  return if system(options)
74
81
 
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacRubyUtils
4
+ module Envs
5
+ class Spawn
6
+ attr_reader :command, :pid
7
+
8
+ def initialize(command)
9
+ @command = command
10
+ @pid = ::Process.spawn(command)
11
+ end
12
+
13
+ def kill(signal)
14
+ ::Process.kill(signal, pid)
15
+ end
16
+
17
+ def kill_at_end(&block)
18
+ block.call(self)
19
+ ensure
20
+ kill('KILL')
21
+ end
22
+
23
+ def to_h
24
+ { command: command, pid: pid }
25
+ end
26
+
27
+ def wait
28
+ ::Process.wait pid
29
+ end
30
+ end
31
+ end
32
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.25.0'
4
+ VERSION = '0.26.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_ruby_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.0
4
+ version: 0.26.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-20 00:00:00.000000000 Z
11
+ date: 2020-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -129,6 +129,7 @@ files:
129
129
  - lib/eac_ruby_utils/envs/file.rb
130
130
  - lib/eac_ruby_utils/envs/local_env.rb
131
131
  - lib/eac_ruby_utils/envs/process.rb
132
+ - lib/eac_ruby_utils/envs/spawn.rb
132
133
  - lib/eac_ruby_utils/envs/ssh_env.rb
133
134
  - lib/eac_ruby_utils/filesystem_cache.rb
134
135
  - lib/eac_ruby_utils/filesystem_traverser.rb