runtime_command 0.1.4 → 0.1.5
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 +4 -4
- data/lib/runtime_command/builder.rb +14 -0
- data/lib/runtime_command/logger.rb +6 -0
- 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: 17f103bf5c46fbe2b771a455ffad78cafbf987e4
|
4
|
+
data.tar.gz: 49b9fbfb70bd5def5df84af7cf9327baefce547a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0a1b6422e20b95da363a1ee89769794528fb1a0cb65278bebf8eca88d81fe98be5853547298f998890f2f0894bcb44601cbfc55b0e5a43f3bb765b4a12b5ef4
|
7
|
+
data.tar.gz: 4abed7ff903b81b5320e89c83d5bf1e05e022b2dfa404047f0b96c7084cc223cc818a307fb146ea4b751347d1ad3f65c1ed4b0fa0e140556086a676e0272bc17
|
@@ -6,6 +6,8 @@ module RuntimeCommand
|
|
6
6
|
attr_reader :buffered_log
|
7
7
|
attr_accessor :stdin_prefix, :colors, :output
|
8
8
|
|
9
|
+
# @param [String] base_dir
|
10
|
+
# @return [RuntimeCommand::Builder]
|
9
11
|
def initialize(base_dir = '.')
|
10
12
|
@base_dir = base_dir
|
11
13
|
@output = true
|
@@ -13,6 +15,9 @@ module RuntimeCommand
|
|
13
15
|
@stdin_prefix = '>'
|
14
16
|
end
|
15
17
|
|
18
|
+
# @param [String] command
|
19
|
+
# @param [String] chdir
|
20
|
+
# @return [RuntimeCommand::Logger]
|
16
21
|
def exec(command, chdir = nil)
|
17
22
|
chdir ||= @base_dir
|
18
23
|
|
@@ -41,5 +46,14 @@ module RuntimeCommand
|
|
41
46
|
|
42
47
|
logger
|
43
48
|
end
|
49
|
+
|
50
|
+
# @param [String] line
|
51
|
+
def puts(line)
|
52
|
+
logger = Logger.new(@output, @colors)
|
53
|
+
logger.stdout(line)
|
54
|
+
|
55
|
+
@buffered_log << logger.buffered_log
|
56
|
+
return
|
57
|
+
end
|
44
58
|
end
|
45
59
|
end
|
@@ -4,6 +4,9 @@ module RuntimeCommand
|
|
4
4
|
class Logger
|
5
5
|
attr_reader :buffered_log, :buffered_stdout, :buffered_stderr
|
6
6
|
|
7
|
+
# @param [Boolean] output
|
8
|
+
# @param [Hash] colors
|
9
|
+
# @return RuntimeCommand::Logger
|
7
10
|
def initialize(output = true, colors = nil)
|
8
11
|
@output = output
|
9
12
|
|
@@ -24,6 +27,7 @@ module RuntimeCommand
|
|
24
27
|
flash
|
25
28
|
end
|
26
29
|
|
30
|
+
# @param [string] line
|
27
31
|
def stdin(line)
|
28
32
|
puts HighLine.color(line, @stdin_color) if @output
|
29
33
|
@buffered_log << line + "\n"
|
@@ -31,6 +35,7 @@ module RuntimeCommand
|
|
31
35
|
return
|
32
36
|
end
|
33
37
|
|
38
|
+
# @param [String] line
|
34
39
|
def stdout(line)
|
35
40
|
puts HighLine.color(line.chomp, @stdout_color) if @output
|
36
41
|
|
@@ -40,6 +45,7 @@ module RuntimeCommand
|
|
40
45
|
return
|
41
46
|
end
|
42
47
|
|
48
|
+
# @param [String] line
|
43
49
|
def stderr(line)
|
44
50
|
puts HighLine.color(line.chomp, @stderr_color) if @output
|
45
51
|
|
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.5
|
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-02-
|
11
|
+
date: 2017-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|