qbash 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fccb41b161a6c90a23d521fa77e25afa0524e90fe208e3438c9b4d5af83d6c78
4
- data.tar.gz: 85260c4600d72f50d1c3fe38030ea9a939c62e335c5ca2851b25d9d5a2c68696
3
+ metadata.gz: 74362bdd955fbbdf87abf2855c79d2aeecab2578f8bbc5f5b35003b4935c4e17
4
+ data.tar.gz: 4153458c48d71d04d6d94fda9e589149e97519a9cded80ca1f1ad059ab06c75e
5
5
  SHA512:
6
- metadata.gz: c709f5c9ca3b1683d11e9bbc019e84fbf4a9c782e043fe36f88b0467f3a63123713eea48a0d8bd2f24c3ebb9fbbb2edaf4c796b0dc73615ccea8e4f5bb248953
7
- data.tar.gz: 2343e378d673146501843e35998b7e3efbd0ca8f32e3ee1e67b46dc96319d0f1e0fa23caf118da2e883135360b00a168ce7b4e5809bcd8e6c02726273ee87585
6
+ metadata.gz: 4c728817527bd343c532664a39f3ee8eb8be3ca172cbf974e9a7d410c0eb9fa34a11c264d53fe0d6daddf33d09aca96b9355d3985121a85bb18ca69cd1be5fae
7
+ data.tar.gz: f5a5a9edb0de50f1c598e626173e6d4252e8db06cfe256632eb5002ef0393c92c046080d64892a8758eb40e32972753b2c58a2af6dbbaf34623284057c9ed65a
data/Gemfile CHANGED
@@ -31,7 +31,7 @@ gem 'rake', '13.2.1', require: false
31
31
  gem 'random-port', '~>0.0', require: false
32
32
  gem 'rspec-rails', '7.0.1', require: false
33
33
  gem 'rubocop', '1.66.1', require: false
34
- gem 'rubocop-performance', '1.21.1', require: false
34
+ gem 'rubocop-performance', '1.22.1', require: false
35
35
  gem 'rubocop-rspec', '3.0.5', require: false
36
36
  gem 'simplecov', '0.22.0', require: false
37
37
  gem 'simplecov-cobertura', '2.1.0', require: false
data/Gemfile.lock CHANGED
@@ -196,7 +196,7 @@ GEM
196
196
  unicode-display_width (>= 2.4.0, < 3.0)
197
197
  rubocop-ast (1.32.3)
198
198
  parser (>= 3.3.1.0)
199
- rubocop-performance (1.21.1)
199
+ rubocop-performance (1.22.1)
200
200
  rubocop (>= 1.48.1, < 2.0)
201
201
  rubocop-ast (>= 1.31.1, < 2.0)
202
202
  rubocop-rspec (3.0.5)
@@ -252,7 +252,7 @@ DEPENDENCIES
252
252
  random-port (~> 0.0)
253
253
  rspec-rails (= 7.0.1)
254
254
  rubocop (= 1.66.1)
255
- rubocop-performance (= 1.21.1)
255
+ rubocop-performance (= 1.22.1)
256
256
  rubocop-rspec (= 3.0.5)
257
257
  simplecov (= 0.22.0)
258
258
  simplecov-cobertura (= 2.1.0)
data/README.md CHANGED
@@ -35,6 +35,23 @@ stdout = qbash('cat > $FILE', env: { 'FILE' => 'a.txt' }, stdin: 'Hello!')
35
35
  It's possible to configure the logging facility too, with the help
36
36
  of the [loog](https://github.com/yegor256/loog) gem.
37
37
 
38
+ You can also make it return both stdout and exit code, with the help
39
+ of the `both` option set to `true`:
40
+
41
+ ```ruby
42
+ stdout, code = qbash('cat a.txt', both: true, accept: [])
43
+ ```
44
+
45
+ Here, the `accept` param contains the list of exit codes that are "acceptable"
46
+ and won't lead to runtime failures. When the list is empty, all exists are
47
+ acceptable (there will be no failures ever).
48
+
49
+ The command may be provided as an array, which automatically will be
50
+ converted to a string by joining all items with spaces between them.
51
+
52
+ It is very much recommended to escape all command-line values with the help
53
+ of [Shellwords.escape][shellwords].
54
+
38
55
  ## How to contribute
39
56
 
40
57
  Read
@@ -50,3 +67,5 @@ bundle exec rake
50
67
  ```
51
68
 
52
69
  If it's clean and you don't see any error messages, submit your pull request.
70
+
71
+ [shellwords]: https://ruby-doc.org/stdlib-3.0.1/libdoc/shellwords/rdoc/Shellwords.html
data/lib/qbash.rb CHANGED
@@ -20,9 +20,10 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  # SOFTWARE.
22
22
 
23
- require 'open3'
24
- require 'loog'
25
23
  require 'backtrace'
24
+ require 'loog'
25
+ require 'open3'
26
+ require 'shellwords'
26
27
 
27
28
  # Execute one bash command.
28
29
  #
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.1'
29
+ s.version = '0.0.2'
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.1
4
+ version: 0.0.2
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-16 00:00:00.000000000 Z
11
+ date: 2024-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace