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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +4 -1
- data/lib/gotsha/bash_command.rb +25 -8
- data/lib/gotsha/version.rb +1 -1
- data/web/index.html +4 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ae454dd9d8275719a0a1e4122be0075a6cdb198e5ce294829993d0b1ac3422da
|
|
4
|
+
data.tar.gz: b68234f7ebec3d02720f30da620988c7d7b7bf16b53bcba2369711d59ec6ddc7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 46efa5956c790a2ab91363ec7ad23fd8713d3945add64766c226e0494f891b637558ba6ddf9219472f9a83957d63e58a346449e755b7bd7b5baf93f7efe955cc
|
|
7
|
+
data.tar.gz: 4c8d1e824084191a1d592059e01e22b1c80ff50cf397951c600db91713cdf853e9c4847b101a7aec12b1ba1dddb84990f9bab958caff2a5f801aecad9116bb44
|
data/CHANGELOG.md
CHANGED
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
|
|
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>
|
data/lib/gotsha/bash_command.rb
CHANGED
|
@@ -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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
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)
|
data/lib/gotsha/version.rb
CHANGED
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
|
|
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>
|