geet 0.15.0 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/geet.gemspec +2 -2
- 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 +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18fd41718ab7e1322b2538472d9fff0f30cf5d6b78a4ab08018aff39916d4784
|
4
|
+
data.tar.gz: 6f93925acac8e405e6d2a76d52c376aa235f8f6c80885f94d3a6999fefd0d807
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf2abde4501d11687ec1021be64b275a13523d13f06470122a1e39101c006a527178e3ffc74df715f5d465e7a99c55925878a82e505441081336147bffb2c28e
|
7
|
+
data.tar.gz: 77299aebb4ad0964e42523c71613380f5a484d943d225a9c54740922f4a7fcc32231dad61bb64d88dc39b1d12175702817383cc40f5414005354773a020c685d
|
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-02-10'
|
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'
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.license = 'GPL-3.0'
|
19
19
|
|
20
20
|
s.add_runtime_dependency 'simple_scripting', '~> 0.11.0'
|
21
|
-
s.add_runtime_dependency 'tty-prompt', '~> 0.
|
21
|
+
s.add_runtime_dependency 'tty-prompt', '~> 0.23.1'
|
22
22
|
|
23
23
|
s.add_development_dependency 'rake', '~> 12.3'
|
24
24
|
|
@@ -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.17.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-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simple_scripting
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.23.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.23.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|