geordi 12.0.1 → 12.1.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: fc23c0e80257e2e7aaf7fc1a5072b2f43ff1f4c256c02da05e1c2147344d4221
4
- data.tar.gz: 589328ecc0caa7b2215de91a390b1b4fa9180ca53dba33a39427cf557602886a
3
+ metadata.gz: 04313c8ce7c7ad6e748f4b75a35deb5e888c66bbbc1070e1213677b610c971f1
4
+ data.tar.gz: 210726dbce934e3d0db120b4f7a5aa2eba7bbb4d4056868e8e083eadcbec02c2
5
5
  SHA512:
6
- metadata.gz: 4666832d3b69baf2d7fb61ead61cda680ad42bb037585cbc960186a883a32a026fe779c5525d4a7d06dc872de092eb6afaa8da9796d3a42bbb4885b15eaf7b66
7
- data.tar.gz: d13e207305efbde114b771a0866013d6eb248ba3e42b1924accc556a55cf0999046881c4637666f85e127f602f24321b2b3fe91a4a41ea45e5e2b496c7c48620
6
+ metadata.gz: a52a0c665afd173e9371cad4fa64a65dc3fea587f9c415f376aa3706799b222e55917a8e47ad0e4a8d71b78e35c0ed2b5115cc0f0ef95a9c720e1de25b51d809
7
+ data.tar.gz: 00c8b800c1ea5b89e63e178c26448a93db8de1cb566ddf324facfb99ede4df107e19100eeee0bf42fac1c4db5d8e7c6d43a919bd4e6015d5481ecfdb22587c5d
@@ -8,7 +8,7 @@ on:
8
8
  - master
9
9
  jobs:
10
10
  test:
11
- runs-on: ubuntu-20.04
11
+ runs-on: ubuntu-24.04
12
12
  strategy:
13
13
  fail-fast: false
14
14
  matrix:
data/CHANGELOG.md CHANGED
@@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
6
6
  ## Unreleased
7
7
 
8
8
  ### Compatible changes
9
+ * `geordi commit` will now auto-suggest a matching issue based on the current branch
9
10
 
10
11
  ### Breaking changes
11
12
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- geordi (12.0.1)
4
+ geordi (12.1.1)
5
5
  thor (~> 1)
6
6
 
7
7
  GEM
@@ -50,16 +50,14 @@ GEM
50
50
  cucumber-tag-expressions (6.1.2)
51
51
  diff-lcs (1.6.0)
52
52
  ffi (1.12.2)
53
- highline (3.1.2)
54
- reline
55
- io-console (0.8.0)
53
+ highline (2.1.0)
56
54
  launchy (2.5.0)
57
55
  addressable (~> 2.7)
58
56
  method_source (1.1.0)
59
57
  mini_mime (1.1.5)
60
58
  multi_test (1.1.0)
61
59
  parallel (1.19.2)
62
- parallel_tests (4.9.1)
60
+ parallel_tests (4.7.1)
63
61
  parallel
64
62
  pry (0.14.2)
65
63
  coderay (~> 1.1)
@@ -69,8 +67,6 @@ GEM
69
67
  pry (>= 0.13, < 0.15)
70
68
  public_suffix (3.1.1)
71
69
  rake (12.3.3)
72
- reline (0.6.0)
73
- io-console (~> 0.5)
74
70
  rspec (3.10.0)
75
71
  rspec-core (~> 3.10.0)
76
72
  rspec-expectations (~> 3.10.0)
@@ -103,4 +99,4 @@ DEPENDENCIES
103
99
  rspec
104
100
 
105
101
  BUNDLED WITH
106
- 2.3.27
102
+ 2.4.22
data/cucumber.yml ADDED
@@ -0,0 +1 @@
1
+ default: --publish-quiet # Do not advertise to publish Cucumber results
@@ -29,6 +29,7 @@ module Geordi
29
29
  end
30
30
  @mysql_command = decide_mysql_command(extra_flags['mysql'])
31
31
  @postgres_command = decide_postgres_command(extra_flags['postgres'])
32
+ @texteditor = Geordi::Util.get_texteditor
32
33
  end
33
34
 
34
35
  def edit_allowlist(dbtype)
@@ -89,8 +90,7 @@ module Geordi
89
90
  tmp.write("#{line[0]} #{line[1]}\n")
90
91
  end
91
92
  tmp.close
92
- texteditor = Geordi::Util.decide_texteditor
93
- system("#{texteditor} #{tmp.path}")
93
+ system("#{@texteditor} #{tmp.path}")
94
94
  File.open(tmp.path, 'r') do |wl_edited|
95
95
  allowlisted_dbs = []
96
96
  allowlist_storage = File.open(allowlist, 'w')
@@ -20,7 +20,7 @@ module Geordi
20
20
  No staged changes. Will create an empty commit.
21
21
  WARNING
22
22
 
23
- issue = choose_issue
23
+ issue = issue_from_branch || choose_issue
24
24
  create_commit "[#{issue['identifier']}] #{issue['title']}", "Issue: #{issue['url']}", *git_args
25
25
  end
26
26
 
@@ -93,6 +93,23 @@ module Geordi
93
93
  nil
94
94
  end
95
95
 
96
+ def issue_from_branch
97
+ issue = if Util.testing?
98
+ dummy_issue_for_testing if ENV['GEORDI_TESTING_ISSUE_MATCHES'] == 'true'
99
+ else
100
+ current_branch = Util.current_branch
101
+ issue = fetch_linear_issues.find { |issue| issue['branchName'] == current_branch }
102
+ end
103
+
104
+ return unless issue
105
+
106
+ id = issue['identifier']
107
+ title = issue['title']
108
+
109
+ Interaction.note "Auto-detected issue #{HighLine::BOLD}[#{id}] #{title}#{HighLine::RESET} from branch name."
110
+ Interaction.prompt("Use it?", "y", /y|yes/i) ? issue : nil
111
+ end
112
+
96
113
  def dummy_issue_for_testing
97
114
  settings.linear_api_key
98
115
  ENV['GEORDI_TESTING_NO_LINEAR_ISSUES'] == 'true' ? Geordi::Interaction.fail('No issues to offer.') : {
@@ -112,41 +129,43 @@ module Geordi
112
129
  end
113
130
 
114
131
  def fetch_linear_issues
115
- team_ids = settings.linear_team_ids
116
- filter = {
117
- "team": {
118
- "id": {
119
- "in": team_ids,
120
- }
121
- },
122
- "state": {
123
- "type": {
124
- "eq": "started"
132
+ @linear_issues ||= begin
133
+ team_ids = settings.linear_team_ids
134
+ filter = {
135
+ "team": {
136
+ "id": {
137
+ "in": team_ids,
138
+ }
139
+ },
140
+ "state": {
141
+ "type": {
142
+ "eq": "started"
143
+ }
125
144
  }
126
145
  }
127
- }
128
- response = query_api(<<~GRAPHQL, filter: filter)
129
- query Issues($filter: IssueFilter) {
130
- issues(filter: $filter) {
131
- nodes {
132
- title
133
- identifier
134
- url
135
- branchName
136
- assignee {
137
- displayName
138
- isMe
146
+ response = query_api(<<~GRAPHQL, filter: filter)
147
+ query Issues($filter: IssueFilter) {
148
+ issues(filter: $filter) {
149
+ nodes {
150
+ title
151
+ identifier
152
+ url
153
+ branchName
154
+ assignee {
155
+ displayName
156
+ isMe
157
+ }
158
+ state {
159
+ name
160
+ position
161
+ }
139
162
  }
140
- state {
141
- name
142
- position
143
- }
144
163
  }
145
164
  }
146
- }
147
- GRAPHQL
165
+ GRAPHQL
148
166
 
149
- response.dig(*%w[issues nodes])
167
+ response.dig(*%w[issues nodes])
168
+ end
150
169
  end
151
170
 
152
171
  def query_api(attributes, variables)
@@ -122,7 +122,7 @@ module Geordi
122
122
  end
123
123
 
124
124
  def inquire_linear_api_key
125
- Geordi::Interaction.note 'Create an API key here: https://linear.app/makandra/settings/api'
125
+ Geordi::Interaction.note 'Create a personal API key here: https://linear.app/makandra/settings/account/security'
126
126
  token = Geordi::Interaction.prompt("Please enter the API key:")
127
127
  self.linear_api_key = token
128
128
  Interaction.note("API key stored in #{GLOBAL_SETTINGS_FILE_NAME}.")
data/lib/geordi/util.rb CHANGED
@@ -137,13 +137,12 @@ module Geordi
137
137
  end
138
138
  end
139
139
 
140
- # try to guess user's favorite cli text editor
141
- def decide_texteditor
142
- %w[/usr/bin/editor vi].each do |texteditor|
143
- if cmd_exists?(texteditor) && texteditor.start_with?('$')
144
- return ENV[texteditor[1..-1]]
145
- elsif cmd_exists? texteditor
146
- return texteditor
140
+ def get_texteditor
141
+ %w[/usr/bin/editor vi].find { |c| cmd_exists?(c) }.tap do |editor|
142
+ if editor == '/usr/bin/editor'
143
+ Interaction.note 'Choose text editor with: sudo update-alternatives --config editor'
144
+ elsif editor == nil
145
+ Interaction.fail 'Could not find a text editor.'
147
146
  end
148
147
  end
149
148
  end
@@ -1,3 +1,3 @@
1
1
  module Geordi
2
- VERSION = '12.0.1'.freeze
2
+ VERSION = '12.1.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geordi
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.0.1
4
+ version: 12.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-02-25 00:00:00.000000000 Z
11
+ date: 2025-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -45,6 +45,7 @@ files:
45
45
  - LICENSE
46
46
  - README.md
47
47
  - Rakefile
48
+ - cucumber.yml
48
49
  - exe/b
49
50
  - exe/dumple
50
51
  - exe/geordi