fiedl-log 0.5.0 → 0.6.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 +4 -4
- data/lib/fiedl/log/log.rb +20 -11
- data/lib/fiedl/log/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8eb4f350bd36e35109a6fc799ba1b4af7e5173c79c13cdbe69277a9b1a36a9dd
|
4
|
+
data.tar.gz: 41200374085c40159f3c5c71f25a36af634a38f3304e713440d469c1f7b00261
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af4d6d196b38eb29e74ca4675b38620b4022c6648a9f3b89a65c78e7525135e0a436aef99c010ebaf559ad93582ba39dc1824d958301fc07fae1ccb132f399c5
|
7
|
+
data.tar.gz: 11609ac7033c010650d6a3c2e135d5d50fd0d9768b1c62e45717a51690ea23484bbf0875899505b52371fc55d8b77f29585be553469c899ef348d85228ee4c80
|
data/lib/fiedl/log/log.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
|
1
3
|
class Fiedl::Log::Log
|
2
4
|
|
3
5
|
def head(text)
|
@@ -55,22 +57,29 @@ class Fiedl::Log::Log
|
|
55
57
|
super(text)
|
56
58
|
end
|
57
59
|
|
58
|
-
# Print
|
59
|
-
#
|
60
|
+
# Print command, execute it and display result.
|
61
|
+
# The command may be interactive.
|
62
|
+
#
|
63
|
+
# https://stackoverflow.com/a/20187740/2066546
|
64
|
+
# http://stackoverflow.com/a/10224650/2066546
|
65
|
+
# https://stackoverflow.com/q/20072781/2066546
|
66
|
+
# https://stackoverflow.com/a/29712307/2066546
|
60
67
|
#
|
61
68
|
def shell(command, verbose: true)
|
62
69
|
prompt command if verbose
|
63
70
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
+
file = Tempfile.new("fiedl-log")
|
72
|
+
@return_code = system "script -q #{file.path} #{command}"
|
73
|
+
output = file.read
|
74
|
+
|
75
|
+
return output
|
76
|
+
ensure
|
77
|
+
file.close
|
78
|
+
file.unlink
|
79
|
+
end
|
71
80
|
|
72
|
-
|
73
|
-
|
81
|
+
def return_code
|
82
|
+
@return_code
|
74
83
|
end
|
75
84
|
|
76
85
|
# Ensure that a certain file is present.
|
data/lib/fiedl/log/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fiedl-log
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Fiedlschuster
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -92,7 +92,7 @@ homepage: https://github.com/fiedl/fiedl-log
|
|
92
92
|
licenses:
|
93
93
|
- MIT
|
94
94
|
metadata: {}
|
95
|
-
post_install_message:
|
95
|
+
post_install_message:
|
96
96
|
rdoc_options: []
|
97
97
|
require_paths:
|
98
98
|
- lib
|
@@ -108,8 +108,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
|
-
rubygems_version: 3.
|
112
|
-
signing_key:
|
111
|
+
rubygems_version: 3.3.11
|
112
|
+
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: Simple colored output helper for ruby scripts.
|
115
115
|
test_files: []
|