gotsha 0.1.3.0 → 0.2.1.0

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: 7cc53441d5c13c208759724198863f72511910b7ae0cc254c76b379dd2fddd5d
4
- data.tar.gz: f5f8defa0dec285e5a2c047c09c57c68d909a2f88f08e56e067ac38f33685bd5
3
+ metadata.gz: 6513381251aa65bb231bbb03a6a15b0e13392b2ddcda252adaae3dc9c727ea93
4
+ data.tar.gz: f395bf9ee7c4aadf18f77e63a8baa10d8ba508f6b9f5d8c0cfadefe8d1dc35e6
5
5
  SHA512:
6
- metadata.gz: d61d8c2d838f5f4c47dd8e14f13ba4a64de2b5382a7e8af52724bafc156eb31d299744598338d1ebf38a449963e85c4a396e209ed2aa929dfe717002fcb87ea4
7
- data.tar.gz: bd09d4dd15ace3d90155611a830cf3866907e2d7cee02325f21233e2c2b1fb2711efc1a741a5eb18667362c5d9a908d29801b0470be12574c5097f9abc16c71d
6
+ metadata.gz: 8fa73ee5d522b3ead62113aff1d7fbe3bfdb867177ef6e13728104e4ad493d6b3ba99a15209ffbb0c2d558bb76e458e71d0467a84e98defc1e56500988b648c9
7
+ data.tar.gz: dc935b2b9f4700d68040111b402f182bf93cc88cad473e20ff35a6e1df6059e3125d4c7b79dfc602ad4e69e458123e698edadbeacc9c7e273f287a63177862dc
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## [0.2.1.0] - 2025-10-13
2
+
3
+ - Better `help` output
4
+ - New command `gotsha configure` (opens config file in ENV EDITOR)
5
+
1
6
  ## [0.1.1] - 2025-10-12
2
7
 
3
8
  - Some cleanup after verifying the gem is published
data/README.md CHANGED
@@ -9,6 +9,8 @@ gotsha
9
9
  ```
10
10
  Then just follow the prompts — Gotsha will guide you through the setup. It won't take more than 3 minutes!
11
11
 
12
+ If you got stuck somewhere, you can always use `gotsha help`.
13
+
12
14
  ## What is it?
13
15
  Gotsha is a tiny tool that lets you “sign off” your commit locally: it runs your tests and then stores the test results with the commit SHA (hence the gem name: got-SHA). Your pull request can then be verified against that record, so reviewers know you actually ran the checks before asking for review.
14
16
 
@@ -4,6 +4,7 @@ module Gotsha
4
4
  class ActionDispatcher
5
5
  INIT_SETUP_ACTION = "init"
6
6
  DEFAULT_ACTION = "help"
7
+ OPEN_CONFIG_ACTION = "configure"
7
8
 
8
9
  def self.call(action_name = DEFAULT_ACTION)
9
10
  action_name ||= DEFAULT_ACTION
@@ -35,9 +36,11 @@ module Gotsha
35
36
  end
36
37
 
37
38
  return unless UserConfig.get(:autogenerated)
39
+ return if action_name.to_s == OPEN_CONFIG_ACTION
38
40
 
39
41
  raise Errors::HardFail,
40
- "autogenerated config detected! Please, remove `autogenerated = true` from `.gotsha/config.toml`"
42
+ "autogenerated config detected! Please, remove `autogenerated = true` from `#{Config::CONFIG_FILE}` " \
43
+ "(you can run `gotsha configure` to open it)"
41
44
  end
42
45
 
43
46
  def action_class
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gotsha
4
+ module Actions
5
+ class Configure
6
+ DESCRIPTION = "opens Gotsha config file"
7
+
8
+ def call
9
+ editor = ENV["EDITOR"]
10
+
11
+ raise(Errors::HardFail, "please, set ENV variable `EDITOR` first") unless editor
12
+
13
+ if Kernel.system("#{editor} #{Config::CONFIG_FILE}")
14
+ "done"
15
+ else
16
+ raise Errors::HardFail,
17
+ "something went wrong, please check whether `#{editor}` editor (set in ENV variable `EDITOR`) works"
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -3,17 +3,47 @@
3
3
  module Gotsha
4
4
  module Actions
5
5
  class Help
6
- DESCRIPTION = "shows available commands"
6
+ DESCRIPTION = "shows available commands and some tips"
7
7
 
8
8
  def call
9
+ [
10
+ "help",
11
+ commands,
12
+ config_file,
13
+ contact
14
+ ].join("\n\n")
15
+ end
16
+
17
+ private
18
+
19
+ def commands
9
20
  commands = Gotsha::Actions.constants.map do |command|
10
21
  name = command.downcase
11
22
  description = Kernel.const_get("Gotsha::Actions::#{command}::DESCRIPTION")
12
23
 
13
- "#{name} # #{description}"
24
+ "gotsha #{name} # #{description}"
14
25
  end.sort.join("\n")
15
26
 
16
- "Available commands: \n\n#{commands}"
27
+ "Available commands: \n\n#{commands}\n"
28
+ end
29
+
30
+ def config_file
31
+ [
32
+ "Config file:",
33
+ "How and when Gotsha runs tests is configured in `#{Config::CONFIG_FILE}` file, " \
34
+ "so it's the most important file to check and understand! Luckily, it's brief " \
35
+ "and contains explaining comments. If you deleted the comments it was originally " \
36
+ "generated with, or you're not sure how to set it, see " \
37
+ "https://github.com/melounvitek/gotsha/blob/master/lib/gotsha/templates/config.toml\n"
38
+ ].join("\n\n")
39
+ end
40
+
41
+ def contact
42
+ [
43
+ "Contact:",
44
+ "Is something not clear? Did you find a bug? Would you use new feature? Let's talk! \n" \
45
+ "Freel free to email me (vitek@meloun.info), or create an issue (https://github.com/melounvitek/gotsha/issues/)"
46
+ ]
17
47
  end
18
48
  end
19
49
  end
@@ -26,7 +26,8 @@ module Gotsha
26
26
  return if commands.any?
27
27
 
28
28
  raise(Errors::HardFail,
29
- "please, define some test commands in `.gotsha/config.toml`")
29
+ "please, define some test commands in `#{Config::CONFIG_FILE}` " \
30
+ "(you can run `gotsha configure` to open it)")
30
31
  end
31
32
 
32
33
  def run_commands!
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gotsha
4
- VERSION = "0.1.3.0"
4
+ VERSION = "0.2.1.0"
5
5
  end
data/lib/gotsha.rb CHANGED
@@ -5,6 +5,7 @@ require "toml-rb"
5
5
 
6
6
  require_relative "gotsha/action_dispatcher"
7
7
  require_relative "gotsha/actions/commit"
8
+ require_relative "gotsha/actions/configure"
8
9
  require_relative "gotsha/actions/help"
9
10
  require_relative "gotsha/actions/init"
10
11
  require_relative "gotsha/actions/show"
Binary file
Binary file
Binary file
data/web/img/push.png ADDED
Binary file
data/web/index.html CHANGED
@@ -109,15 +109,14 @@
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
- <h3>Install gem</h3>
113
112
  <pre><code># Install manually
114
113
  gem install gotsha
115
114
 
116
115
  # Or via your Gemfile
117
116
  gem 'gotsha'
118
117
  </code></pre>
119
- <h3>Run <code>gotsha</code></h3>
120
- <p>Then just 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 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>
119
+ <p>If you got stuck somewhere, you can always use <code>gotsha help</code>.</p>
121
120
  </section>
122
121
 
123
122
  <section class="card">
@@ -125,6 +124,10 @@ gem 'gotsha'
125
124
  <article>
126
125
  <h3>1) Runs locally</h3>
127
126
  <p>Gotsha runs the project test suite on your machine. This can happen automatically (for every Git commit or push), or manually; right before you ask for review. You can easily configure it whatever way suits your project best.</p>
127
+ <img
128
+ style="max-width: 100%; height: auto; display: block; margin: 15px auto;"
129
+ src="img/commit.png"
130
+ />
128
131
  </article>
129
132
  <article>
130
133
  <h3>2) Stores test results for commit SHA</h3>
@@ -133,7 +136,21 @@ gem 'gotsha'
133
136
  <article>
134
137
  <h3>3) Displays results in your GitHub PR</h3>
135
138
  <p>Push as usual — the note follows your commit, and tiny Github Action instantly verifies it
136
- and makes the tests result visible to reviewers. <a target="_blank" href="https://gotsha.org/failed_build.png">Check it out</a>; it even persist all the colors!</p>
139
+ and makes the tests result visible to reviewers.
140
+ <img
141
+ style="max-width: 100%; height: auto; display: block; margin: 15px auto;"
142
+ src="img/push.png"
143
+ />
144
+
145
+ <img
146
+ style="max-width: 100%; height: auto; width: 71%; display: block; margin: 15px auto;"
147
+ src="img/gh_action.png"
148
+ />
149
+
150
+ <img
151
+ style="max-width: 100%; height: auto; display: block; margin: 15px auto;"
152
+ src="img/commit_checked.png"
153
+ />
137
154
  </article>
138
155
  </section>
139
156
 
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.1.3.0
4
+ version: 0.2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vitek Meloun
@@ -44,6 +44,7 @@ files:
44
44
  - lib/gotsha.rb
45
45
  - lib/gotsha/action_dispatcher.rb
46
46
  - lib/gotsha/actions/commit.rb
47
+ - lib/gotsha/actions/configure.rb
47
48
  - lib/gotsha/actions/help.rb
48
49
  - lib/gotsha/actions/init.rb
49
50
  - lib/gotsha/actions/show.rb
@@ -61,6 +62,10 @@ files:
61
62
  - lib/gotsha/version.rb
62
63
  - sig/gotsha.rbs
63
64
  - web/favicon.ico
65
+ - web/img/commit.png
66
+ - web/img/commit_checked.png
67
+ - web/img/gh_action.png
68
+ - web/img/push.png
64
69
  - web/index.html
65
70
  - web/logo.png
66
71
  homepage: https://www.gotsha.org/