arcanus 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/arcanus/command/base.rb +0 -8
- data/lib/arcanus/version.rb +1 -1
- metadata +1 -16
- data/lib/arcanus/subprocess.rb +0 -53
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: caa551eb9873f619f5b09832d491fab87a44feda
|
4
|
+
data.tar.gz: 24e3149808a4fbdd17a5700cdadf88f2d662680a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37867bf501bceeca3527687ef2ad06fc8cfb5a91faf28a2578045252ec9368a6319e7414c569661be69f016f06421a46ff945f8fa958db8b4c86c8b7a78272b7
|
7
|
+
data.tar.gz: 2d51e166a2819307dfbe2ee7f60261e10bd264908735e83d78fe1fb4b3bb4adaa6eef4941c162e8938be10f18e6ba1deb8d24a15cd0941ab1842197c0a2b9292
|
data/lib/arcanus/command/base.rb
CHANGED
@@ -75,13 +75,5 @@ module Arcanus::Command
|
|
75
75
|
def repo
|
76
76
|
@repo ||= Arcanus::Repo.new
|
77
77
|
end
|
78
|
-
|
79
|
-
# Execute a process and return the result including status and output.
|
80
|
-
#
|
81
|
-
# @param args [Array<String>]
|
82
|
-
# @return [#status, #stdout, #stderr]
|
83
|
-
def spawn(args)
|
84
|
-
Arcanus::Subprocess.spawn(args)
|
85
|
-
end
|
86
78
|
end
|
87
79
|
end
|
data/lib/arcanus/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arcanus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brigade Engineering
|
@@ -11,20 +11,6 @@ bindir: bin
|
|
11
11
|
cert_chain: []
|
12
12
|
date: 2017-04-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: childprocess
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - "~>"
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: 0.6.3
|
21
|
-
type: :runtime
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - "~>"
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: 0.6.3
|
28
14
|
- !ruby/object:Gem::Dependency
|
29
15
|
name: diffy
|
30
16
|
requirement: !ruby/object:Gem::Requirement
|
@@ -83,7 +69,6 @@ files:
|
|
83
69
|
- lib/arcanus/key.rb
|
84
70
|
- lib/arcanus/output.rb
|
85
71
|
- lib/arcanus/repo.rb
|
86
|
-
- lib/arcanus/subprocess.rb
|
87
72
|
- lib/arcanus/ui.rb
|
88
73
|
- lib/arcanus/utils.rb
|
89
74
|
- lib/arcanus/version.rb
|
data/lib/arcanus/subprocess.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'childprocess'
|
2
|
-
require 'tempfile'
|
3
|
-
|
4
|
-
module Arcanus
|
5
|
-
# Manages execution of a child process, collecting the exit status and
|
6
|
-
# standard out/error output.
|
7
|
-
class Subprocess
|
8
|
-
# Encapsulates the result of a process.
|
9
|
-
#
|
10
|
-
# @attr_reader status [Integer] exit status code returned by process
|
11
|
-
# @attr_reader stdout [String] standard output stream output
|
12
|
-
# @attr_reader stderr [String] standard error stream output
|
13
|
-
Result = Struct.new(:status, :stdout, :stderr) do
|
14
|
-
def success?
|
15
|
-
status == 0
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
class << self
|
20
|
-
# Spawns a new process using the given array of arguments (the first
|
21
|
-
# element is the command).
|
22
|
-
#
|
23
|
-
# @param args [Array<String>]
|
24
|
-
# @return [Result]
|
25
|
-
def spawn(args)
|
26
|
-
process = ChildProcess.build(*args)
|
27
|
-
|
28
|
-
out, err = assign_output_streams(process)
|
29
|
-
|
30
|
-
process.start
|
31
|
-
process.wait
|
32
|
-
|
33
|
-
err.rewind
|
34
|
-
out.rewind
|
35
|
-
|
36
|
-
Result.new(process.exit_code, out.read, err.read)
|
37
|
-
end
|
38
|
-
|
39
|
-
private
|
40
|
-
|
41
|
-
# @param process [ChildProcess]
|
42
|
-
# @return [Array<IO>]
|
43
|
-
def assign_output_streams(process)
|
44
|
-
%w[out err].map do |stream_name|
|
45
|
-
::Tempfile.new(stream_name).tap do |stream|
|
46
|
-
stream.sync = true
|
47
|
-
process.io.send("std#{stream_name}=", stream)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|