gotsha 0.2.4 → 0.2.5

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: 10fb8a6db8218b332233ac4ad14b6c624492b8f2fb98b4119464b499a70a554a
4
- data.tar.gz: 2e1bbd995e94b0e48a235f473afd6fa968a6e859c23bbcfdef02fa7ce241f03a
3
+ metadata.gz: 91171467c8757fdfc1daa7d26824b5282a3273bc25649f67d907a24da5ed4b6b
4
+ data.tar.gz: 2c8892e5129b38130dd7f3bb4f8b8a31330627754883c0e6fcf10d3191306e7a
5
5
  SHA512:
6
- metadata.gz: 8241e21611a88f26e29ac8fa1c7170367adb76ed330520f0667f53d6647f478b5513c1c32946c4eb581644864e812c40aaaec2587015a7ee8911ae93d5c2ed76
7
- data.tar.gz: 1a0d90f0de82ba6fedc88422896b011140ff074babeff155f5c57f993d754fb53b05654564a452d956fd8fa702d5aa9271d0622477b6c48f6e93fedbc665d50e
6
+ metadata.gz: 2f05012248c5e815491ff5418a8a7fa09d736c6d9b103a6b083a80ddb1e9546897ce7e8e3d0b2b3d1c3acddd6369b3e5e4eb4755044aa7d3a4e25851c7e00eb3
7
+ data.tar.gz: cb17994999f70a0600a3c9fbea42197a5054c7e7a5031e7960849e8d67e24d289df5faca6396e356ab3f5bcbffc7fa076558b282ccf3657d907a8352e188fea4
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env bash
2
2
  set -euo pipefail
3
- [ -f .gotsha/config.toml ] || exit 0
3
+
4
4
  grep -qE 'post_commit_tests\s*=\s*true' .gotsha/config.toml || exit 0
5
+
5
6
  exe/gotsha test
6
7
 
@@ -1,21 +1,7 @@
1
1
  #!/usr/bin/env bash
2
2
  set -euo pipefail
3
3
 
4
- [ -f .gotsha/config.toml ] || exit 0
4
+ grep -qE 'pre_push_tests\s*=\s*true' .gotsha/config.toml || exit 0
5
5
 
6
- grep -qE 'pre_push_tests\s*=\s*true' .gotsha/config.toml && (exe/gotsha status || exe/gotsha test)
7
-
8
- push_gotsha_notes() {
9
- # if already done before, let's only push the notes and exit
10
- git push --no-verify origin refs/notes/gotsha:refs/notes/gotsha && return 0
11
-
12
- # if pushing above failed, it means we need to do some one-time Git setup
13
- git fetch origin 'refs/notes/gotsha:refs/notes/gotsha-remote'
14
- git notes --ref=gotsha merge -v refs/notes/gotsha-remote
15
- git update-ref -d refs/notes/gotsha-remote
16
-
17
- # ... and push again!
18
- git push --no-verify origin refs/notes/gotsha:refs/notes/gotsha
19
- }
20
-
21
- push_gotsha_notes
6
+ exe/gotsha status || exe/gotsha test
7
+ exe/gotsha push
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.2.5] - 2025-10-14
2
+
3
+ - Introduce `push` and `fetch` commands
4
+
1
5
  ## [0.2.4] - 2025-10-14
2
6
 
3
7
  - Change Github Action config to actually use the gem itself (instead of bash scripting the logic)
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gotsha
4
+ module Actions
5
+ class Fetch
6
+ DESCRIPTION = "fetches Gotsha test results from remote"
7
+
8
+ def call
9
+ command = BashCommand.silent_run!("git fetch origin 'refs/notes/gotsha:refs/notes/gotsha'")
10
+
11
+ raise(Errors::HardFail, "something went wrong") unless command.success?
12
+
13
+ "fetched"
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gotsha
4
+ module Actions
5
+ class Push
6
+ DESCRIPTION = "pushes Gotsha test results to remote"
7
+
8
+ def call
9
+ try_push = push_command
10
+
11
+ unless try_push.success?
12
+ Fetch.new.call
13
+ push_command
14
+ end
15
+
16
+ "pushed"
17
+ end
18
+
19
+ private
20
+
21
+ def push_command
22
+ BashCommand.silent_run!("git push --no-verify origin refs/notes/gotsha:refs/notes/gotsha")
23
+ end
24
+ end
25
+ end
26
+ end
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env bash
2
2
  set -euo pipefail
3
- [ -f .gotsha/config.toml ] || exit 0
3
+
4
4
  grep -qE 'post_commit_tests\s*=\s*true' .gotsha/config.toml || exit 0
5
+
5
6
  gotsha test
6
7
 
@@ -1,21 +1,7 @@
1
1
  #!/usr/bin/env bash
2
2
  set -euo pipefail
3
3
 
4
- [ -f .gotsha/config.toml ] || exit 0
4
+ grep -qE 'pre_push_tests\s*=\s*true' .gotsha/config.toml || exit 0
5
5
 
6
- grep -qE 'pre_push_tests\s*=\s*true' .gotsha/config.toml && (gotsha status || gotsha test)
7
-
8
- push_gotsha_notes() {
9
- # if already done before, let's only push the notes and exit
10
- git push --no-verify origin refs/notes/gotsha:refs/notes/gotsha && return 0
11
-
12
- # if pushing above failed, it means we need to do some one-time Git setup
13
- git fetch origin 'refs/notes/gotsha:refs/notes/gotsha-remote'
14
- git notes --ref=gotsha merge -v refs/notes/gotsha-remote
15
- git update-ref -d refs/notes/gotsha-remote
16
-
17
- # ... and push again!
18
- git push --no-verify origin refs/notes/gotsha:refs/notes/gotsha
19
- }
20
-
21
- push_gotsha_notes
6
+ gotsha status || gotsha test
7
+ gotsha push
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gotsha
4
- VERSION = "0.2.4"
4
+ VERSION = "0.2.5"
5
5
  end
data/lib/gotsha.rb CHANGED
@@ -6,8 +6,10 @@ require "toml-rb"
6
6
  require_relative "gotsha/action_dispatcher"
7
7
  require_relative "gotsha/actions/commit"
8
8
  require_relative "gotsha/actions/configure"
9
+ require_relative "gotsha/actions/fetch"
9
10
  require_relative "gotsha/actions/help"
10
11
  require_relative "gotsha/actions/init"
12
+ require_relative "gotsha/actions/push"
11
13
  require_relative "gotsha/actions/show"
12
14
  require_relative "gotsha/actions/test"
13
15
  require_relative "gotsha/actions/uninstall"
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.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vitek Meloun
@@ -45,8 +45,10 @@ files:
45
45
  - lib/gotsha/action_dispatcher.rb
46
46
  - lib/gotsha/actions/commit.rb
47
47
  - lib/gotsha/actions/configure.rb
48
+ - lib/gotsha/actions/fetch.rb
48
49
  - lib/gotsha/actions/help.rb
49
50
  - lib/gotsha/actions/init.rb
51
+ - lib/gotsha/actions/push.rb
50
52
  - lib/gotsha/actions/show.rb
51
53
  - lib/gotsha/actions/status.rb
52
54
  - lib/gotsha/actions/test.rb