gotsha 0.3.1 → 1.0.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: 0fcd97adf3389ca91dd4a960d384481f31846423bf51eac8ecda8cf4634d8eb8
4
- data.tar.gz: f59e613178b3708fe10ea46ec5367459185a3c1786dbad66fb84835ba789e016
3
+ metadata.gz: 16232c9b98aaded3d2b891cd656535e6bf459ca38d54713d02ff99edb30a315f
4
+ data.tar.gz: 3b2fa2a182a012259a8e6580904c4fbbe6ed4d46c2e92c9b29d0b2fbe5073711
5
5
  SHA512:
6
- metadata.gz: e5cd691e9c3b94e53d4f2772f06716423d941909a65ff21a2a662ef149d2436a70c6af3d6afceca7329f9ad17f30feadccb49ed07034cf02838c6d292f13e0fa
7
- data.tar.gz: c9b1fceb52dc6f154cc65d19b6e8fc0fc97128092c2f10b0de96c41844901c491e33c5ccd861bd0b521ec9bf12f22047b44239bf146d6e662faaf5bf1f9ff33d
6
+ metadata.gz: 43f2104554585f96fa39e4554478322bc754dd556ff763652a476a9a18833652a6656da00377559487aa1a25ad4022132bef82496768c1d1754b5e20b2d3ed6e
7
+ data.tar.gz: c46031edc29d263cebab3c7bfd3108187e7d3aae9e261ef22ecc5631956134fef27518f98175c2bf72953597ef7b08b62733a3b2a5ed8b3119b66e885fdfecd9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [1.0.1] - 2025-10-19
2
+
3
+ - Fix a bug, happening on first push in a new repository.
4
+
5
+ ## [1.0.0] - 2025-10-19
6
+
7
+ - Polish the readme.
8
+
1
9
  ## [0.3.1] - 2025-10-18
2
10
 
3
11
  - Add some non-Ruby test command examples to autogenerated config file. Gotsha is language-agnostic :-).
@@ -3,7 +3,7 @@
3
3
  module Gotsha
4
4
  module Actions
5
5
  class Commit
6
- DESCRIPTION = "creates a dummy commit and runs tests on it (use for manual sign-off, if you disable hooks)"
6
+ DESCRIPTION = "runs tests on a dummy commit for manual sign-off"
7
7
 
8
8
  def call
9
9
  BashCommand.silent_run!('git -c core.hooksPath=/dev/null commit --allow-empty -m "Run Gotsha"')
@@ -3,7 +3,7 @@
3
3
  module Gotsha
4
4
  module Actions
5
5
  class Configure
6
- DESCRIPTION = "opens Gotsha config file"
6
+ DESCRIPTION = "opens Gotsha config (all your tests and their autorun conditions are configured there)"
7
7
 
8
8
  def call
9
9
  editor = ENV["EDITOR"]
@@ -6,20 +6,36 @@ module Gotsha
6
6
  DESCRIPTION = "shows available commands and some tips (has optional <COMMAND> argument)"
7
7
  INTERNAL_ACTIONS = %i[fetch push test].freeze
8
8
 
9
+ INTERNAL_COMMAND_WARNING =
10
+ "[WARNING] This is an internal command; if everything works as intended, you should not need to run it"
11
+
9
12
  def call(action_name = nil)
10
13
  @action_name = action_name
11
14
 
12
15
  [
13
16
  "help",
14
17
  commands,
18
+ general_description,
19
+ internal_command_warning,
15
20
  action_description,
21
+ workflows_example,
16
22
  config_file,
17
23
  contact
18
- ].compact.join("\n\n")
24
+ ].compact.join("\n\n\n")
19
25
  end
20
26
 
21
27
  private
22
28
 
29
+ def general_description
30
+ return if @action_name
31
+
32
+ "About:\n" \
33
+ "Gotsha is a tiny local CI tool — it runs your tests locally, automatically stores the " \
34
+ "results as Git notes, and shows them right in your GitHub PR. You don’t need " \
35
+ "to change your workflow: just use `git commit` and `git push` as usual; Gotsha takes care of the rest.\n" \
36
+ "https://www.gotsha.org/"
37
+ end
38
+
23
39
  def commands
24
40
  return if @action_name
25
41
 
@@ -33,7 +49,7 @@ module Gotsha
33
49
  "gotsha #{name} # #{description}"
34
50
  end.compact.sort.join("\n")
35
51
 
36
- "Available commands: \n\n#{commands}\n"
52
+ "Available commands:\n#{commands}"
37
53
  end
38
54
 
39
55
  def action_description
@@ -46,17 +62,40 @@ module Gotsha
46
62
  raise Errors::HardFail, "unknown command `#{@action_name}`"
47
63
  end
48
64
 
65
+ def internal_command_warning
66
+ return unless @action_name
67
+ return unless INTERNAL_ACTIONS.include?(@action_name.to_sym)
68
+
69
+ INTERNAL_COMMAND_WARNING
70
+ end
71
+
72
+ def workflows_example
73
+ return if @action_name
74
+
75
+ [
76
+ "Typical workflows (and their setting in config file):",
77
+ "1. Super-fast tests (few seconds): run them automatically on every commit and push",
78
+ "- `post_commit_tests = true`",
79
+ "- `pre_push_tests = true`\n",
80
+ "2. Slower but still fast (tens of seconds): run them automatically on every push, but not on each commit",
81
+ "- `post_commit_tests = false`",
82
+ "- `pre_push_tests = true`\n",
83
+ "3. Even slower (or just annoying) tests: run them manually with `gotsha commit` command, right before " \
84
+ " asking for review. Don’t allow any autorun",
85
+ "- `post_commit_tests = false`",
86
+ "- `pre_push_tests = false`\n"
87
+ ].join("\n")
88
+ end
89
+
49
90
  def config_file
50
91
  return if @action_name
51
92
 
52
93
  [
53
- "Config file:",
54
- "How and when Gotsha runs tests is configured in `#{Config::CONFIG_FILE}` file, " \
55
- "so it's the most important file to check and understand! Luckily, it's brief " \
56
- "and contains explaining comments. If you deleted the comments it was originally " \
57
- "generated with, or you're not sure how to set it, see " \
58
- "https://github.com/melounvitek/gotsha/blob/master/lib/gotsha/templates/config.toml\n"
59
- ].join("\n\n")
94
+ "Original config file:",
95
+ "If you deleted the explaining comments config file was " \
96
+ "generated with and something is not clear now, see the original version here: " \
97
+ "https://github.com/melounvitek/gotsha/blob/master/lib/gotsha/templates/config.toml"
98
+ ].join("\n")
60
99
  end
61
100
 
62
101
  def contact
@@ -66,7 +105,7 @@ module Gotsha
66
105
  "Contact:",
67
106
  "Is something not clear? Did you find a bug? Would you use new feature? Let's talk! \n" \
68
107
  "Freel free to email me (vitek@meloun.info), or create an issue (https://github.com/melounvitek/gotsha/issues/)"
69
- ]
108
+ ].join("\n")
70
109
  end
71
110
  end
72
111
  end
@@ -9,7 +9,9 @@ module Gotsha
9
9
  try_push = push_command
10
10
 
11
11
  unless try_push.success?
12
+ puts "First push detected, need to run tests one more time..."
12
13
  Fetch.new.call
14
+ Test.new.call
13
15
  push_command
14
16
  end
15
17
 
@@ -3,7 +3,7 @@
3
3
  module Gotsha
4
4
  module Actions
5
5
  class Show
6
- DESCRIPTION = "shows last commit test results"
6
+ DESCRIPTION = "displays full test results for last commit"
7
7
 
8
8
  def call
9
9
  command = BashCommand.silent_run!("git --no-pager notes --ref=gotsha show")
@@ -3,7 +3,7 @@
3
3
  module Gotsha
4
4
  module Actions
5
5
  class Status
6
- DESCRIPTION = "displays last commit tests status"
6
+ DESCRIPTION = "returns latest commit tests status (passed / failed / not verified)"
7
7
 
8
8
  def call
9
9
  last_commit_sha = BashCommand.run!("git --no-pager rev-parse HEAD").text_output
@@ -1,9 +1,14 @@
1
1
  #
2
2
  # Gotsha
3
3
  #
4
+ # Original template this file is generated from (in case you deleted some option in your
5
+ # and want to check what it originally looked like):
6
+ # https://github.com/melounvitek/gotsha/blob/master/lib/gotsha/templates/config.toml
7
+ #
4
8
  # Start by removing the `autogenerated` line below. While doing that,
5
9
  # please, check the rest of this file to configure Gotsha as you need
6
10
  #
11
+ #
7
12
  autogenerated = true # Remove this line to start using Gotsha
8
13
 
9
14
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gotsha
4
- VERSION = "0.3.1"
4
+ VERSION = "1.0.1"
5
5
  end
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.3.1
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vitek Meloun