geet 0.15.0 → 0.16.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 +4 -4
- data/geet.gemspec +1 -1
- data/lib/geet/commandline/configuration.rb +4 -4
- data/lib/geet/services/add_upstream_repo.rb +6 -2
- data/lib/geet/services/comment_pr.rb +2 -2
- data/lib/geet/services/create_gist.rb +5 -5
- data/lib/geet/services/create_issue.rb +5 -5
- data/lib/geet/services/create_pr.rb +5 -5
- data/lib/geet/version.rb +1 -1
- data/spec/integration/comment_pr_spec.rb +0 -4
- data/spec/integration/create_gist_spec.rb +2 -2
- data/spec/integration/create_issue_spec.rb +1 -2
- data/spec/integration/create_pr_spec.rb +6 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7298e97b21330d9c837a4eb8435be39df5351b38e60461561176c491b8fcaa08
|
4
|
+
data.tar.gz: 318baabbf8b5d52d0cc6affc9fa39a482a3ecc7a42714bff12ad81beb9959684
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fef735f691aa7c0c1e78d8598a429b6eb92555761587d2c137b915744516b2b7f3a5bdbde4e14a5094ca79ae1dcf717c310edde9894c7c040cbe833dafceb1be
|
7
|
+
data.tar.gz: 8fb0518d4c8a65449d14d19d4f9fa2b847cddd95b6f97dbb458c334783acc88f0e2e5ed3c0dad2485e2ac36a92b797ebe6eeeec8aafb2d90a05647bbff5aa6bf
|
data/geet.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.platform = Gem::Platform::RUBY
|
11
11
|
s.required_ruby_version = '>= 2.6.0'
|
12
12
|
s.authors = ['Saverio Miroddi']
|
13
|
-
s.date = '
|
13
|
+
s.date = '2023-01-30'
|
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'
|
@@ -13,7 +13,7 @@ module Geet
|
|
13
13
|
GIST_CREATE_OPTIONS = [
|
14
14
|
['-p', '--public'],
|
15
15
|
['-s', '--stdin', "Read content from stdin"],
|
16
|
-
['-
|
16
|
+
['-o', '--open-browser', "Open the gist link in the browser after creation"],
|
17
17
|
'filename',
|
18
18
|
'[description]'
|
19
19
|
].freeze
|
@@ -22,7 +22,7 @@ module Geet
|
|
22
22
|
#
|
23
23
|
# rubocop:disable Style/MutableConstant
|
24
24
|
ISSUE_CREATE_OPTIONS = [
|
25
|
-
['-
|
25
|
+
['-o', '--open-browser', "Don't open the issue link in the browser after creation"],
|
26
26
|
['-l', '--labels "bug,help wanted"', 'Labels'],
|
27
27
|
['-m', '--milestone 1.5.0', 'Milestone title pattern'],
|
28
28
|
['-a', '--assignees john,tom,adrian,kevin', 'Assignee logins'],
|
@@ -60,14 +60,14 @@ module Geet
|
|
60
60
|
].freeze
|
61
61
|
|
62
62
|
PR_COMMENT_OPTIONS = [
|
63
|
-
['-
|
63
|
+
['-o', '--open-browser', "Don't open the PR link in the browser after creation"],
|
64
64
|
['-u', '--upstream', 'Comment on the upstream repository'],
|
65
65
|
'comment',
|
66
66
|
long_help: 'Add a comment to the PR for the current branch.'
|
67
67
|
]
|
68
68
|
|
69
69
|
PR_CREATE_OPTIONS = [
|
70
|
-
['-
|
70
|
+
['-o', '--open-browser', "Don't open the PR link in the browser after creation"],
|
71
71
|
['-b', '--base develop', "Specify the base branch; defaults to the main branch"],
|
72
72
|
['-d', '--draft', "Create as draft"],
|
73
73
|
['-l', '--labels "legacy,code review"', 'Labels'],
|
@@ -18,9 +18,13 @@ module Geet
|
|
18
18
|
|
19
19
|
parent_path = @repository.remote.parent_path
|
20
20
|
|
21
|
-
|
21
|
+
if parent_path
|
22
|
+
parent_url = compose_parent_url(parent_path)
|
22
23
|
|
23
|
-
|
24
|
+
@git_client.add_remote(Utils::GitClient::UPSTREAM_NAME, parent_url)
|
25
|
+
else
|
26
|
+
raise "The repository has no upstream!"
|
27
|
+
end
|
24
28
|
end
|
25
29
|
|
26
30
|
private
|
@@ -19,10 +19,10 @@ module Geet
|
|
19
19
|
@git_client = git_client
|
20
20
|
end
|
21
21
|
|
22
|
-
def execute(comment,
|
22
|
+
def execute(comment, open_browser: false, **)
|
23
23
|
pr = checked_find_branch_pr
|
24
24
|
pr.comment(comment)
|
25
|
-
open_file_with_default_application(pr.link)
|
25
|
+
open_file_with_default_application(pr.link) if open_browser
|
26
26
|
pr
|
27
27
|
end
|
28
28
|
end
|
@@ -22,9 +22,9 @@ module Geet
|
|
22
22
|
# options:
|
23
23
|
# :description
|
24
24
|
# :publik: defaults to false
|
25
|
-
# :
|
25
|
+
# :open_browser defaults to true
|
26
26
|
#
|
27
|
-
def execute(full_filename, stdin: false, description: nil, publik: false,
|
27
|
+
def execute(full_filename, stdin: false, description: nil, publik: false, open_browser: false)
|
28
28
|
content = stdin ? $stdin.read : IO.read(full_filename)
|
29
29
|
|
30
30
|
gist_access = publik ? 'public' : 'private'
|
@@ -33,10 +33,10 @@ module Geet
|
|
33
33
|
filename = File.basename(full_filename)
|
34
34
|
gist = Geet::Github::Gist.create(filename, content, @api_interface, description: description, publik: publik)
|
35
35
|
|
36
|
-
if
|
37
|
-
@out.puts "Gist address: #{gist.link}"
|
38
|
-
else
|
36
|
+
if open_browser
|
39
37
|
open_file_with_default_application(gist.link)
|
38
|
+
else
|
39
|
+
@out.puts "Gist address: #{gist.link}"
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -14,11 +14,11 @@ module Geet
|
|
14
14
|
# :labels
|
15
15
|
# :milestone: number or description pattern.
|
16
16
|
# :assignees
|
17
|
-
# :
|
17
|
+
# :open_browser
|
18
18
|
#
|
19
19
|
def execute(
|
20
20
|
title, description,
|
21
|
-
labels: nil, milestone: nil, assignees: nil,
|
21
|
+
labels: nil, milestone: nil, assignees: nil, open_browser: false,
|
22
22
|
**
|
23
23
|
)
|
24
24
|
# Inefficient (in worst case, triples the pre issue creation waiting time: #is_collaborator?,
|
@@ -39,10 +39,10 @@ module Geet
|
|
39
39
|
edit_issue(issue, selected_labels, selected_milestone, selected_assignees)
|
40
40
|
end
|
41
41
|
|
42
|
-
if
|
43
|
-
@out.puts "Issue address: #{issue.link}"
|
44
|
-
else
|
42
|
+
if open_browser
|
45
43
|
open_file_with_default_application(issue.link)
|
44
|
+
else
|
45
|
+
@out.puts "Issue address: #{issue.link}"
|
46
46
|
end
|
47
47
|
|
48
48
|
issue
|
@@ -24,11 +24,11 @@ module Geet
|
|
24
24
|
# options:
|
25
25
|
# :labels
|
26
26
|
# :reviewers
|
27
|
-
# :
|
27
|
+
# :open_browser
|
28
28
|
#
|
29
29
|
def execute(
|
30
30
|
title, description, labels: nil, milestone: nil, reviewers: nil,
|
31
|
-
base: nil, draft: false,
|
31
|
+
base: nil, draft: false, open_browser: false, **
|
32
32
|
)
|
33
33
|
ensure_clean_tree
|
34
34
|
|
@@ -54,10 +54,10 @@ module Geet
|
|
54
54
|
edit_pr(pr, selected_labels, selected_milestone, selected_reviewers)
|
55
55
|
end
|
56
56
|
|
57
|
-
if
|
58
|
-
@out.puts "PR address: #{pr.link}"
|
59
|
-
else
|
57
|
+
if open_browser
|
60
58
|
open_file_with_default_application(pr.link)
|
59
|
+
else
|
60
|
+
@out.puts "PR address: #{pr.link}"
|
61
61
|
end
|
62
62
|
|
63
63
|
pr
|
data/lib/geet/version.rb
CHANGED
@@ -27,10 +27,6 @@ describe Geet::Services::CommentPr do
|
|
27
27
|
actual_output = StringIO.new
|
28
28
|
service_instance = described_class.new(repository, out: actual_output, git_client: git_client)
|
29
29
|
|
30
|
-
expect(service_instance).to receive(:open_file_with_default_application).with("https://github.com/#{owner}/#{repository_name}/pull/#{expected_pr_number}") do
|
31
|
-
# do nothing; just don't open the browser
|
32
|
-
end
|
33
|
-
|
34
30
|
service_result = VCR.use_cassette('github_com/comment_pr') do
|
35
31
|
service_instance.execute(comment)
|
36
32
|
end
|
@@ -20,7 +20,7 @@ describe Geet::Services::CreateGist do
|
|
20
20
|
|
21
21
|
VCR.use_cassette('create_gist_public') do
|
22
22
|
described_class.new(out: actual_output).execute(
|
23
|
-
temp_file.path, description: 'testdescription', publik: true
|
23
|
+
temp_file.path, description: 'testdescription', publik: true
|
24
24
|
)
|
25
25
|
end
|
26
26
|
|
@@ -37,7 +37,7 @@ describe Geet::Services::CreateGist do
|
|
37
37
|
|
38
38
|
VCR.use_cassette('create_gist_private') do
|
39
39
|
described_class.new(out: actual_output).execute(
|
40
|
-
temp_file.path, description: 'testdescription'
|
40
|
+
temp_file.path, description: 'testdescription'
|
41
41
|
)
|
42
42
|
end
|
43
43
|
|
@@ -31,7 +31,6 @@ describe Geet::Services::CreateIssue do
|
|
31
31
|
described_class.new(repository, out: actual_output).execute(
|
32
32
|
'Title', 'Description',
|
33
33
|
labels: 'bug,invalid', milestone: '0.0.1', assignees: 'donaldduck,donald-fr',
|
34
|
-
no_open_issue: true
|
35
34
|
)
|
36
35
|
end
|
37
36
|
|
@@ -58,7 +57,7 @@ describe Geet::Services::CreateIssue do
|
|
58
57
|
actual_output = StringIO.new
|
59
58
|
|
60
59
|
actual_created_issue = VCR.use_cassette('create_issue_upstream') do
|
61
|
-
create_options = {
|
60
|
+
create_options = { out: actual_output }
|
62
61
|
described_class.new(upstream_repository, out: actual_output).execute('Title', 'Description', **create_options)
|
63
62
|
end
|
64
63
|
|
@@ -37,7 +37,7 @@ describe Geet::Services::CreatePr do
|
|
37
37
|
# service_instance.execute(
|
38
38
|
# 'Title', 'Description',
|
39
39
|
# labels: 'bug,invalid', milestone: '0.0.1', reviewers: 'donald-fr',
|
40
|
-
#
|
40
|
+
# output: actual_output
|
41
41
|
# )
|
42
42
|
# end
|
43
43
|
#
|
@@ -67,7 +67,7 @@ describe Geet::Services::CreatePr do
|
|
67
67
|
#
|
68
68
|
# actual_created_pr = VCR.use_cassette('github_com/create_pr_upstream') do
|
69
69
|
# service_instance = described_class.new(upstream_repository, out: actual_output, git_client: git_client)
|
70
|
-
# service_instance.execute('Title', 'Description',
|
70
|
+
# service_instance.execute('Title', 'Description', output: actual_output)
|
71
71
|
# end
|
72
72
|
#
|
73
73
|
# expect(actual_output.string).to eql(expected_output)
|
@@ -101,7 +101,7 @@ describe Geet::Services::CreatePr do
|
|
101
101
|
# service_instance.execute(
|
102
102
|
# 'Title', 'Description',
|
103
103
|
# labels: '<ignored>',
|
104
|
-
#
|
104
|
+
# output: actual_output
|
105
105
|
# )
|
106
106
|
# end
|
107
107
|
#
|
@@ -124,7 +124,7 @@ describe Geet::Services::CreatePr do
|
|
124
124
|
|
125
125
|
operation = -> do
|
126
126
|
service_instance = described_class.new(repository, out: actual_output, git_client: git_client)
|
127
|
-
service_instance.execute('Title', 'Description', output: actual_output, automated_mode: true
|
127
|
+
service_instance.execute('Title', 'Description', output: actual_output, automated_mode: true)
|
128
128
|
end
|
129
129
|
|
130
130
|
expect(operation).to raise_error(RuntimeError, 'The working tree is not clean!')
|
@@ -152,7 +152,7 @@ describe Geet::Services::CreatePr do
|
|
152
152
|
#
|
153
153
|
# actual_created_pr = VCR.use_cassette('github_com/create_pr_in_auto_mode_with_push') do
|
154
154
|
# service_instance = described_class.new(repository, out: actual_output, git_client: git_client)
|
155
|
-
# service_instance.execute('Title', 'Description', output: actual_output, automated_mode: true
|
155
|
+
# service_instance.execute('Title', 'Description', output: actual_output, automated_mode: true)
|
156
156
|
# end
|
157
157
|
#
|
158
158
|
# expect(actual_output.string).to eql(expected_output)
|
@@ -179,7 +179,7 @@ describe Geet::Services::CreatePr do
|
|
179
179
|
#
|
180
180
|
# actual_created_pr = VCR.use_cassette('github_com/create_pr_in_auto_mode_create_upstream') do
|
181
181
|
# service_instance = described_class.new(repository, out: actual_output, git_client: git_client)
|
182
|
-
# service_instance.execute('Title', 'Description', output: actual_output, automated_mode: true
|
182
|
+
# service_instance.execute('Title', 'Description', output: actual_output, automated_mode: true)
|
183
183
|
# end
|
184
184
|
#
|
185
185
|
# expect(actual_output.string).to eql(expected_output)
|
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.
|
4
|
+
version: 0.16.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:
|
11
|
+
date: 2023-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simple_scripting
|