qbash 0.3.2 → 0.4.1
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 +4 -4
 - data/.0pdd.yml +2 -19
 - data/.github/workflows/actionlint.yml +3 -20
 - data/.github/workflows/codecov.yml +4 -20
 - data/.github/workflows/copyrights.yml +3 -19
 - data/.github/workflows/markdown-lint.yml +3 -19
 - data/.github/workflows/pdd.yml +3 -19
 - data/.github/workflows/rake.yml +4 -20
 - data/.github/workflows/reuse.yml +19 -0
 - data/.github/workflows/typos.yml +19 -0
 - data/.github/workflows/xcop.yml +3 -19
 - data/.github/workflows/yamllint.yml +3 -19
 - data/.gitignore +7 -5
 - data/.rubocop.yml +3 -21
 - data/.rultor.yml +4 -20
 - data/Gemfile +16 -35
 - data/Gemfile.lock +61 -162
 - data/LICENSES/MIT.txt +21 -0
 - data/README.md +22 -9
 - data/REUSE.toml +34 -0
 - data/Rakefile +2 -21
 - data/lib/qbash.rb +81 -47
 - data/qbash.gemspec +3 -20
 - data/test/test__helper.rb +20 -23
 - data/test/test_qbash.rb +2 -19
 - metadata +8 -8
 - data/.simplecov +0 -41
 
    
        data/Gemfile.lock
    CHANGED
    
    | 
         @@ -10,50 +10,16 @@ PATH 
     | 
|
| 
       10 
10 
     | 
    
         
             
            GEM
         
     | 
| 
       11 
11 
     | 
    
         
             
              remote: https://rubygems.org/
         
     | 
| 
       12 
12 
     | 
    
         
             
              specs:
         
     | 
| 
       13 
     | 
    
         
            -
                actionpack (8.0.1)
         
     | 
| 
       14 
     | 
    
         
            -
                  actionview (= 8.0.1)
         
     | 
| 
       15 
     | 
    
         
            -
                  activesupport (= 8.0.1)
         
     | 
| 
       16 
     | 
    
         
            -
                  nokogiri (>= 1.8.5)
         
     | 
| 
       17 
     | 
    
         
            -
                  rack (>= 2.2.4)
         
     | 
| 
       18 
     | 
    
         
            -
                  rack-session (>= 1.0.1)
         
     | 
| 
       19 
     | 
    
         
            -
                  rack-test (>= 0.6.3)
         
     | 
| 
       20 
     | 
    
         
            -
                  rails-dom-testing (~> 2.2)
         
     | 
| 
       21 
     | 
    
         
            -
                  rails-html-sanitizer (~> 1.6)
         
     | 
| 
       22 
     | 
    
         
            -
                  useragent (~> 0.16)
         
     | 
| 
       23 
     | 
    
         
            -
                actionview (8.0.1)
         
     | 
| 
       24 
     | 
    
         
            -
                  activesupport (= 8.0.1)
         
     | 
| 
       25 
     | 
    
         
            -
                  builder (~> 3.1)
         
     | 
| 
       26 
     | 
    
         
            -
                  erubi (~> 1.11)
         
     | 
| 
       27 
     | 
    
         
            -
                  rails-dom-testing (~> 2.2)
         
     | 
| 
       28 
     | 
    
         
            -
                  rails-html-sanitizer (~> 1.6)
         
     | 
| 
       29 
     | 
    
         
            -
                activesupport (8.0.1)
         
     | 
| 
       30 
     | 
    
         
            -
                  base64
         
     | 
| 
       31 
     | 
    
         
            -
                  benchmark (>= 0.3)
         
     | 
| 
       32 
     | 
    
         
            -
                  bigdecimal
         
     | 
| 
       33 
     | 
    
         
            -
                  concurrent-ruby (~> 1.0, >= 1.3.1)
         
     | 
| 
       34 
     | 
    
         
            -
                  connection_pool (>= 2.2.5)
         
     | 
| 
       35 
     | 
    
         
            -
                  drb
         
     | 
| 
       36 
     | 
    
         
            -
                  i18n (>= 1.6, < 2)
         
     | 
| 
       37 
     | 
    
         
            -
                  logger (>= 1.4.2)
         
     | 
| 
       38 
     | 
    
         
            -
                  minitest (>= 5.1)
         
     | 
| 
       39 
     | 
    
         
            -
                  securerandom (>= 0.3)
         
     | 
| 
       40 
     | 
    
         
            -
                  tzinfo (~> 2.0, >= 2.0.5)
         
     | 
| 
       41 
     | 
    
         
            -
                  uri (>= 0.13.1)
         
     | 
| 
       42 
13 
     | 
    
         
             
                addressable (2.8.7)
         
     | 
| 
       43 
14 
     | 
    
         
             
                  public_suffix (>= 2.0.2, < 7.0)
         
     | 
| 
       44 
15 
     | 
    
         
             
                ansi (1.5.0)
         
     | 
| 
       45 
     | 
    
         
            -
                ast (2.4. 
     | 
| 
      
 16 
     | 
    
         
            +
                ast (2.4.3)
         
     | 
| 
       46 
17 
     | 
    
         
             
                backtrace (0.4.0)
         
     | 
| 
       47 
     | 
    
         
            -
                base64 (0.2.0)
         
     | 
| 
       48 
     | 
    
         
            -
                benchmark (0.4.0)
         
     | 
| 
       49 
18 
     | 
    
         
             
                bigdecimal (3.1.9)
         
     | 
| 
       50 
19 
     | 
    
         
             
                builder (3.3.0)
         
     | 
| 
       51 
     | 
    
         
            -
                concurrent-ruby (1.3.5)
         
     | 
| 
       52 
     | 
    
         
            -
                connection_pool (2.5.0)
         
     | 
| 
       53 
20 
     | 
    
         
             
                crack (1.0.0)
         
     | 
| 
       54 
21 
     | 
    
         
             
                  bigdecimal
         
     | 
| 
       55 
22 
     | 
    
         
             
                  rexml
         
     | 
| 
       56 
     | 
    
         
            -
                crass (1.0.6)
         
     | 
| 
       57 
23 
     | 
    
         
             
                cucumber (9.2.1)
         
     | 
| 
       58 
24 
     | 
    
         
             
                  builder (~> 3.2)
         
     | 
| 
       59 
25 
     | 
    
         
             
                  cucumber-ci-environment (> 9, < 11)
         
     | 
| 
         @@ -79,39 +45,28 @@ GEM 
     | 
|
| 
       79 
45 
     | 
    
         
             
                  cucumber-messages (> 19, < 28)
         
     | 
| 
       80 
46 
     | 
    
         
             
                cucumber-messages (22.0.0)
         
     | 
| 
       81 
47 
     | 
    
         
             
                cucumber-tag-expressions (6.1.2)
         
     | 
| 
       82 
     | 
    
         
            -
                 
     | 
| 
       83 
     | 
    
         
            -
                diff-lcs (1.5.1)
         
     | 
| 
      
 48 
     | 
    
         
            +
                diff-lcs (1.6.1)
         
     | 
| 
       84 
49 
     | 
    
         
             
                docile (1.4.1)
         
     | 
| 
       85 
     | 
    
         
            -
                drb (2.2.1)
         
     | 
| 
       86 
50 
     | 
    
         
             
                elapsed (0.0.1)
         
     | 
| 
       87 
51 
     | 
    
         
             
                  loog (> 0)
         
     | 
| 
       88 
52 
     | 
    
         
             
                  tago (> 0)
         
     | 
| 
       89 
     | 
    
         
            -
                 
     | 
| 
       90 
     | 
    
         
            -
                ffi (1.17. 
     | 
| 
       91 
     | 
    
         
            -
                ffi (1.17. 
     | 
| 
       92 
     | 
    
         
            -
                ffi (1.17. 
     | 
| 
       93 
     | 
    
         
            -
                ffi (1.17. 
     | 
| 
       94 
     | 
    
         
            -
                ffi (1.17. 
     | 
| 
       95 
     | 
    
         
            -
                ffi (1.17. 
     | 
| 
       96 
     | 
    
         
            -
                ffi (1.17.1-x86_64-linux-gnu)
         
     | 
| 
      
 53 
     | 
    
         
            +
                ffi (1.17.2-aarch64-linux-gnu)
         
     | 
| 
      
 54 
     | 
    
         
            +
                ffi (1.17.2-arm-linux-gnu)
         
     | 
| 
      
 55 
     | 
    
         
            +
                ffi (1.17.2-arm64-darwin)
         
     | 
| 
      
 56 
     | 
    
         
            +
                ffi (1.17.2-x64-mingw-ucrt)
         
     | 
| 
      
 57 
     | 
    
         
            +
                ffi (1.17.2-x86-linux-gnu)
         
     | 
| 
      
 58 
     | 
    
         
            +
                ffi (1.17.2-x86_64-darwin)
         
     | 
| 
      
 59 
     | 
    
         
            +
                ffi (1.17.2-x86_64-linux-gnu)
         
     | 
| 
       97 
60 
     | 
    
         
             
                hashdiff (1.1.2)
         
     | 
| 
       98 
     | 
    
         
            -
                 
     | 
| 
       99 
     | 
    
         
            -
                  concurrent-ruby (~> 1.0)
         
     | 
| 
       100 
     | 
    
         
            -
                io-console (0.8.0)
         
     | 
| 
       101 
     | 
    
         
            -
                irb (1.15.1)
         
     | 
| 
       102 
     | 
    
         
            -
                  pp (>= 0.6.0)
         
     | 
| 
       103 
     | 
    
         
            -
                  rdoc (>= 4.0.0)
         
     | 
| 
       104 
     | 
    
         
            -
                  reline (>= 0.4.2)
         
     | 
| 
       105 
     | 
    
         
            -
                json (2.9.1)
         
     | 
| 
      
 61 
     | 
    
         
            +
                json (2.11.3)
         
     | 
| 
       106 
62 
     | 
    
         
             
                language_server-protocol (3.17.0.4)
         
     | 
| 
       107 
     | 
    
         
            -
                 
     | 
| 
       108 
     | 
    
         
            -
                 
     | 
| 
       109 
     | 
    
         
            -
             
     | 
| 
       110 
     | 
    
         
            -
                   
     | 
| 
       111 
     | 
    
         
            -
                loog (0.6.0)
         
     | 
| 
      
 63 
     | 
    
         
            +
                lint_roller (1.1.0)
         
     | 
| 
      
 64 
     | 
    
         
            +
                logger (1.7.0)
         
     | 
| 
      
 65 
     | 
    
         
            +
                loog (0.6.1)
         
     | 
| 
      
 66 
     | 
    
         
            +
                  logger (~> 1.0)
         
     | 
| 
       112 
67 
     | 
    
         
             
                mini_mime (1.1.5)
         
     | 
| 
       113 
68 
     | 
    
         
             
                mini_portile2 (2.8.8)
         
     | 
| 
       114 
     | 
    
         
            -
                minitest (5.25. 
     | 
| 
      
 69 
     | 
    
         
            +
                minitest (5.25.5)
         
     | 
| 
       115 
70 
     | 
    
         
             
                minitest-reporters (1.7.1)
         
     | 
| 
       116 
71 
     | 
    
         
             
                  ansi
         
     | 
| 
       117 
72 
     | 
    
         
             
                  builder
         
     | 
| 
         @@ -119,107 +74,60 @@ GEM 
     | 
|
| 
       119 
74 
     | 
    
         
             
                  ruby-progressbar
         
     | 
| 
       120 
75 
     | 
    
         
             
                multi_test (1.1.0)
         
     | 
| 
       121 
76 
     | 
    
         
             
                net-ping (2.0.8)
         
     | 
| 
       122 
     | 
    
         
            -
                nokogiri (1.18. 
     | 
| 
      
 77 
     | 
    
         
            +
                nokogiri (1.18.8)
         
     | 
| 
       123 
78 
     | 
    
         
             
                  mini_portile2 (~> 2.8.2)
         
     | 
| 
       124 
79 
     | 
    
         
             
                  racc (~> 1.4)
         
     | 
| 
       125 
     | 
    
         
            -
                nokogiri (1.18. 
     | 
| 
      
 80 
     | 
    
         
            +
                nokogiri (1.18.8-aarch64-linux-gnu)
         
     | 
| 
       126 
81 
     | 
    
         
             
                  racc (~> 1.4)
         
     | 
| 
       127 
     | 
    
         
            -
                nokogiri (1.18. 
     | 
| 
      
 82 
     | 
    
         
            +
                nokogiri (1.18.8-arm-linux-gnu)
         
     | 
| 
       128 
83 
     | 
    
         
             
                  racc (~> 1.4)
         
     | 
| 
       129 
     | 
    
         
            -
                nokogiri (1.18. 
     | 
| 
      
 84 
     | 
    
         
            +
                nokogiri (1.18.8-arm64-darwin)
         
     | 
| 
       130 
85 
     | 
    
         
             
                  racc (~> 1.4)
         
     | 
| 
       131 
     | 
    
         
            -
                nokogiri (1.18. 
     | 
| 
      
 86 
     | 
    
         
            +
                nokogiri (1.18.8-x64-mingw-ucrt)
         
     | 
| 
       132 
87 
     | 
    
         
             
                  racc (~> 1.4)
         
     | 
| 
       133 
     | 
    
         
            -
                nokogiri (1.18. 
     | 
| 
      
 88 
     | 
    
         
            +
                nokogiri (1.18.8-x86_64-darwin)
         
     | 
| 
       134 
89 
     | 
    
         
             
                  racc (~> 1.4)
         
     | 
| 
       135 
     | 
    
         
            -
                nokogiri (1.18. 
     | 
| 
      
 90 
     | 
    
         
            +
                nokogiri (1.18.8-x86_64-linux-gnu)
         
     | 
| 
       136 
91 
     | 
    
         
             
                  racc (~> 1.4)
         
     | 
| 
       137 
     | 
    
         
            -
                parallel (1. 
     | 
| 
       138 
     | 
    
         
            -
                parser (3.3. 
     | 
| 
      
 92 
     | 
    
         
            +
                parallel (1.27.0)
         
     | 
| 
      
 93 
     | 
    
         
            +
                parser (3.3.8.0)
         
     | 
| 
       139 
94 
     | 
    
         
             
                  ast (~> 2.4.1)
         
     | 
| 
       140 
95 
     | 
    
         
             
                  racc
         
     | 
| 
       141 
     | 
    
         
            -
                 
     | 
| 
       142 
     | 
    
         
            -
             
     | 
| 
       143 
     | 
    
         
            -
                prettyprint (0.2.0)
         
     | 
| 
       144 
     | 
    
         
            -
                psych (5.2.3)
         
     | 
| 
       145 
     | 
    
         
            -
                  date
         
     | 
| 
       146 
     | 
    
         
            -
                  stringio
         
     | 
| 
       147 
     | 
    
         
            -
                public_suffix (6.0.1)
         
     | 
| 
      
 96 
     | 
    
         
            +
                prism (1.4.0)
         
     | 
| 
      
 97 
     | 
    
         
            +
                public_suffix (6.0.2)
         
     | 
| 
       148 
98 
     | 
    
         
             
                racc (1.8.1)
         
     | 
| 
       149 
     | 
    
         
            -
                rack (3.1.9)
         
     | 
| 
       150 
     | 
    
         
            -
                rack-session (2.1.0)
         
     | 
| 
       151 
     | 
    
         
            -
                  base64 (>= 0.1.0)
         
     | 
| 
       152 
     | 
    
         
            -
                  rack (>= 3.0.0)
         
     | 
| 
       153 
     | 
    
         
            -
                rack-test (2.2.0)
         
     | 
| 
       154 
     | 
    
         
            -
                  rack (>= 1.3)
         
     | 
| 
       155 
     | 
    
         
            -
                rackup (2.2.1)
         
     | 
| 
       156 
     | 
    
         
            -
                  rack (>= 3)
         
     | 
| 
       157 
     | 
    
         
            -
                rails-dom-testing (2.2.0)
         
     | 
| 
       158 
     | 
    
         
            -
                  activesupport (>= 5.0.0)
         
     | 
| 
       159 
     | 
    
         
            -
                  minitest
         
     | 
| 
       160 
     | 
    
         
            -
                  nokogiri (>= 1.6)
         
     | 
| 
       161 
     | 
    
         
            -
                rails-html-sanitizer (1.6.2)
         
     | 
| 
       162 
     | 
    
         
            -
                  loofah (~> 2.21)
         
     | 
| 
       163 
     | 
    
         
            -
                  nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
         
     | 
| 
       164 
     | 
    
         
            -
                railties (8.0.1)
         
     | 
| 
       165 
     | 
    
         
            -
                  actionpack (= 8.0.1)
         
     | 
| 
       166 
     | 
    
         
            -
                  activesupport (= 8.0.1)
         
     | 
| 
       167 
     | 
    
         
            -
                  irb (~> 1.13)
         
     | 
| 
       168 
     | 
    
         
            -
                  rackup (>= 1.0.0)
         
     | 
| 
       169 
     | 
    
         
            -
                  rake (>= 12.2)
         
     | 
| 
       170 
     | 
    
         
            -
                  thor (~> 1.0, >= 1.2.2)
         
     | 
| 
       171 
     | 
    
         
            -
                  zeitwerk (~> 2.6)
         
     | 
| 
       172 
99 
     | 
    
         
             
                rainbow (3.1.1)
         
     | 
| 
       173 
100 
     | 
    
         
             
                rake (13.2.1)
         
     | 
| 
       174 
101 
     | 
    
         
             
                random-port (0.7.5)
         
     | 
| 
       175 
102 
     | 
    
         
             
                  tago (> 0)
         
     | 
| 
       176 
     | 
    
         
            -
                rdoc (6.11.0)
         
     | 
| 
       177 
     | 
    
         
            -
                  psych (>= 4.0.0)
         
     | 
| 
       178 
103 
     | 
    
         
             
                regexp_parser (2.10.0)
         
     | 
| 
       179 
     | 
    
         
            -
                 
     | 
| 
       180 
     | 
    
         
            -
             
     | 
| 
       181 
     | 
    
         
            -
                rexml (3.4.0)
         
     | 
| 
       182 
     | 
    
         
            -
                rspec-core (3.13.2)
         
     | 
| 
       183 
     | 
    
         
            -
                  rspec-support (~> 3.13.0)
         
     | 
| 
       184 
     | 
    
         
            -
                rspec-expectations (3.13.3)
         
     | 
| 
       185 
     | 
    
         
            -
                  diff-lcs (>= 1.2.0, < 2.0)
         
     | 
| 
       186 
     | 
    
         
            -
                  rspec-support (~> 3.13.0)
         
     | 
| 
       187 
     | 
    
         
            -
                rspec-mocks (3.13.2)
         
     | 
| 
       188 
     | 
    
         
            -
                  diff-lcs (>= 1.2.0, < 2.0)
         
     | 
| 
       189 
     | 
    
         
            -
                  rspec-support (~> 3.13.0)
         
     | 
| 
       190 
     | 
    
         
            -
                rspec-rails (7.1.0)
         
     | 
| 
       191 
     | 
    
         
            -
                  actionpack (>= 7.0)
         
     | 
| 
       192 
     | 
    
         
            -
                  activesupport (>= 7.0)
         
     | 
| 
       193 
     | 
    
         
            -
                  railties (>= 7.0)
         
     | 
| 
       194 
     | 
    
         
            -
                  rspec-core (~> 3.13)
         
     | 
| 
       195 
     | 
    
         
            -
                  rspec-expectations (~> 3.13)
         
     | 
| 
       196 
     | 
    
         
            -
                  rspec-mocks (~> 3.13)
         
     | 
| 
       197 
     | 
    
         
            -
                  rspec-support (~> 3.13)
         
     | 
| 
       198 
     | 
    
         
            -
                rspec-support (3.13.2)
         
     | 
| 
       199 
     | 
    
         
            -
                rubocop (1.71.2)
         
     | 
| 
      
 104 
     | 
    
         
            +
                rexml (3.4.1)
         
     | 
| 
      
 105 
     | 
    
         
            +
                rubocop (1.75.5)
         
     | 
| 
       200 
106 
     | 
    
         
             
                  json (~> 2.3)
         
     | 
| 
       201 
     | 
    
         
            -
                  language_server-protocol ( 
     | 
| 
      
 107 
     | 
    
         
            +
                  language_server-protocol (~> 3.17.0.2)
         
     | 
| 
      
 108 
     | 
    
         
            +
                  lint_roller (~> 1.1.0)
         
     | 
| 
       202 
109 
     | 
    
         
             
                  parallel (~> 1.10)
         
     | 
| 
       203 
110 
     | 
    
         
             
                  parser (>= 3.3.0.2)
         
     | 
| 
       204 
111 
     | 
    
         
             
                  rainbow (>= 2.2.2, < 4.0)
         
     | 
| 
       205 
112 
     | 
    
         
             
                  regexp_parser (>= 2.9.3, < 3.0)
         
     | 
| 
       206 
     | 
    
         
            -
                  rubocop-ast (>= 1. 
     | 
| 
      
 113 
     | 
    
         
            +
                  rubocop-ast (>= 1.44.0, < 2.0)
         
     | 
| 
       207 
114 
     | 
    
         
             
                  ruby-progressbar (~> 1.7)
         
     | 
| 
       208 
115 
     | 
    
         
             
                  unicode-display_width (>= 2.4.0, < 4.0)
         
     | 
| 
       209 
     | 
    
         
            -
                rubocop-ast (1. 
     | 
| 
       210 
     | 
    
         
            -
                  parser (>= 3.3. 
     | 
| 
       211 
     | 
    
         
            -
             
     | 
| 
       212 
     | 
    
         
            -
             
     | 
| 
       213 
     | 
    
         
            -
                   
     | 
| 
       214 
     | 
    
         
            -
             
     | 
| 
       215 
     | 
    
         
            -
                  rubocop (>= 1. 
     | 
| 
       216 
     | 
    
         
            -
             
     | 
| 
       217 
     | 
    
         
            -
             
     | 
| 
       218 
     | 
    
         
            -
                  rubocop ( 
     | 
| 
       219 
     | 
    
         
            -
             
     | 
| 
       220 
     | 
    
         
            -
             
     | 
| 
      
 116 
     | 
    
         
            +
                rubocop-ast (1.44.1)
         
     | 
| 
      
 117 
     | 
    
         
            +
                  parser (>= 3.3.7.2)
         
     | 
| 
      
 118 
     | 
    
         
            +
                  prism (~> 1.4)
         
     | 
| 
      
 119 
     | 
    
         
            +
                rubocop-minitest (0.38.0)
         
     | 
| 
      
 120 
     | 
    
         
            +
                  lint_roller (~> 1.1)
         
     | 
| 
      
 121 
     | 
    
         
            +
                  rubocop (>= 1.75.0, < 2.0)
         
     | 
| 
      
 122 
     | 
    
         
            +
                  rubocop-ast (>= 1.38.0, < 2.0)
         
     | 
| 
      
 123 
     | 
    
         
            +
                rubocop-performance (1.25.0)
         
     | 
| 
      
 124 
     | 
    
         
            +
                  lint_roller (~> 1.1)
         
     | 
| 
      
 125 
     | 
    
         
            +
                  rubocop (>= 1.75.0, < 2.0)
         
     | 
| 
      
 126 
     | 
    
         
            +
                  rubocop-ast (>= 1.38.0, < 2.0)
         
     | 
| 
      
 127 
     | 
    
         
            +
                rubocop-rake (0.7.1)
         
     | 
| 
      
 128 
     | 
    
         
            +
                  lint_roller (~> 1.1)
         
     | 
| 
      
 129 
     | 
    
         
            +
                  rubocop (>= 1.72.1)
         
     | 
| 
       221 
130 
     | 
    
         
             
                ruby-progressbar (1.13.0)
         
     | 
| 
       222 
     | 
    
         
            -
                securerandom (0.4.1)
         
     | 
| 
       223 
131 
     | 
    
         
             
                simplecov (0.22.0)
         
     | 
| 
       224 
132 
     | 
    
         
             
                  docile (~> 1.1)
         
     | 
| 
       225 
133 
     | 
    
         
             
                  simplecov-html (~> 0.11)
         
     | 
| 
         @@ -229,28 +137,21 @@ GEM 
     | 
|
| 
       229 
137 
     | 
    
         
             
                  simplecov (~> 0.19)
         
     | 
| 
       230 
138 
     | 
    
         
             
                simplecov-html (0.13.1)
         
     | 
| 
       231 
139 
     | 
    
         
             
                simplecov_json_formatter (0.1.4)
         
     | 
| 
       232 
     | 
    
         
            -
                stringio (3.1.2)
         
     | 
| 
       233 
140 
     | 
    
         
             
                sys-uname (1.3.1)
         
     | 
| 
       234 
141 
     | 
    
         
             
                  ffi (~> 1.1)
         
     | 
| 
       235 
     | 
    
         
            -
                tago (0.0 
     | 
| 
       236 
     | 
    
         
            -
                thor (1.3.2)
         
     | 
| 
       237 
     | 
    
         
            -
                tzinfo (2.0.6)
         
     | 
| 
       238 
     | 
    
         
            -
                  concurrent-ruby (~> 1.0)
         
     | 
| 
      
 142 
     | 
    
         
            +
                tago (0.1.0)
         
     | 
| 
       239 
143 
     | 
    
         
             
                unicode-display_width (3.1.4)
         
     | 
| 
       240 
144 
     | 
    
         
             
                  unicode-emoji (~> 4.0, >= 4.0.4)
         
     | 
| 
       241 
145 
     | 
    
         
             
                unicode-emoji (4.0.4)
         
     | 
| 
       242 
     | 
    
         
            -
                uri (1.0.2)
         
     | 
| 
       243 
     | 
    
         
            -
                useragent (0.16.11)
         
     | 
| 
       244 
146 
     | 
    
         
             
                w3c_validators (1.3.7)
         
     | 
| 
       245 
147 
     | 
    
         
             
                  json (>= 1.8)
         
     | 
| 
       246 
148 
     | 
    
         
             
                  nokogiri (~> 1.6)
         
     | 
| 
       247 
149 
     | 
    
         
             
                  rexml (~> 3.2)
         
     | 
| 
       248 
     | 
    
         
            -
                webmock (3. 
     | 
| 
      
 150 
     | 
    
         
            +
                webmock (3.25.1)
         
     | 
| 
       249 
151 
     | 
    
         
             
                  addressable (>= 2.8.0)
         
     | 
| 
       250 
152 
     | 
    
         
             
                  crack (>= 0.3.2)
         
     | 
| 
       251 
153 
     | 
    
         
             
                  hashdiff (>= 0.4.0, < 2.0.0)
         
     | 
| 
       252 
154 
     | 
    
         
             
                yard (0.9.37)
         
     | 
| 
       253 
     | 
    
         
            -
                zeitwerk (2.7.1)
         
     | 
| 
       254 
155 
     | 
    
         | 
| 
       255 
156 
     | 
    
         
             
            PLATFORMS
         
     | 
| 
       256 
157 
     | 
    
         
             
              aarch64-linux
         
     | 
| 
         @@ -263,24 +164,22 @@ PLATFORMS 
     | 
|
| 
       263 
164 
     | 
    
         
             
              x86_64-linux
         
     | 
| 
       264 
165 
     | 
    
         | 
| 
       265 
166 
     | 
    
         
             
            DEPENDENCIES
         
     | 
| 
       266 
     | 
    
         
            -
              cucumber ( 
     | 
| 
       267 
     | 
    
         
            -
              minitest ( 
     | 
| 
       268 
     | 
    
         
            -
              minitest-reporters ( 
     | 
| 
       269 
     | 
    
         
            -
              net-ping ( 
     | 
| 
      
 167 
     | 
    
         
            +
              cucumber (~> 9.2)
         
     | 
| 
      
 168 
     | 
    
         
            +
              minitest (~> 5.25)
         
     | 
| 
      
 169 
     | 
    
         
            +
              minitest-reporters (~> 1.7)
         
     | 
| 
      
 170 
     | 
    
         
            +
              net-ping (~> 2.0)
         
     | 
| 
       270 
171 
     | 
    
         
             
              qbash!
         
     | 
| 
       271 
     | 
    
         
            -
              rake ( 
     | 
| 
      
 172 
     | 
    
         
            +
              rake (~> 13.2)
         
     | 
| 
       272 
173 
     | 
    
         
             
              random-port (~> 0.0)
         
     | 
| 
       273 
     | 
    
         
            -
               
     | 
| 
       274 
     | 
    
         
            -
              rubocop ( 
     | 
| 
       275 
     | 
    
         
            -
              rubocop- 
     | 
| 
       276 
     | 
    
         
            -
              rubocop- 
     | 
| 
       277 
     | 
    
         
            -
               
     | 
| 
       278 
     | 
    
         
            -
               
     | 
| 
       279 
     | 
    
         
            -
               
     | 
| 
       280 
     | 
    
         
            -
               
     | 
| 
       281 
     | 
    
         
            -
               
     | 
| 
       282 
     | 
    
         
            -
              webmock (= 3.24.0)
         
     | 
| 
       283 
     | 
    
         
            -
              yard (= 0.9.37)
         
     | 
| 
      
 174 
     | 
    
         
            +
              rubocop (~> 1.73)
         
     | 
| 
      
 175 
     | 
    
         
            +
              rubocop-minitest (> 0)
         
     | 
| 
      
 176 
     | 
    
         
            +
              rubocop-performance (> 0)
         
     | 
| 
      
 177 
     | 
    
         
            +
              rubocop-rake (> 0)
         
     | 
| 
      
 178 
     | 
    
         
            +
              simplecov (~> 0.22)
         
     | 
| 
      
 179 
     | 
    
         
            +
              simplecov-cobertura (~> 2.1)
         
     | 
| 
      
 180 
     | 
    
         
            +
              w3c_validators (~> 1.3)
         
     | 
| 
      
 181 
     | 
    
         
            +
              webmock (~> 3.25)
         
     | 
| 
      
 182 
     | 
    
         
            +
              yard (~> 0.9)
         
     | 
| 
       284 
183 
     | 
    
         | 
| 
       285 
184 
     | 
    
         
             
            BUNDLED WITH
         
     | 
| 
       286 
185 
     | 
    
         
             
               2.5.16
         
     | 
    
        data/LICENSES/MIT.txt
    ADDED
    
    | 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            (The MIT License)
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Copyright (c) 2024-2025 Yegor Bugayenko
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
      
 6 
     | 
    
         
            +
            of this software and associated documentation files (the 'Software'), to deal
         
     | 
| 
      
 7 
     | 
    
         
            +
            in the Software without restriction, including without limitation the rights
         
     | 
| 
      
 8 
     | 
    
         
            +
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         
     | 
| 
      
 9 
     | 
    
         
            +
            copies of the Software, and to permit persons to whom the Software is
         
     | 
| 
      
 10 
     | 
    
         
            +
            furnished to do so, subject to the following conditions:
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be included in all
         
     | 
| 
      
 13 
     | 
    
         
            +
            copies or substantial portions of the Software.
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
      
 16 
     | 
    
         
            +
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         
     | 
| 
      
 17 
     | 
    
         
            +
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         
     | 
| 
      
 18 
     | 
    
         
            +
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         
     | 
| 
      
 19 
     | 
    
         
            +
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         
     | 
| 
      
 20 
     | 
    
         
            +
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         
     | 
| 
      
 21 
     | 
    
         
            +
            SOFTWARE.
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,18 +1,18 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # Quick and Simple Executor of Bash Commands
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            [](https://www.rultor.com/p/yegor256/qbash)
         
     | 
| 
       4 
4 
     | 
    
         
             
            [](https://www.jetbrains.com/ruby/)
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            [](https://github.com/yegor256/qbash/actions/workflows/rake.yml)
         
     | 
| 
       7 
     | 
    
         
            -
            []( 
     | 
| 
      
 7 
     | 
    
         
            +
            [](https://www.0pdd.com/p?name=yegor256/qbash)
         
     | 
| 
      
 8 
     | 
    
         
            +
            [](https://badge.fury.io/rb/qbash)
         
     | 
| 
       9 
9 
     | 
    
         
             
            [](https://codecov.io/github/yegor256/qbash?branch=master)
         
     | 
| 
       10 
     | 
    
         
            -
            [](https://rubydoc.info/github/yegor256/qbash/master/frames)
         
     | 
| 
       11 
11 
     | 
    
         
             
            [](https://hitsofcode.com/view/github/yegor256/qbash)
         
     | 
| 
       12 
12 
     | 
    
         
             
            [](https://github.com/yegor256/qbash/blob/master/LICENSE.txt)
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
            How do you execute a new shell command from Ruby?
         
     | 
| 
       15 
     | 
    
         
            -
            There are [many ways] 
     | 
| 
      
 15 
     | 
    
         
            +
            There are [many ways][so-question].
         
     | 
| 
       16 
16 
     | 
    
         
             
            None of them offers a one-liner that would execute a command, print
         
     | 
| 
       17 
17 
     | 
    
         
             
            its output to the console or a logger, and then raise an exception if
         
     | 
| 
       18 
18 
     | 
    
         
             
            the exit code is not zero. This small gem offers exactly this one-liner.
         
     | 
| 
         @@ -67,13 +67,23 @@ converted to a string by joining all items with spaces between them. 
     | 
|
| 
       67 
67 
     | 
    
         
             
            ```ruby
         
     | 
| 
       68 
68 
     | 
    
         
             
            qbash(
         
     | 
| 
       69 
69 
     | 
    
         
             
              [
         
     | 
| 
       70 
     | 
    
         
            -
                'echo "Hello, world!"'
         
     | 
| 
      
 70 
     | 
    
         
            +
                'echo "Hello, world!"',
         
     | 
| 
       71 
71 
     | 
    
         
             
                '&& echo "How are you?"',
         
     | 
| 
       72 
72 
     | 
    
         
             
                '&& cat /etc/passwd'
         
     | 
| 
       73 
73 
     | 
    
         
             
              ]
         
     | 
| 
       74 
74 
     | 
    
         
             
            )
         
     | 
| 
       75 
75 
     | 
    
         
             
            ```
         
     | 
| 
       76 
76 
     | 
    
         | 
| 
      
 77 
     | 
    
         
            +
            If a block is given to `qbash`, it will run the command in background mode,
         
     | 
| 
      
 78 
     | 
    
         
            +
            waiting for the block to finish. Once it's finished, the command will be
         
     | 
| 
      
 79 
     | 
    
         
            +
            terminated via the `TERM` [signal]:
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 82 
     | 
    
         
            +
            qbash('sleep 9999') do |pid|
         
     | 
| 
      
 83 
     | 
    
         
            +
              # do something
         
     | 
| 
      
 84 
     | 
    
         
            +
            end
         
     | 
| 
      
 85 
     | 
    
         
            +
            ```
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
       77 
87 
     | 
    
         
             
            It is very much recommended to escape all command-line values with the help
         
     | 
| 
       78 
88 
     | 
    
         
             
            of the [Shellwords.escape()][shellwords] utility method, for example:
         
     | 
| 
       79 
89 
     | 
    
         | 
| 
         @@ -83,10 +93,10 @@ qbash("cat #{Shellwords.escape(file)}") 
     | 
|
| 
       83 
93 
     | 
    
         
             
            ```
         
     | 
| 
       84 
94 
     | 
    
         | 
| 
       85 
95 
     | 
    
         
             
            Without such an escaping, in this example, a space inside the `file`
         
     | 
| 
       86 
     | 
    
         
            -
            will lead to an  
     | 
| 
      
 96 
     | 
    
         
            +
            will lead to an unpredictable result of the execution.
         
     | 
| 
       87 
97 
     | 
    
         | 
| 
       88 
98 
     | 
    
         
             
            If you want to stop sooner than the command finishes, use
         
     | 
| 
       89 
     | 
    
         
            -
            [ 
     | 
| 
      
 99 
     | 
    
         
            +
            [timeout] gem:
         
     | 
| 
       90 
100 
     | 
    
         | 
| 
       91 
101 
     | 
    
         
             
            ```ruby
         
     | 
| 
       92 
102 
     | 
    
         
             
            require 'timeout'
         
     | 
| 
         @@ -102,7 +112,7 @@ of waiting for the `sleep` to finish. 
     | 
|
| 
       102 
112 
     | 
    
         | 
| 
       103 
113 
     | 
    
         
             
            Read
         
     | 
| 
       104 
114 
     | 
    
         
             
            [these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
         
     | 
| 
       105 
     | 
    
         
            -
            Make sure  
     | 
| 
      
 115 
     | 
    
         
            +
            Make sure your build is green before you contribute
         
     | 
| 
       106 
116 
     | 
    
         
             
            your pull request. You will need to have
         
     | 
| 
       107 
117 
     | 
    
         
             
            [Ruby](https://www.ruby-lang.org/en/) 3.0+ and
         
     | 
| 
       108 
118 
     | 
    
         
             
            [Bundler](https://bundler.io/) installed. Then:
         
     | 
| 
         @@ -116,3 +126,6 @@ If it's clean and you don't see any error messages, submit your pull request. 
     | 
|
| 
       116 
126 
     | 
    
         | 
| 
       117 
127 
     | 
    
         
             
            [shellwords]: https://ruby-doc.org/stdlib-3.0.1/libdoc/shellwords/rdoc/Shellwords.html
         
     | 
| 
       118 
128 
     | 
    
         
             
            [qbash]: https://rubydoc.info/github/yegor256/qbash/master/Kernel#qbash-instance_method
         
     | 
| 
      
 129 
     | 
    
         
            +
            [signal]: https://en.wikipedia.org/wiki/Signal_(IPC)
         
     | 
| 
      
 130 
     | 
    
         
            +
            [timeout]: https://github.com/ruby/timeout
         
     | 
| 
      
 131 
     | 
    
         
            +
            [so-question]: https://stackoverflow.com/questions/2232/
         
     | 
    
        data/REUSE.toml
    ADDED
    
    | 
         @@ -0,0 +1,34 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko
         
     | 
| 
      
 2 
     | 
    
         
            +
            # SPDX-License-Identifier: MIT
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            version = 1
         
     | 
| 
      
 5 
     | 
    
         
            +
            [[annotations]]
         
     | 
| 
      
 6 
     | 
    
         
            +
            path = [
         
     | 
| 
      
 7 
     | 
    
         
            +
                ".DS_Store",
         
     | 
| 
      
 8 
     | 
    
         
            +
                ".gitattributes",
         
     | 
| 
      
 9 
     | 
    
         
            +
                ".gitignore",
         
     | 
| 
      
 10 
     | 
    
         
            +
                ".pdd",
         
     | 
| 
      
 11 
     | 
    
         
            +
                "**.json",
         
     | 
| 
      
 12 
     | 
    
         
            +
                "**.md",
         
     | 
| 
      
 13 
     | 
    
         
            +
                "**.txt",
         
     | 
| 
      
 14 
     | 
    
         
            +
                "**/.DS_Store",
         
     | 
| 
      
 15 
     | 
    
         
            +
                "**/.gitignore",
         
     | 
| 
      
 16 
     | 
    
         
            +
                "**/.pdd",
         
     | 
| 
      
 17 
     | 
    
         
            +
                "**/*.csv",
         
     | 
| 
      
 18 
     | 
    
         
            +
                "**/*.jpg",
         
     | 
| 
      
 19 
     | 
    
         
            +
                "**/*.json",
         
     | 
| 
      
 20 
     | 
    
         
            +
                "**/*.md",
         
     | 
| 
      
 21 
     | 
    
         
            +
                "**/*.pdf",
         
     | 
| 
      
 22 
     | 
    
         
            +
                "**/*.png",
         
     | 
| 
      
 23 
     | 
    
         
            +
                "**/*.svg",
         
     | 
| 
      
 24 
     | 
    
         
            +
                "**/*.txt",
         
     | 
| 
      
 25 
     | 
    
         
            +
                "**/*.vm",
         
     | 
| 
      
 26 
     | 
    
         
            +
                "**/CNAME",
         
     | 
| 
      
 27 
     | 
    
         
            +
                "**/Gemfile.lock",
         
     | 
| 
      
 28 
     | 
    
         
            +
                "Gemfile.lock",
         
     | 
| 
      
 29 
     | 
    
         
            +
                "README.md",
         
     | 
| 
      
 30 
     | 
    
         
            +
                "renovate.json",
         
     | 
| 
      
 31 
     | 
    
         
            +
            ]
         
     | 
| 
      
 32 
     | 
    
         
            +
            precedence = "override"
         
     | 
| 
      
 33 
     | 
    
         
            +
            SPDX-FileCopyrightText = "Copyright (c) 2025 Yegor Bugayenko"
         
     | 
| 
      
 34 
     | 
    
         
            +
            SPDX-License-Identifier = "MIT"
         
     | 
    
        data/Rakefile
    CHANGED
    
    | 
         @@ -1,28 +1,10 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            # Copyright (c) 2024-2025 Yegor Bugayenko
         
     | 
| 
       4 
     | 
    
         
            -
            #
         
     | 
| 
       5 
     | 
    
         
            -
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
       6 
     | 
    
         
            -
            # of this software and associated documentation files (the 'Software'), to deal
         
     | 
| 
       7 
     | 
    
         
            -
            # in the Software without restriction, including without limitation the rights
         
     | 
| 
       8 
     | 
    
         
            -
            # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         
     | 
| 
       9 
     | 
    
         
            -
            # copies of the Software, and to permit persons to whom the Software is
         
     | 
| 
       10 
     | 
    
         
            -
            # furnished to do so, subject to the following conditions:
         
     | 
| 
       11 
     | 
    
         
            -
            #
         
     | 
| 
       12 
     | 
    
         
            -
            # The above copyright notice and this permission notice shall be included in all
         
     | 
| 
       13 
     | 
    
         
            -
            # copies or substantial portions of the Software.
         
     | 
| 
       14 
     | 
    
         
            -
            #
         
     | 
| 
       15 
     | 
    
         
            -
            # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
       16 
     | 
    
         
            -
            # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         
     | 
| 
       17 
     | 
    
         
            -
            # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         
     | 
| 
       18 
     | 
    
         
            -
            # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         
     | 
| 
       19 
     | 
    
         
            -
            # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         
     | 
| 
       20 
     | 
    
         
            -
            # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         
     | 
| 
       21 
     | 
    
         
            -
            # SOFTWARE.
         
     | 
| 
      
 3 
     | 
    
         
            +
            # SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
         
     | 
| 
      
 4 
     | 
    
         
            +
            # SPDX-License-Identifier: MIT
         
     | 
| 
       22 
5 
     | 
    
         | 
| 
       23 
6 
     | 
    
         
             
            require 'rubygems'
         
     | 
| 
       24 
7 
     | 
    
         
             
            require 'rake'
         
     | 
| 
       25 
     | 
    
         
            -
            require 'rdoc'
         
     | 
| 
       26 
8 
     | 
    
         
             
            require 'rake/clean'
         
     | 
| 
       27 
9 
     | 
    
         | 
| 
       28 
10 
     | 
    
         
             
            def name
         
     | 
| 
         @@ -57,5 +39,4 @@ require 'rubocop/rake_task' 
     | 
|
| 
       57 
39 
     | 
    
         
             
            desc 'Run RuboCop on all directories'
         
     | 
| 
       58 
40 
     | 
    
         
             
            RuboCop::RakeTask.new(:rubocop) do |task|
         
     | 
| 
       59 
41 
     | 
    
         
             
              task.fail_on_error = true
         
     | 
| 
       60 
     | 
    
         
            -
              task.requires << 'rubocop-rspec'
         
     | 
| 
       61 
42 
     | 
    
         
             
            end
         
     | 
    
        data/lib/qbash.rb
    CHANGED
    
    | 
         @@ -1,24 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            # Copyright (c) 2024-2025 Yegor Bugayenko
         
     | 
| 
       4 
     | 
    
         
            -
            #
         
     | 
| 
       5 
     | 
    
         
            -
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
       6 
     | 
    
         
            -
            # of this software and associated documentation files (the 'Software'), to deal
         
     | 
| 
       7 
     | 
    
         
            -
            # in the Software without restriction, including without limitation the rights
         
     | 
| 
       8 
     | 
    
         
            -
            # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         
     | 
| 
       9 
     | 
    
         
            -
            # copies of the Software, and to permit persons to whom the Software is
         
     | 
| 
       10 
     | 
    
         
            -
            # furnished to do so, subject to the following conditions:
         
     | 
| 
       11 
     | 
    
         
            -
            #
         
     | 
| 
       12 
     | 
    
         
            -
            # The above copyright notice and this permission notice shall be included in all
         
     | 
| 
       13 
     | 
    
         
            -
            # copies or substantial portions of the Software.
         
     | 
| 
       14 
     | 
    
         
            -
            #
         
     | 
| 
       15 
     | 
    
         
            -
            # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
       16 
     | 
    
         
            -
            # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         
     | 
| 
       17 
     | 
    
         
            -
            # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         
     | 
| 
       18 
     | 
    
         
            -
            # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         
     | 
| 
       19 
     | 
    
         
            -
            # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         
     | 
| 
       20 
     | 
    
         
            -
            # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         
     | 
| 
       21 
     | 
    
         
            -
            # SOFTWARE.
         
     | 
| 
      
 3 
     | 
    
         
            +
            # SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
         
     | 
| 
      
 4 
     | 
    
         
            +
            # SPDX-License-Identifier: MIT
         
     | 
| 
       22 
5 
     | 
    
         | 
| 
       23 
6 
     | 
    
         
             
            require 'backtrace'
         
     | 
| 
       24 
7 
     | 
    
         
             
            require 'logger'
         
     | 
| 
         @@ -33,25 +16,64 @@ require 'tago' 
     | 
|
| 
       33 
16 
     | 
    
         
             
            # Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
         
     | 
| 
       34 
17 
     | 
    
         
             
            # License:: MIT
         
     | 
| 
       35 
18 
     | 
    
         
             
            module Kernel
         
     | 
| 
       36 
     | 
    
         
            -
              # Execute a single bash command.
         
     | 
| 
      
 19 
     | 
    
         
            +
              # Execute a single bash command safely with proper error handling.
         
     | 
| 
      
 20 
     | 
    
         
            +
              #
         
     | 
| 
      
 21 
     | 
    
         
            +
              # QBash provides a safe way to execute shell commands with proper error handling,
         
     | 
| 
      
 22 
     | 
    
         
            +
              # logging, and stdin/stdout management. It's designed to be simple for basic use
         
     | 
| 
      
 23 
     | 
    
         
            +
              # cases while offering powerful options for advanced scenarios.
         
     | 
| 
      
 24 
     | 
    
         
            +
              #
         
     | 
| 
      
 25 
     | 
    
         
            +
              # == Basic Usage
         
     | 
| 
      
 26 
     | 
    
         
            +
              #
         
     | 
| 
      
 27 
     | 
    
         
            +
              #   # Execute a command and get its output
         
     | 
| 
      
 28 
     | 
    
         
            +
              #   year = qbash('date +%Y')
         
     | 
| 
      
 29 
     | 
    
         
            +
              #   puts "Current year: #{year}"
         
     | 
| 
      
 30 
     | 
    
         
            +
              #
         
     | 
| 
      
 31 
     | 
    
         
            +
              #   # Execute a command that might fail
         
     | 
| 
      
 32 
     | 
    
         
            +
              #   files = qbash('find /tmp -name "*.log"')
         
     | 
| 
      
 33 
     | 
    
         
            +
              #
         
     | 
| 
      
 34 
     | 
    
         
            +
              # == Working with Exit Codes
         
     | 
| 
       37 
35 
     | 
    
         
             
              #
         
     | 
| 
       38 
     | 
    
         
            -
              #  
     | 
| 
      
 36 
     | 
    
         
            +
              #   # Get both output and exit code
         
     | 
| 
      
 37 
     | 
    
         
            +
              #   output, code = qbash('grep "error" /var/log/system.log', both: true)
         
     | 
| 
      
 38 
     | 
    
         
            +
              #   puts "Command succeeded" if code.zero?
         
     | 
| 
       39 
39 
     | 
    
         
             
              #
         
     | 
| 
       40 
     | 
    
         
            -
              # 
     | 
| 
      
 40 
     | 
    
         
            +
              #   # Accept multiple exit codes as valid
         
     | 
| 
      
 41 
     | 
    
         
            +
              #   result = qbash('grep "pattern" file.txt', accept: [0, 1])
         
     | 
| 
       41 
42 
     | 
    
         
             
              #
         
     | 
| 
       42 
     | 
    
         
            -
              #  
     | 
| 
      
 43 
     | 
    
         
            +
              # == Providing Input via STDIN
         
     | 
| 
       43 
44 
     | 
    
         
             
              #
         
     | 
| 
       44 
     | 
    
         
            -
              #  
     | 
| 
      
 45 
     | 
    
         
            +
              #   # Pass data to command's stdin
         
     | 
| 
      
 46 
     | 
    
         
            +
              #   result = qbash('wc -l', stdin: "line 1\nline 2\nline 3")
         
     | 
| 
       45 
47 
     | 
    
         
             
              #
         
     | 
| 
       46 
     | 
    
         
            -
              #  
     | 
| 
      
 48 
     | 
    
         
            +
              # == Environment Variables
         
     | 
| 
       47 
49 
     | 
    
         
             
              #
         
     | 
| 
       48 
     | 
    
         
            -
              #  
     | 
| 
       49 
     | 
    
         
            -
              #  
     | 
| 
       50 
     | 
    
         
            -
              # 
     | 
| 
      
 50 
     | 
    
         
            +
              #   # Set environment variables for the command
         
     | 
| 
      
 51 
     | 
    
         
            +
              #   output = qbash('echo $NAME', env: { 'NAME' => 'Ruby' })
         
     | 
| 
      
 52 
     | 
    
         
            +
              #
         
     | 
| 
      
 53 
     | 
    
         
            +
              # == Logging
         
     | 
| 
      
 54 
     | 
    
         
            +
              #
         
     | 
| 
      
 55 
     | 
    
         
            +
              #   # Enable detailed logging to stdout
         
     | 
| 
      
 56 
     | 
    
         
            +
              #   qbash('ls -la', log: $stdout)
         
     | 
| 
      
 57 
     | 
    
         
            +
              #
         
     | 
| 
      
 58 
     | 
    
         
            +
              #   # Use custom logger with specific level
         
     | 
| 
      
 59 
     | 
    
         
            +
              #   logger = Logger.new($stdout)
         
     | 
| 
      
 60 
     | 
    
         
            +
              #   qbash('make all', log: logger, level: Logger::INFO)
         
     | 
| 
      
 61 
     | 
    
         
            +
              #
         
     | 
| 
      
 62 
     | 
    
         
            +
              # == Process Control
         
     | 
| 
      
 63 
     | 
    
         
            +
              #
         
     | 
| 
      
 64 
     | 
    
         
            +
              #   # Get control over long-running process
         
     | 
| 
      
 65 
     | 
    
         
            +
              #   qbash('sleep 30') do |pid|
         
     | 
| 
      
 66 
     | 
    
         
            +
              #     puts "Process #{pid} is running..."
         
     | 
| 
      
 67 
     | 
    
         
            +
              #     # Do something while process is running
         
     | 
| 
      
 68 
     | 
    
         
            +
              #     # Process will be terminated when block exits
         
     | 
| 
      
 69 
     | 
    
         
            +
              #   end
         
     | 
| 
      
 70 
     | 
    
         
            +
              #
         
     | 
| 
      
 71 
     | 
    
         
            +
              # For command with multiple arguments, you can use +Shellwords.escape()+ to
         
     | 
| 
      
 72 
     | 
    
         
            +
              # properly escape each argument. Stderr automatically merges with stdout.
         
     | 
| 
       51 
73 
     | 
    
         
             
              #
         
     | 
| 
       52 
74 
     | 
    
         
             
              # Read this <a href="https://github.com/yegor256/qbash">README</a> file for more details.
         
     | 
| 
       53 
75 
     | 
    
         
             
              #
         
     | 
| 
       54 
     | 
    
         
            -
              # @param [String] cmd The command to run 
     | 
| 
      
 76 
     | 
    
         
            +
              # @param [String, Array] cmd The command to run (String or Array of arguments)
         
     | 
| 
       55 
77 
     | 
    
         
             
              # @param [String] stdin The +stdin+ to provide to the command
         
     | 
| 
       56 
78 
     | 
    
         
             
              # @param [Hash] env Hash of environment variables
         
     | 
| 
       57 
79 
     | 
    
         
             
              # @param [Loog|IO] log Logging facility with +.debug()+ method (or +$stdout+, or nil if should go to +/dev/null+)
         
     | 
| 
         @@ -85,29 +107,41 @@ module Kernel 
     | 
|
| 
       85 
107 
     | 
    
         
             
                buf = ''
         
     | 
| 
       86 
108 
     | 
    
         
             
                e = 1
         
     | 
| 
       87 
109 
     | 
    
         
             
                start = Time.now
         
     | 
| 
       88 
     | 
    
         
            -
                Open3.popen2e(env, "/bin/bash -c #{Shellwords.escape(cmd)}") do |sin, sout,  
     | 
| 
      
 110 
     | 
    
         
            +
                Open3.popen2e(env, "/bin/bash -c #{Shellwords.escape(cmd)}") do |sin, sout, ctrl|
         
     | 
| 
       89 
111 
     | 
    
         
             
                  sin.write(stdin)
         
     | 
| 
       90 
112 
     | 
    
         
             
                  sin.close
         
     | 
| 
       91 
113 
     | 
    
         
             
                  if block_given?
         
     | 
| 
       92 
     | 
    
         
            -
                     
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
       94 
     | 
    
         
            -
             
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
       101 
     | 
    
         
            -
                           
     | 
| 
       102 
     | 
    
         
            -
             
     | 
| 
       103 
     | 
    
         
            -
                           
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
     | 
    
         
            -
             
     | 
| 
      
 114 
     | 
    
         
            +
                    closed = false
         
     | 
| 
      
 115 
     | 
    
         
            +
                    watch =
         
     | 
| 
      
 116 
     | 
    
         
            +
                      Thread.new do
         
     | 
| 
      
 117 
     | 
    
         
            +
                        until closed
         
     | 
| 
      
 118 
     | 
    
         
            +
                          begin
         
     | 
| 
      
 119 
     | 
    
         
            +
                            ln = sout.gets
         
     | 
| 
      
 120 
     | 
    
         
            +
                          rescue IOError => e
         
     | 
| 
      
 121 
     | 
    
         
            +
                            ln = Backtrace.new(e).to_s
         
     | 
| 
      
 122 
     | 
    
         
            +
                          end
         
     | 
| 
      
 123 
     | 
    
         
            +
                          next if ln.nil?
         
     | 
| 
      
 124 
     | 
    
         
            +
                          next if ln.empty?
         
     | 
| 
      
 125 
     | 
    
         
            +
                          ln = "##{ctrl.pid}: #{ln}"
         
     | 
| 
      
 126 
     | 
    
         
            +
                          if log.nil?
         
     | 
| 
      
 127 
     | 
    
         
            +
                            # no logging
         
     | 
| 
      
 128 
     | 
    
         
            +
                          elsif log.respond_to?(mtd)
         
     | 
| 
      
 129 
     | 
    
         
            +
                            log.__send__(mtd, ln)
         
     | 
| 
      
 130 
     | 
    
         
            +
                          else
         
     | 
| 
      
 131 
     | 
    
         
            +
                            log.print(ln)
         
     | 
| 
      
 132 
     | 
    
         
            +
                          end
         
     | 
| 
      
 133 
     | 
    
         
            +
                          buf += ln
         
     | 
| 
       106 
134 
     | 
    
         
             
                        end
         
     | 
| 
       107 
     | 
    
         
            -
                        buf += ln
         
     | 
| 
       108 
135 
     | 
    
         
             
                      end
         
     | 
| 
      
 136 
     | 
    
         
            +
                    pid = ctrl.pid
         
     | 
| 
      
 137 
     | 
    
         
            +
                    yield pid
         
     | 
| 
      
 138 
     | 
    
         
            +
                    begin
         
     | 
| 
      
 139 
     | 
    
         
            +
                      Process.kill('TERM', pid)
         
     | 
| 
      
 140 
     | 
    
         
            +
                    rescue Errno::ESRCH
         
     | 
| 
      
 141 
     | 
    
         
            +
                      # simply ignore it
         
     | 
| 
       109 
142 
     | 
    
         
             
                    end
         
     | 
| 
       110 
     | 
    
         
            -
                     
     | 
| 
      
 143 
     | 
    
         
            +
                    closed = true
         
     | 
| 
      
 144 
     | 
    
         
            +
                    watch.join
         
     | 
| 
       111 
145 
     | 
    
         
             
                  else
         
     | 
| 
       112 
146 
     | 
    
         
             
                    until sout.eof?
         
     | 
| 
       113 
147 
     | 
    
         
             
                      begin
         
     | 
| 
         @@ -124,7 +158,7 @@ module Kernel 
     | 
|
| 
       124 
158 
     | 
    
         
             
                      end
         
     | 
| 
       125 
159 
     | 
    
         
             
                      buf += ln
         
     | 
| 
       126 
160 
     | 
    
         
             
                    end
         
     | 
| 
       127 
     | 
    
         
            -
                    e =  
     | 
| 
      
 161 
     | 
    
         
            +
                    e = ctrl.value.to_i
         
     | 
| 
       128 
162 
     | 
    
         
             
                    if !accept.nil? && !accept.include?(e)
         
     | 
| 
       129 
163 
     | 
    
         
             
                      raise "The command '#{cmd}' failed with exit code ##{e} in #{start.ago}\n#{buf}"
         
     | 
| 
       130 
164 
     | 
    
         
             
                    end
         
     |