geet 0.17.0 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18fd41718ab7e1322b2538472d9fff0f30cf5d6b78a4ab08018aff39916d4784
4
- data.tar.gz: 6f93925acac8e405e6d2a76d52c376aa235f8f6c80885f94d3a6999fefd0d807
3
+ metadata.gz: ef02e27b72e4d7714872d9f980a6d7cf3468e05bf65e6deeeca68675e79f6497
4
+ data.tar.gz: 602ecc31c63be3570e785e55754f4fee90ddd772906f3cffd93347c1661770ce
5
5
  SHA512:
6
- metadata.gz: cf2abde4501d11687ec1021be64b275a13523d13f06470122a1e39101c006a527178e3ffc74df715f5d465e7a99c55925878a82e505441081336147bffb2c28e
7
- data.tar.gz: 77299aebb4ad0964e42523c71613380f5a484d943d225a9c54740922f4a7fcc32231dad61bb64d88dc39b1d12175702817383cc40f5414005354773a020c685d
6
+ metadata.gz: 4222e851d0e92bf2ef4cb947c825e64358129b7640e5f4f15c2d1d2d89f89844211ab39848f6e8e957011dfd8733ece135678ef0829ba75f6f835cb29e2d7baf
7
+ data.tar.gz: 66c779a300c6b89e2eba2363621e6cea82268b37433226c232f2ea8c0e8eaa20dc1e5598f3bdf95081559e2ac33baa8fdf814e461d8416e4f1d0d29e9ca2f760
data/.rubocop.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
  AllCops:
3
- TargetRubyVersion: 2.6
3
+ TargetRubyVersion: 2.7
4
4
 
5
5
  Layout/ExtraSpacing:
6
6
  Enabled: false
data/Gemfile CHANGED
@@ -16,6 +16,6 @@ end
16
16
 
17
17
  group :test do
18
18
  gem 'rspec', '~> 3.7.0'
19
- gem 'vcr', '~> 3.0.3'
19
+ gem 'vcr', '~> 6.1.0'
20
20
  gem 'webmock', '~> 3.1.1'
21
21
  end
data/bin/geet CHANGED
@@ -65,7 +65,7 @@ class GeetLauncher
65
65
 
66
66
  Services::CommentPr.new(repository).execute(comment, **options)
67
67
  when PR_CREATE_COMMAND
68
- summary = options[:summary] || edit_pr_summary(base: options[:base])
68
+ summary = options[:summary] || edit_pr_summary(**options.slice(:base))
69
69
  title, description = split_summary(summary)
70
70
 
71
71
  options = default_to_manual_selection(options, :labels, :milestone, :reviewers)
@@ -90,16 +90,16 @@ class GeetLauncher
90
90
 
91
91
  private
92
92
 
93
- def edit_pr_summary(base: nil)
93
+ def edit_pr_summary(base: :main_branch)
94
94
  # Tricky. It would be best to have Git logic exlusively inside the services,
95
95
  # but at the same time, the summary editing should be out.
96
96
  git = Utils::GitClient.new
97
- pr_commits = git.cherry(base: base)
97
+ pr_commits = git.cherry(base)
98
98
 
99
99
  cancel_pr_help = "In order to cancel the PR creation, delete the description above.\n"
100
100
 
101
101
  summary =
102
- if File.exists?(SUMMARY_BACKUP)
102
+ if File.exist?(SUMMARY_BACKUP)
103
103
  prepopulated_summary = IO.read(SUMMARY_BACKUP)
104
104
 
105
105
  Commandline::Editor.new.edit_content(content: prepopulated_summary, help: SUMMARY_TEMPLATE + cancel_pr_help)
data/geet.gemspec CHANGED
@@ -8,16 +8,16 @@ Gem::Specification.new do |s|
8
8
  s.name = 'geet'
9
9
  s.version = Geet::VERSION
10
10
  s.platform = Gem::Platform::RUBY
11
- s.required_ruby_version = '>= 2.6.0'
11
+ s.required_ruby_version = '>= 2.7.0'
12
12
  s.authors = ['Saverio Miroddi']
13
- s.date = '2023-02-10'
13
+ s.date = '2023-08-23'
14
14
  s.email = ['saverio.pub2@gmail.com']
15
15
  s.homepage = 'https://github.com/saveriomiroddi/geet'
16
16
  s.summary = 'Commandline interface for performing SCM host operations, eg. create a PR on GitHub'
17
17
  s.description = 'Commandline interface for performing SCM host operations, eg. create a PR on GitHub, with support for multiple hosts.'
18
18
  s.license = 'GPL-3.0'
19
19
 
20
- s.add_runtime_dependency 'simple_scripting', '~> 0.11.0'
20
+ s.add_runtime_dependency 'simple_scripting', '~> 0.14.0'
21
21
  s.add_runtime_dependency 'tty-prompt', '~> 0.23.1'
22
22
 
23
23
  s.add_development_dependency 'rake', '~> 12.3'
@@ -23,8 +23,12 @@ module Geet
23
23
  end
24
24
 
25
25
  def execute(delete_branch: false, **)
26
+ @git_client.fetch
27
+
26
28
  @git_client.push
27
29
 
30
+ check_no_missing_upstream_commits
31
+
28
32
  pr = checked_find_branch_pr
29
33
 
30
34
  merge_pr(pr)
@@ -55,6 +59,12 @@ module Geet
55
59
 
56
60
  private
57
61
 
62
+ def check_no_missing_upstream_commits
63
+ missing_upstream_commits = @git_client.cherry('HEAD', head: :main_branch)
64
+
65
+ raise "Found #{missing_upstream_commits.size} missing upstream commits!" if missing_upstream_commits.any?
66
+ end
67
+
58
68
  def merge_pr(pr)
59
69
  @out.puts "Merging PR ##{pr.number}..."
60
70
 
@@ -48,13 +48,19 @@ module Geet
48
48
  # BRANCH/TREE APIS
49
49
  ##########################################################################
50
50
 
51
- # Return the commit SHAs between HEAD and `base`, excluding the already applied commits
51
+ # Return the commit SHAs between :head and :upstream, excluding the already applied commits
52
52
  # (which start with `-`)
53
53
  #
54
- def cherry(base: nil)
55
- base ||= main_branch
54
+ # - upstream: String; pass :main_branch to use the main branch
55
+ # - head: String (optional); pass :main_branch to use the main branch
56
+ #
57
+ def cherry(upstream, head: nil)
58
+ upstream = main_branch if upstream == :main_branch
59
+ head = main_branch if head == :main_branch
60
+
61
+ git_params = [upstream, head].compact.map(&:shellescape)
56
62
 
57
- raw_commits = execute_git_command("cherry #{base.shellescape}")
63
+ raw_commits = execute_git_command("cherry #{git_params.join(' ')}")
58
64
 
59
65
  raw_commits.split("\n").grep(/^\+/).map { |line| line[3..-1] }
60
66
  end
data/lib/geet/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Geet
4
- VERSION = '0.17.0'
4
+ VERSION = '0.19.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saverio Miroddi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-10 00:00:00.000000000 Z
11
+ date: 2023-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simple_scripting
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.11.0
19
+ version: 0.14.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.11.0
26
+ version: 0.14.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: tty-prompt
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -183,14 +183,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
183
183
  requirements:
184
184
  - - ">="
185
185
  - !ruby/object:Gem::Version
186
- version: 2.6.0
186
+ version: 2.7.0
187
187
  required_rubygems_version: !ruby/object:Gem::Requirement
188
188
  requirements:
189
189
  - - ">="
190
190
  - !ruby/object:Gem::Version
191
191
  version: '0'
192
192
  requirements: []
193
- rubygems_version: 3.1.6
193
+ rubygems_version: 3.4.13
194
194
  signing_key:
195
195
  specification_version: 4
196
196
  summary: Commandline interface for performing SCM host operations, eg. create a PR