gotsha 0.2.1.0 → 0.2.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: 6513381251aa65bb231bbb03a6a15b0e13392b2ddcda252adaae3dc9c727ea93
4
- data.tar.gz: f395bf9ee7c4aadf18f77e63a8baa10d8ba508f6b9f5d8c0cfadefe8d1dc35e6
3
+ metadata.gz: ae454dd9d8275719a0a1e4122be0075a6cdb198e5ce294829993d0b1ac3422da
4
+ data.tar.gz: b68234f7ebec3d02720f30da620988c7d7b7bf16b53bcba2369711d59ec6ddc7
5
5
  SHA512:
6
- metadata.gz: 8fa73ee5d522b3ead62113aff1d7fbe3bfdb867177ef6e13728104e4ad493d6b3ba99a15209ffbb0c2d558bb76e458e71d0467a84e98defc1e56500988b648c9
7
- data.tar.gz: dc935b2b9f4700d68040111b402f182bf93cc88cad473e20ff35a6e1df6059e3125d4c7b79dfc602ad4e69e458123e698edadbeacc9c7e273f287a63177862dc
6
+ metadata.gz: 46efa5956c790a2ab91363ec7ad23fd8713d3945add64766c226e0494f891b637558ba6ddf9219472f9a83957d63e58a346449e755b7bd7b5baf93f7efe955cc
7
+ data.tar.gz: 4c8d1e824084191a1d592059e01e22b1c80ff50cf397951c600db91713cdf853e9c4847b101a7aec12b1ba1dddb84990f9bab958caff2a5f801aecad9116bb44
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.2.2] - 2025-10-13
2
+
3
+ - Fix to ensure everything works on Mac as well
4
+
1
5
  ## [0.2.1.0] - 2025-10-13
2
6
 
3
7
  - Better `help` output
data/README.md CHANGED
@@ -3,7 +3,7 @@ Pushing untested commits? Gotsha!
3
3
 
4
4
  ## Installation
5
5
  ```bash
6
- gem install gotsha # or add `gem "gotsha"` to you Gemfile and run `bundle install`
6
+ gem install gotsha # or add `gem "gotsha"` to you Gemfile
7
7
 
8
8
  gotsha
9
9
  ```
@@ -27,3 +27,6 @@ Then, you can see the tests results in a Github action:
27
27
  (Screenshots from a real [demo pull request](https://github.com/melounvitek/gotsha/pull/35); check it out!)
28
28
 
29
29
  Based on your workflow and tests speed, you can configure them to auto-run on every commit, before every push, or just manually. Whenever pushing to remote repository, the Git note (which is what's used to store the test results) gets sent there as well.
30
+
31
+ ## Do you like Gotsha?
32
+ <a href="https://buymeacoffee.com/gotsha">I like coffee!</a>
@@ -1,32 +1,49 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "pty"
4
- require "shellwords"
5
4
 
6
5
  module Gotsha
7
6
  class BashCommand
8
7
  FORCE_OUTPUT_AFTER = 5
8
+ MARKER = "__GOTSHA_EXIT__:"
9
9
 
10
+ # rubocop:disable Metrics/AbcSize
11
+ # rubocop:disable Metrics/CyclomaticComplexity
12
+ # rubocop:disable Metrics/MethodLength
10
13
  def self.run!(command)
11
14
  start_time = Time.now
12
15
  UserConfig.get(:verbose) && puts(command)
13
16
 
14
17
  stdout = +""
18
+ exit_code = nil
15
19
 
16
- wrapped = %(script -qefc #{Shellwords.escape(command)} /dev/null)
17
-
18
- io = IO.popen(wrapped, in: File::NULL, err: %i[child out])
19
- begin
20
- io.each do |line|
21
- (UserConfig.get(:verbose) || Time.now - start_time > FORCE_OUTPUT_AFTER) && puts(line)
20
+ # This block is an ugly workaround to ensure the color output is stored both on Linux and Mac
21
+ PTY.spawn("bash", "-lc", "#{command}; printf \"\\n#{MARKER}%d\\n\" $?") do |r, _w, pid|
22
+ r.each do |line|
23
+ if line.start_with?(MARKER)
24
+ exit_code = line.sub(MARKER, "").to_i
25
+ next
26
+ end
27
+ puts line if UserConfig.get(:verbose) || Time.now - start_time > FORCE_OUTPUT_AFTER
22
28
  stdout << line
23
29
  end
30
+ rescue Errno::EIO
31
+ # PTY closes when process ends — safe to ignore
24
32
  ensure
25
- _, status = Process.wait2(io.pid)
33
+ Process.wait(pid)
26
34
  end
27
35
 
36
+ final_code = exit_code || $CHILD_STATUS.exitstatus
37
+ status = Struct.new(:exitstatus) do
38
+ def success?
39
+ exitstatus.zero?
40
+ end
41
+ end.new(final_code)
28
42
  new(stdout, status)
29
43
  end
44
+ # rubocop:enable Metrics/AbcSize
45
+ # rubocop:enable Metrics/CyclomaticComplexity
46
+ # rubocop:enable Metrics/MethodLength
30
47
 
31
48
  def self.silent_run!(command)
32
49
  return run!(command) if UserConfig.get(:verbose)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gotsha
4
- VERSION = "0.2.1.0"
4
+ VERSION = "0.2.2"
5
5
  end
data/web/index.html CHANGED
@@ -109,13 +109,13 @@
109
109
  <p>Gotsha is distrubuted as a Ruby gem, so you need to
110
110
  have <strong>Ruby</strong> working in your system. Apart from that, the only
111
111
  other dependency is <strong>Git</strong>.</p>
112
- <pre><code># Install manually
112
+ <pre><code># Install manually; language agnostic
113
113
  gem install gotsha
114
114
 
115
- # Or via your Gemfile
115
+ # Or install via your Gemfile in Ruby projects
116
116
  gem 'gotsha'
117
117
  </code></pre>
118
- <p>Then just go to a project folder, run <code>gotsha</code> command, and follow the prompts — Gotsha will guide you through the setup. It won't take more than 3 minutes!</p>
118
+ <p>Then just go to your project folder, run <code>gotsha</code> command, and follow the prompts — Gotsha will guide you through the setup. It won't take more than 3 minutes!</p>
119
119
  <p>If you got stuck somewhere, you can always use <code>gotsha help</code>.</p>
120
120
  </section>
121
121
 
@@ -157,6 +157,7 @@ gem 'gotsha'
157
157
 
158
158
  <p class="foot">
159
159
  © <span id="y"></span> <a target="_blank" href="https://x.com/melounvitek">Vítek Meloun</a> (<a target="_blank" href="mailto:vitek@meloun.info">vitek@meloun.info</a>)
160
+ <script type="text/javascript" src="https://cdnjs.buymeacoffee.com/1.0.0/button.prod.min.js" data-name="bmc-button" data-slug="gotsha" data-color="#FFDD00" data-emoji="" data-font="Cookie" data-text="Buy me a coffee" data-outline-color="#000000" data-font-color="#000000" data-coffee-color="#ffffff" ></script>
160
161
  </p>
161
162
  </main>
162
163
  </div>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gotsha
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vitek Meloun