tty-command 0.10.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/README.md +2 -2
- data/lib/tty/command.rb +1 -1
- data/lib/tty/command/cmd.rb +12 -3
- data/lib/tty/command/result.rb +4 -2
- data/lib/tty/command/truncator.rb +1 -1
- data/lib/tty/command/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f62b4f72ffaff00cb6e0f7d7f53159e48716746a157e367807771f4fceeef249
|
4
|
+
data.tar.gz: 761e3df2ac357a5591bc4d873b87f419926f73a5e06b42553e9c0d9d1924ab16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f32eb43589d385247d787d3d4d263760e764111cc125a4651f5372b456d6a0464572d30aff6a3b3c9872dbf913c2281b7d094cab0d4c3bb7f31d03c131e1cfa
|
7
|
+
data.tar.gz: 668d73499b869f65cb8bf3e6eafcf2b8a7d130fbf1821a8681be70464399c31cc192fff20055ae928395c14e59bd21ecf459b1dc2afe647fb4112fd69855cdbb
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## [v0.10.1] - 2021-02-14
|
4
|
+
|
5
|
+
### Fixed
|
6
|
+
* Fix undesired persistence of environment variables in Ruby >= 3.0.0
|
7
|
+
|
3
8
|
## [v0.10.0] - 2020-10-22
|
4
9
|
|
5
10
|
### Changed
|
@@ -140,6 +145,7 @@
|
|
140
145
|
|
141
146
|
* Initial implementation and release
|
142
147
|
|
148
|
+
[v0.10.1]: https://github.com/piotrmurach/tty-command/compare/v0.10.0...v0.10.1
|
143
149
|
[v0.10.0]: https://github.com/piotrmurach/tty-command/compare/v0.9.0...v0.10.0
|
144
150
|
[v0.9.0]: https://github.com/piotrmurach/tty-command/compare/v0.8.2...v0.9.0
|
145
151
|
[v0.8.2]: https://github.com/piotrmurach/tty-command/compare/v0.8.1...v0.8.2
|
@@ -154,4 +160,4 @@
|
|
154
160
|
[v0.3.1]: https://github.com/piotrmurach/tty-command/compare/v0.3.0...v0.3.1
|
155
161
|
[v0.3.0]: https://github.com/piotrmurach/tty-command/compare/v0.2.0...v0.3.0
|
156
162
|
[v0.2.0]: https://github.com/piotrmurach/tty-command/compare/v0.1.0...v0.2.0
|
157
|
-
[v0.1.0]: https://github.com/piotrmurach/tty-command/compare/v0.1.0
|
163
|
+
[v0.1.0]: https://github.com/piotrmurach/tty-command/compare/953ccdd...v0.1.0
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# TTY::Command [![Gitter](https://badges.gitter.im/Join%20Chat.svg)][gitter]
|
6
6
|
|
7
7
|
[![Gem Version](https://badge.fury.io/rb/tty-command.svg)][gem]
|
8
|
-
[![
|
8
|
+
[![Actions CI](https://github.com/piotrmurach/tty-command/workflows/CI/badge.svg?branch=master)][gh_actions_ci]
|
9
9
|
[![Build status](https://ci.appveyor.com/api/projects/status/0150ync7bdkfhmsv?svg=true)][appveyor]
|
10
10
|
[![Code Climate](https://codeclimate.com/github/piotrmurach/tty-command/badges/gpa.svg)][codeclimate]
|
11
11
|
[![Coverage Status](https://coveralls.io/repos/github/piotrmurach/tty-command/badge.svg)][coverage]
|
@@ -13,7 +13,7 @@
|
|
13
13
|
|
14
14
|
[gitter]: https://gitter.im/piotrmurach/tty
|
15
15
|
[gem]: http://badge.fury.io/rb/tty-command
|
16
|
-
[
|
16
|
+
[gh_actions_ci]: https://github.com/piotrmurach/tty-command/actions?query=workflow%3ACI
|
17
17
|
[appveyor]: https://ci.appveyor.com/project/piotrmurach/tty-command
|
18
18
|
[codeclimate]: https://codeclimate.com/github/piotrmurach/tty-command
|
19
19
|
[coverage]: https://coveralls.io/github/piotrmurach/tty-command
|
data/lib/tty/command.rb
CHANGED
data/lib/tty/command/cmd.rb
CHANGED
@@ -5,6 +5,9 @@ require "shellwords"
|
|
5
5
|
|
6
6
|
module TTY
|
7
7
|
class Command
|
8
|
+
# Encapsulates the executed command
|
9
|
+
#
|
10
|
+
# @api private
|
8
11
|
class Cmd
|
9
12
|
# A string command name, or shell program
|
10
13
|
# @api public
|
@@ -41,6 +44,7 @@ module TTY
|
|
41
44
|
|
42
45
|
if args.empty? && cmd = command.to_s
|
43
46
|
raise ArgumentError, "No command provided" if cmd.empty?
|
47
|
+
|
44
48
|
@command = sanitize(cmd)
|
45
49
|
@argv = []
|
46
50
|
else
|
@@ -64,7 +68,7 @@ module TTY
|
|
64
68
|
#
|
65
69
|
# @api public
|
66
70
|
def update(options)
|
67
|
-
@options.update(options.
|
71
|
+
@options.update(options.merge(@options))
|
68
72
|
end
|
69
73
|
|
70
74
|
# The shell environment variables
|
@@ -84,27 +88,32 @@ module TTY
|
|
84
88
|
|
85
89
|
def evars(value, &block)
|
86
90
|
return (value || block) unless environment.any?
|
91
|
+
|
87
92
|
"( export #{environment_string} ; #{value || block.call} )"
|
88
93
|
end
|
89
94
|
|
90
95
|
def umask(value)
|
91
96
|
return value unless options[:umask]
|
97
|
+
|
92
98
|
%(umask #{options[:umask]} && %s) % [value]
|
93
99
|
end
|
94
100
|
|
95
101
|
def chdir(value)
|
96
102
|
return value unless options[:chdir]
|
103
|
+
|
97
104
|
%(cd #{Shellwords.escape(options[:chdir])} && #{value})
|
98
105
|
end
|
99
106
|
|
100
107
|
def user(value)
|
101
108
|
return value unless options[:user]
|
109
|
+
|
102
110
|
vars = environment.any? ? "#{environment_string} " : ""
|
103
111
|
%(sudo -u #{options[:user]} #{vars}-- sh -c '%s') % [value]
|
104
112
|
end
|
105
113
|
|
106
114
|
def group(value)
|
107
115
|
return value unless options[:group]
|
116
|
+
|
108
117
|
%(sg #{options[:group]} -c \\\"%s\\\") % [value]
|
109
118
|
end
|
110
119
|
|
@@ -130,8 +139,8 @@ module TTY
|
|
130
139
|
def to_hash
|
131
140
|
{
|
132
141
|
command: command,
|
133
|
-
argv:
|
134
|
-
uuid:
|
142
|
+
argv: argv,
|
143
|
+
uuid: uuid
|
135
144
|
}
|
136
145
|
end
|
137
146
|
|
data/lib/tty/command/result.rb
CHANGED
@@ -34,12 +34,13 @@ module TTY
|
|
34
34
|
# @param [String] separator
|
35
35
|
#
|
36
36
|
# @api public
|
37
|
-
def each(separator = nil)
|
37
|
+
def each(separator = nil, &block)
|
38
38
|
sep = separator || TTY::Command.record_separator
|
39
39
|
return unless @out
|
40
|
+
|
40
41
|
elements = @out.split(sep)
|
41
42
|
if block_given?
|
42
|
-
elements.each
|
43
|
+
elements.each(&block)
|
43
44
|
else
|
44
45
|
elements.to_enum
|
45
46
|
end
|
@@ -82,6 +83,7 @@ module TTY
|
|
82
83
|
|
83
84
|
def ==(other)
|
84
85
|
return false unless other.is_a?(TTY::Command::Result)
|
86
|
+
|
85
87
|
@status == other.to_i && to_ary == other.to_ary
|
86
88
|
end
|
87
89
|
end # Result
|
data/lib/tty/command/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tty-command
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Murach
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pastel
|