qbash 0.2.2 → 0.2.3

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: 83183014aa9cde18aa4c0924665c2f1d18940d4f4ff64a66602a0ba973aa1aa0
4
- data.tar.gz: 69881b928dbf2526c9e89542620d27d1cc90ffde48dd369ed2dfbe4051c0e724
3
+ metadata.gz: a765a1decf65f3211a89fb0d0f64faa5a731f463b90e6e2bf7a4b3399b02f2bb
4
+ data.tar.gz: ad56a45ee01b3397b2c1f45674ec7147c804454de8566da50751f5eece1937f1
5
5
  SHA512:
6
- metadata.gz: c4800029b521eb3372ca256ccb874b816207d589753977ede31afb293b9922e7ab477057fdeaca94aa435e0e8ecb47a677fd2e6be39c14a7aacbd0f14aad1d07
7
- data.tar.gz: 0d87c04e4f0e2d85b1208da0824161d6c720a39268e1e3838791d2776b41a331c0f6086429d680ddf1c46429db4b2fb3e211aeac50ef175c9804057a491b6db9
6
+ metadata.gz: 05e3085e88e721c09b3a8613f719a4634b7a77c6837b4a18354e6b1eae2620ac0779c5eab650569e68c533fe73c6dd558b8617b6161578feb63b7e22c65a1929
7
+ data.tar.gz: b9c956477af17a1ea4cce829ef162132059c05336d89bd84863eff354db903a02331399ab15f8fb95b514638605cc5162ad91c1fcebff372d10796cceaa26e92
data/.0pdd.yml CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2024 Yegor Bugayenko
1
+ # Copyright (c) 2024-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2024 Yegor Bugayenko
1
+ # Copyright (c) 2024-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2024 Yegor Bugayenko
1
+ # Copyright (c) 2024-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2024 Yegor Bugayenko
1
+ # Copyright (c) 2024-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2024 Yegor Bugayenko
1
+ # Copyright (c) 2024-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2024 Yegor Bugayenko
1
+ # Copyright (c) 2024-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2024 Yegor Bugayenko
1
+ # Copyright (c) 2024-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2024 Yegor Bugayenko
1
+ # Copyright (c) 2024-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2024 Yegor Bugayenko
1
+ # Copyright (c) 2024-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
data/.rubocop.yml CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2024 Yegor Bugayenko
1
+ # Copyright (c) 2024-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
data/.rultor.yml CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2024 Yegor Bugayenko
1
+ # Copyright (c) 2024-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
data/.simplecov CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #
4
- # Copyright (c) 2024 Yegor Bugayenko
4
+ # Copyright (c) 2024-2025 Yegor Bugayenko
5
5
  #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  # of this software and associated documentation files (the 'Software'), to deal
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2024 Yegor Bugayenko
3
+ # Copyright (c) 2024-2025 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -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.1.0', require: false
33
33
  gem 'rubocop', '1.69.2', require: false
34
- gem 'rubocop-performance', '1.23.0', require: false
34
+ gem 'rubocop-performance', '1.23.1', require: false
35
35
  gem 'rubocop-rspec', '3.3.0', 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
@@ -100,7 +100,7 @@ GEM
100
100
  irb (1.14.1)
101
101
  rdoc (>= 4.0.0)
102
102
  reline (>= 0.4.2)
103
- json (2.9.0)
103
+ json (2.9.1)
104
104
  language_server-protocol (3.17.0.3)
105
105
  logger (1.6.1)
106
106
  loofah (2.23.1)
@@ -162,7 +162,8 @@ GEM
162
162
  zeitwerk (~> 2.6)
163
163
  rainbow (3.1.1)
164
164
  rake (13.2.1)
165
- random-port (0.7.1)
165
+ random-port (0.7.4)
166
+ tago (> 0)
166
167
  rdoc (6.7.0)
167
168
  psych (>= 4.0.0)
168
169
  regexp_parser (2.9.3)
@@ -198,7 +199,7 @@ GEM
198
199
  unicode-display_width (>= 2.4.0, < 4.0)
199
200
  rubocop-ast (1.36.2)
200
201
  parser (>= 3.3.1.0)
201
- rubocop-performance (1.23.0)
202
+ rubocop-performance (1.23.1)
202
203
  rubocop (>= 1.48.1, < 2.0)
203
204
  rubocop-ast (>= 1.31.1, < 2.0)
204
205
  rubocop-rspec (3.3.0)
@@ -253,7 +254,7 @@ DEPENDENCIES
253
254
  random-port (~> 0.0)
254
255
  rspec-rails (= 7.1.0)
255
256
  rubocop (= 1.69.2)
256
- rubocop-performance (= 1.23.0)
257
+ rubocop-performance (= 1.23.1)
257
258
  rubocop-rspec (= 3.3.0)
258
259
  simplecov (= 0.22.0)
259
260
  simplecov-cobertura (= 2.1.0)
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2024 Yegor Bugayenko
3
+ Copyright (c) 2024-2025 Yegor Bugayenko
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the 'Software'), to deal
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2024 Yegor Bugayenko
3
+ # Copyright (c) 2024-2025 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
data/lib/qbash.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2024 Yegor Bugayenko
3
+ # Copyright (c) 2024-2025 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -30,7 +30,7 @@ require 'tago'
30
30
  # Execute one bash command.
31
31
  #
32
32
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
33
- # Copyright:: Copyright (c) 2024 Yegor Bugayenko
33
+ # Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
34
34
  # License:: MIT
35
35
  module Kernel
36
36
  # Execute a single bash command.
@@ -81,33 +81,29 @@ module Kernel
81
81
  buf = ''
82
82
  e = 1
83
83
  start = Time.now
84
- thread =
85
- Thread.new do
86
- Open3.popen2e(env, "/bin/bash -c #{Shellwords.escape(cmd)}") do |sin, sout, thr|
87
- sin.write(stdin)
88
- sin.close
89
- until sout.eof?
90
- begin
91
- ln = sout.gets
92
- rescue IOError => e
93
- ln = Backtrace.new(e).to_s
94
- end
95
- if log.nil?
96
- # no logging
97
- elsif log.respond_to?(mtd)
98
- log.__send__(mtd, ln)
99
- else
100
- log.print("#{ln}\n")
101
- end
102
- buf += ln
103
- end
104
- e = thr.value.to_i
105
- if !accept.nil? && !accept.include?(e)
106
- raise "The command '#{cmd}' failed with exit code ##{e} in #{start.ago}\n#{buf}"
107
- end
84
+ Open3.popen2e(env, "/bin/bash -c #{Shellwords.escape(cmd)}") do |sin, sout, thr|
85
+ sin.write(stdin)
86
+ sin.close
87
+ until sout.eof?
88
+ begin
89
+ ln = sout.gets
90
+ rescue IOError => e
91
+ ln = Backtrace.new(e).to_s
108
92
  end
93
+ if log.nil?
94
+ # no logging
95
+ elsif log.respond_to?(mtd)
96
+ log.__send__(mtd, ln)
97
+ else
98
+ log.print("#{ln}\n")
99
+ end
100
+ buf += ln
101
+ end
102
+ e = thr.value.to_i
103
+ if !accept.nil? && !accept.include?(e)
104
+ raise "The command '#{cmd}' failed with exit code ##{e} in #{start.ago}\n#{buf}"
109
105
  end
110
- thread.join
106
+ end
111
107
  return [buf, e] if both
112
108
  buf
113
109
  end
data/qbash.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2024 Yegor Bugayenko
3
+ # Copyright (c) 2024-2025 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -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.2.2'
29
+ s.version = '0.2.3'
30
30
  s.license = 'MIT'
31
31
  s.summary = 'Quick Executor of a BASH Command'
32
32
  s.description =
data/test/test__helper.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2024 Yegor Bugayenko
3
+ # Copyright (c) 2024-2025 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
data/test/test_qbash.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2024 Yegor Bugayenko
3
+ # Copyright (c) 2024-2025 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -30,7 +30,7 @@ require_relative '../lib/qbash'
30
30
 
31
31
  # Test.
32
32
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
33
- # Copyright:: Copyright (c) 2024 Yegor Bugayenko
33
+ # Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
34
34
  # License:: MIT
35
35
  class TestQbash < Minitest::Test
36
36
  def test_basic_run
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.2.2
4
+ version: 0.2.3
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-12-26 00:00:00.000000000 Z
11
+ date: 2025-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace