qbash 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/lib/qbash.rb +1 -1
  4. data/qbash.gemspec +1 -1
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d3ac44ac6da719be360ee7785811de7c2b465efbe274c8ae9f7b0992647c05c0
4
- data.tar.gz: cf4e840be85b2b9fc19df98fc2e7f45f45b6c93a525b209a4f715be104870ef5
3
+ metadata.gz: 513c4fae2df78a6b4ae254b80dcd5e306c34a68cb8c1e869c3073ee612504d41
4
+ data.tar.gz: 424695c22db403cfa8ad40def087742cb804a08e4d5c858f378c02ebd3a12303
5
5
  SHA512:
6
- metadata.gz: 5eaf974307cfb04ead1c2a890c6c34cb68c1ba9a1f4a3e1f2b858f5eda0579361296fb5e95f8fd3349455f07b5acf4ea8a9fac400f6cde5ace0d1f7381b64cb9
7
- data.tar.gz: 554613f18dd98fcac12d7e0d4ce56f1cc8d0aaeaea5866fad42ef41f5bb96dfaddb37d00b75fdefde6665eb0b59f1f1add15668d618379e1e14829457b87844f
6
+ metadata.gz: 9fd4f01dd7ba2cbc6da044367d45d14a07e699c632e9ce421674b151095972465e7e3cd86e13bc3efcc80b29a33c9d62cf976c94b56db82578026a0734ba64e3
7
+ data.tar.gz: e71a4444310641326ce9eb07d312eeaa5157f1c78faf8dcc0c1effc068df8ce50a3bcc3b184849ade9079bfb936a076bf774834ba1590191fe81ea62c835f8b9
data/README.md CHANGED
@@ -27,7 +27,7 @@ Then, you can use [qbash][qbash] global function:
27
27
 
28
28
  ```ruby
29
29
  require 'qbash'
30
- stdout = qbash('echo "Hello, world!"')
30
+ stdout = qbash('echo "Hello, world!"', log: $stdout)
31
31
  ```
32
32
 
33
33
  If the command fails, an exception will be raised.
@@ -38,13 +38,13 @@ It's possible to provide the standard input and environment variables:
38
38
  stdout = qbash('cat > $FILE', env: { 'FILE' => 'a.txt' }, stdin: 'Hello!')
39
39
  ```
40
40
 
41
- It's possible to configure the logging facility too, with the help
41
+ It's possible to configure the logging facility too, for example, with the help
42
42
  of the [loog](https://github.com/yegor256/loog) gem (the output
43
43
  will be returned _and_ printed to the logger):
44
44
 
45
45
  ```ruby
46
46
  require 'loog'
47
- qbash('echo "Hello, world!"', loog: Loog::VERBOSE)
47
+ qbash('echo "Hello, world!"', log: Loog::VERBOSE)
48
48
  ```
49
49
 
50
50
  You can also make it return both stdout and exit code, with the help
data/lib/qbash.rb CHANGED
@@ -45,6 +45,7 @@ module Kernel
45
45
  # @param [Boolean] both If set to TRUE, the function returns an array +(stdout, code)+
46
46
  # @return [String] Everything that was printed to the +stdout+ by the command
47
47
  def qbash(cmd, stdin: '', env: {}, log: Loog::NULL, accept: [0], both: false)
48
+ cmd = cmd.join(' ') if cmd.is_a?(Array)
48
49
  if log.respond_to?(:debug)
49
50
  log.debug("+ #{cmd}")
50
51
  else
@@ -52,7 +53,6 @@ module Kernel
52
53
  end
53
54
  buf = ''
54
55
  e = 1
55
- cmd = cmd.join(' ') if cmd.is_a?(Array)
56
56
  Open3.popen2e(env, "/bin/bash -c #{Shellwords.escape(cmd)}") do |sin, sout, thr|
57
57
  sin.write(stdin)
58
58
  sin.close
data/qbash.gemspec CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
27
27
  s.required_ruby_version = '>=3.2'
28
28
  s.name = 'qbash'
29
- s.version = '0.0.3'
29
+ s.version = '0.0.4'
30
30
  s.license = 'MIT'
31
31
  s.summary = 'Quick Executor of a BASH Command'
32
32
  s.description =
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qbash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-23 00:00:00.000000000 Z
11
+ date: 2024-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace