geet 0.15.0 → 0.16.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: f79d89578fca34fafcc206ab8e821849d67f0caaf2462670617d6bdba5e6dbeb
4
- data.tar.gz: 9b61f3d999540e14a04888a3a612a3cd4e911adbe52962812b0ca3741316858c
3
+ metadata.gz: 7298e97b21330d9c837a4eb8435be39df5351b38e60461561176c491b8fcaa08
4
+ data.tar.gz: 318baabbf8b5d52d0cc6affc9fa39a482a3ecc7a42714bff12ad81beb9959684
5
5
  SHA512:
6
- metadata.gz: '067489ba58c5c32fa4958ec6f43603b2f5746a7526a2918a0869641d654443e42223ec28876a1d13a3b900513563517200fd2933d5b0f01fdb2d8758cd526fb4'
7
- data.tar.gz: 78d9fcc96abc7670b6802a4b3eeccbfd90258e0206da0914d9a845fd2b739f43d1e968791d89cce4a8ea3a2409035cd8d8909747bb9007fa2ff51e9e474cad5d
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 = '2022-12-18'
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
- ['-B', '--no-browse', "Don't open the gist link in the browser after creation"],
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
- ['-n', '--no-open-issue', "Don't open the issue link in the browser after creation"],
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
- ['-n', '--no-open-pr', "Don't open the PR link in the browser after creation"],
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
- ['-n', '--no-open-pr', "Don't open the PR link in the browser after creation"],
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
- parent_url = compose_parent_url(parent_path)
21
+ if parent_path
22
+ parent_url = compose_parent_url(parent_path)
22
23
 
23
- @git_client.add_remote(Utils::GitClient::UPSTREAM_NAME, parent_url)
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, no_open_pr: nil, **)
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) unless no_open_pr
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
- # :no_browse defaults to false
25
+ # :open_browser defaults to true
26
26
  #
27
- def execute(full_filename, stdin: false, description: nil, publik: false, no_browse: 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 no_browse
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
- # :no_open_issue
17
+ # :open_browser
18
18
  #
19
19
  def execute(
20
20
  title, description,
21
- labels: nil, milestone: nil, assignees: nil, no_open_issue: 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 no_open_issue
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
- # :no_open_pr
27
+ # :open_browser
28
28
  #
29
29
  def execute(
30
30
  title, description, labels: nil, milestone: nil, reviewers: nil,
31
- base: nil, draft: false, no_open_pr: nil, **
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 no_open_pr
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Geet
4
- VERSION = '0.15.0'
4
+ VERSION = '0.16.0'
5
5
  end
@@ -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, no_browse: 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', no_browse: true
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 = { no_open_issue: true, out: actual_output }
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
- # no_open_pr: true, output: actual_output
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', no_open_pr: true, output: actual_output)
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
- # no_open_pr: true, output: actual_output
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, no_open_pr: 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, no_open_pr: 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, no_open_pr: 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.15.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: 2022-12-18 00:00:00.000000000 Z
11
+ date: 2023-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simple_scripting