gotsha 1.1.2 → 1.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c3a4f52cfc935cebef5d7ef1b3c8b5d7a47cfd1ab8e1c19a8da7f99e367f3d53
4
- data.tar.gz: a071da5be867b95a3eb8ab8c7462e75b45f87435ce2417213e07cc4a105ebf52
3
+ metadata.gz: 59819d703031cede0668b5e6c8aca1c7c40878686980409959c317a3ca324167
4
+ data.tar.gz: 57a0b4cc088a9e2be2ba8376d7d6245594ed8e80f87840137407167ac7af715a
5
5
  SHA512:
6
- metadata.gz: 312c71aa07da097887c161131fbaaa7da9050a2f925e335847f02fb3bbfd24114fff4eb5d2cf55fdac0bceb7ea1e4cb03f9d6d84b9b1e11325a9eb60b13e06f7
7
- data.tar.gz: d1bd26abb492627fca22a620e64df2d4dde4223cedc06dbf186c2ed3dbfa9537a68d57022a8b7eb76e97e4ea180c118636b04a33d35e512ba5ba1d2c680bbab2
6
+ metadata.gz: fb9be6d111bbebe9ee3cc58e06b1b8efcc00c16a2748aa0ec3e4d717eccb0751d41cd4a50d122b57df79d997992c2f5a764f38f82ccb62e219db1b97c993a535
7
+ data.tar.gz: b6160768b55f3383b5d78202b7f11a0f6fdad5b959c7ce77e85727325a033e4fc3971997b87c502cd5e5543bc1ed17509a6229eab888b2ec84d253472ea227e5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [1.2.1] - 2025-10-30
2
+
3
+ - Enhance pre-generated Github Action and GitLab CI configs
4
+ - Always force push Git notes (clear history is not an objective here; we just need a reliable way for the most recent commit notes to get there every time, and since we also use force in fetching, this is an OK approach)
5
+
6
+ ## [1.2.0] - 2025-10-26
7
+
8
+ - Add `gotsha version` (and support `-v` and `--version`)
9
+ - `gotsha --help` is now supported too
10
+ - Relax the required TOML version (it does not matter that much here, and some people reported they had issues with the 3 version required)
11
+ - Remove a leftover old GH action example
12
+
1
13
  ## [1.1.2] - 2025-10-25
2
14
 
3
15
  - Add less intrusive GitLab CI config file generation (to not overwrite existing one)
data/README.md CHANGED
@@ -1,5 +1,4 @@
1
- <a href="https://rubygems.org/gems/gotsha"><img src="https://badge.fury.io/rb/gotsha.svg?icon=si%3Arubygems" /></a>
2
-
1
+ <a href="https://rubygems.org/gems/gotsha"><img src="https://badge.fury.io/rb/gotsha.svg?icon=si%3Arubygems&refresh=2" /></a>
3
2
  # Gotsha — your local testing CI
4
3
  Pushing untested commits? Gotsha!
5
4
 
@@ -5,6 +5,7 @@ module Gotsha
5
5
  SKIP_CONFIG_VERIFICATION_FOR = %w[init configure uninstall].freeze
6
6
  DEFAULT_ACTION = "help"
7
7
  HELP_ACTION_SHORTCUT = "-h"
8
+ VERSION_ACTION_SHORTCUT = "-v"
8
9
 
9
10
  def self.call(action_name = DEFAULT_ACTION, *args)
10
11
  action_name ||= DEFAULT_ACTION
@@ -20,6 +21,7 @@ module Gotsha
20
21
  action_class.new.call(*args)
21
22
  rescue ArgumentError
22
23
  return Actions::Help.new.call(action_name) if args == [HELP_ACTION_SHORTCUT]
24
+ return Actions::Help.new.call(action_name) if args == ["--help"]
23
25
 
24
26
  raise Errors::HardFail, "too many arguments"
25
27
  end
@@ -47,9 +49,12 @@ module Gotsha
47
49
  end
48
50
 
49
51
  def action_class
50
- Kernel.const_get("Gotsha::Actions::#{action_name.to_s.capitalize}")
52
+ class_name = action_name.to_s.delete_prefix("--").capitalize
53
+
54
+ Kernel.const_get("Gotsha::Actions::#{class_name}")
51
55
  rescue NameError
52
56
  return Gotsha::Actions::Help if action_name.to_s == HELP_ACTION_SHORTCUT
57
+ return Actions::Version if action_name.to_s == VERSION_ACTION_SHORTCUT
53
58
 
54
59
  raise Errors::HardFail, "unknown command `#{action_name}`. See available commands via `gotsha help`."
55
60
  end
@@ -6,23 +6,12 @@ module Gotsha
6
6
  DESCRIPTION = "pushes Gotsha test results to remote"
7
7
 
8
8
  def call
9
- try_push = push_command
9
+ command = BashCommand.silent_run!("git push --no-verify --force origin refs/notes/gotsha:refs/notes/gotsha")
10
10
 
11
- unless try_push.success?
12
- puts "First push detected, need to run tests one more time..."
13
- Fetch.new.call
14
- Test.new.call
15
- push_command
16
- end
11
+ raise(Errors::HardFail, "something went wrong") unless command.success?
17
12
 
18
13
  "pushed"
19
14
  end
20
-
21
- private
22
-
23
- def push_command
24
- BashCommand.silent_run!("git push --no-verify origin refs/notes/gotsha:refs/notes/gotsha")
25
- end
26
15
  end
27
16
  end
28
17
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gotsha
4
+ module Actions
5
+ class Version
6
+ DESCRIPTION = "returns Gotsha version"
7
+
8
+ def call
9
+ VERSION
10
+ end
11
+ end
12
+ end
13
+ end
@@ -2,11 +2,13 @@ name: Gotsha
2
2
 
3
3
  on:
4
4
  pull_request:
5
- # Uncomment line below to run Gotsha only when asking for review (ie. do not run when PR is draft)
6
- # types: [ready_for_review]
5
+ types: [opened, ready_for_review, synchronize]
7
6
 
8
7
  jobs:
9
8
  verify:
9
+ # Uncomment line below to run Gotsha only after asking for review (ie. do not run when PR is draft)
10
+ #if: github.event.action == 'ready_for_review' || (github.event.action == 'synchronize' && !github.event.pull_request.draft)
11
+
10
12
  runs-on: ubuntu-latest
11
13
  steps:
12
14
  - uses: actions/checkout@v4
@@ -1,6 +1,6 @@
1
1
  # Start using Gotsha in GitLab by renaming this file to `.gitlab-ci.yml`.
2
2
  #
3
- # If it already exists, append this to its end:
3
+ # If that file already exists, append this to its end instead of any renaming:
4
4
  #
5
5
  #include:
6
6
  # - local: '.gitlab-ci.gotsha.yml'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gotsha
4
- VERSION = "1.1.2"
4
+ VERSION = "1.2.1"
5
5
  end
data/lib/gotsha.rb CHANGED
@@ -11,9 +11,10 @@ require_relative "gotsha/actions/help"
11
11
  require_relative "gotsha/actions/init"
12
12
  require_relative "gotsha/actions/push"
13
13
  require_relative "gotsha/actions/show"
14
+ require_relative "gotsha/actions/status"
14
15
  require_relative "gotsha/actions/test"
15
16
  require_relative "gotsha/actions/uninstall"
16
- require_relative "gotsha/actions/status"
17
+ require_relative "gotsha/actions/version"
17
18
  require_relative "gotsha/bash_command"
18
19
  require_relative "gotsha/config"
19
20
  require_relative "gotsha/errors"
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: 1.1.2
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vitek Meloun
@@ -13,16 +13,16 @@ dependencies:
13
13
  name: toml-rb
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - "~>"
16
+ - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: '3.0'
18
+ version: '2.0'
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
- - - "~>"
23
+ - - ">="
24
24
  - !ruby/object:Gem::Version
25
- version: '3.0'
25
+ version: '2.0'
26
26
  email:
27
27
  - vitek@meloun.info
28
28
  executables:
@@ -31,7 +31,6 @@ extensions: []
31
31
  extra_rdoc_files: []
32
32
  files:
33
33
  - ".gotsha/config.toml"
34
- - ".gotsha/github_action_example.yml"
35
34
  - ".gotsha/hooks/post-commit"
36
35
  - ".gotsha/hooks/pre-push"
37
36
  - ".rspec"
@@ -53,6 +52,7 @@ files:
53
52
  - lib/gotsha/actions/status.rb
54
53
  - lib/gotsha/actions/test.rb
55
54
  - lib/gotsha/actions/uninstall.rb
55
+ - lib/gotsha/actions/version.rb
56
56
  - lib/gotsha/bash_command.rb
57
57
  - lib/gotsha/config.rb
58
58
  - lib/gotsha/errors.rb
@@ -1,29 +0,0 @@
1
- # If you want to create Github Action, copy this file into .gihtub folder
2
- # For example to: .github/workflows/main.yml
3
- name: Gotsha
4
-
5
- on:
6
- pull_request:
7
-
8
- jobs:
9
- verify:
10
- runs-on: ubuntu-latest
11
- steps:
12
- - uses: actions/checkout@v4
13
- with:
14
- fetch-depth: 0
15
- ref: ${{ github.event.pull_request.head.sha }}
16
-
17
- - name: Fetch gotsha notes
18
- run: git fetch origin 'refs/notes/gotsha:refs/notes/gotsha'
19
-
20
- - name: Verify gotsha note
21
- run: |
22
- SHA="${{ github.event.pull_request.head.sha }}"
23
- NOTE="$(git notes --ref=gotsha show "$SHA" 2>/dev/null || true)"
24
- if [ "$NOTE" = "ok" ]; then
25
- echo "✓ gotsha verified for $SHA"
26
- else
27
- echo "::error ::Missing gotsha note for $SHA"
28
- exit 1
29
- fi