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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: efe5adcd3fe993ed0b35a1d640b77e50d42611e4c87efd296656c82680bbe19e
4
- data.tar.gz: 91276213aee2b1a56b3b983e3779d47da9c2de4b2f16fd9fa1603173d12ec522
3
+ metadata.gz: f62b4f72ffaff00cb6e0f7d7f53159e48716746a157e367807771f4fceeef249
4
+ data.tar.gz: 761e3df2ac357a5591bc4d873b87f419926f73a5e06b42553e9c0d9d1924ab16
5
5
  SHA512:
6
- metadata.gz: 3d3159b1a53f1649a220c6cd41f00fe8c9621c26460715d2352c1ff010c84de2f8ced1a06ce4de998da16f43a9d254429b37f825a370059dad1828b820c28060
7
- data.tar.gz: '094d9b3afbc63cb7b94888873e602badf0dc2dd6dee3c2a13c79d2865ee7c1270f52136df5472c9c080f1f157778808033ffe3a4989b72cba6dbcf5d83d57c3c'
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
- [![Build Status](https://secure.travis-ci.org/piotrmurach/tty-command.svg?branch=master)][travis]
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
- [travis]: http://travis-ci.org/piotrmurach/tty-command
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
@@ -174,7 +174,7 @@ module TTY
174
174
  # @api private
175
175
  def command(*args)
176
176
  cmd = Cmd.new(*args)
177
- cmd.update(**@cmd_options)
177
+ cmd.update(@cmd_options)
178
178
  cmd
179
179
  end
180
180
 
@@ -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.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: argv,
134
- uuid: uuid
142
+ argv: argv,
143
+ uuid: uuid
135
144
  }
136
145
  end
137
146
 
@@ -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 { |line| yield(line) }
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
@@ -61,7 +61,7 @@ module TTY
61
61
  return @prefix << @suffix
62
62
  end
63
63
 
64
- @prefix + "\n... omitting #{@skipped} bytes ...\n" + @suffix
64
+ @prefix + "\n... omitting #{@skipped} bytes ...\n" + @suffix
65
65
  end
66
66
  alias to_s read
67
67
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module TTY
4
4
  class Command
5
- VERSION = "0.10.0"
5
+ VERSION = "0.10.1"
6
6
  end # Command
7
7
  end # TTY
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.0
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: 2020-10-22 00:00:00.000000000 Z
11
+ date: 2021-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pastel