runtime_command 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -0
- data/example/sample.rb +6 -0
- data/lib/runtime_command/builder.rb +4 -2
- data/lib/runtime_command/logger.rb +4 -14
- data/lib/runtime_command/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc44f41a931faf6b83ccc2c9a1c3ecac48205426
|
4
|
+
data.tar.gz: 49608abc877d1fae72e6bb0ed52109aedec90d8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa01723fac8233d2e46e9839109fce6a4d0975366fa75d1494ab6e2ce1e24d2a72f70fb2e509c2a9afdcfa8055c0245841a336a53f6f1ca6b9a0c269203605bc
|
7
|
+
data.tar.gz: e42fc359bbe2d682fce10c0ae9d84ed989239e4dcdd288b09b1cd408ecb0f0bbcc568a9687acd4c450c911bb66f772e8d37f51c6ca114831eab6879a40e31e8b
|
data/README.md
CHANGED
data/example/sample.rb
CHANGED
@@ -3,3 +3,9 @@ require 'runtime_command'
|
|
3
3
|
|
4
4
|
command = RuntimeCommand::Builder.new
|
5
5
|
command.exec('echo "wait 3" sec; sleep 3; echo "hello world!"')
|
6
|
+
|
7
|
+
# command.output = false
|
8
|
+
# puts command.exec('ls -la').buffered_stdout
|
9
|
+
|
10
|
+
# command.colors[:stdout] = HighLine::Style.rgb(255, 0, 0)
|
11
|
+
# command.exec('ls -la')
|
@@ -13,6 +13,7 @@ module RuntimeCommand
|
|
13
13
|
@output = true
|
14
14
|
@buffered_log = ''
|
15
15
|
@stdin_prefix = '>'
|
16
|
+
@colors = {}
|
16
17
|
end
|
17
18
|
|
18
19
|
# @param [String] command
|
@@ -37,10 +38,11 @@ module RuntimeCommand
|
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
40
|
-
|
41
|
-
|
41
|
+
rescue Interrupt
|
42
|
+
logger.stderr('Interrupt error')
|
42
43
|
rescue => e
|
43
44
|
logger.stderr(e.to_s)
|
45
|
+
ensure
|
44
46
|
@buffered_log << logger.buffered_log
|
45
47
|
end
|
46
48
|
|
@@ -7,22 +7,12 @@ module RuntimeCommand
|
|
7
7
|
# @param [Boolean] output
|
8
8
|
# @param [Hash] colors
|
9
9
|
# @return RuntimeCommand::Logger
|
10
|
-
def initialize(output = true, colors =
|
10
|
+
def initialize(output = true, colors = {})
|
11
11
|
@output = output
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
if colors
|
18
|
-
stdin_rgb = colors[:stdin] if colors.has_key?(:stdin)
|
19
|
-
stdout_rgb = colors[:stdout] if colors.has_key?(:stdout)
|
20
|
-
stderr_rgb = colors[:stderr] if colors.has_key?(:stderr)
|
21
|
-
end
|
22
|
-
|
23
|
-
@stdin_color = HighLine::Style.rgb(*stdin_rgb)
|
24
|
-
@stdout_color = HighLine::Style.rgb(*stdout_rgb)
|
25
|
-
@stderr_color = HighLine::Style.rgb(*stderr_rgb)
|
13
|
+
@stdin_color = colors[:stdin] || HighLine::Style.rgb(204, 204, 0)
|
14
|
+
@stdout_color = colors[:stdout] || HighLine::Style.rgb(64, 64, 64)
|
15
|
+
@stderr_color = colors[:stderr] || HighLine::Style.rgb(255, 51, 51)
|
26
16
|
|
27
17
|
flash
|
28
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: runtime_command
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- naomichi-y
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|