geet 0.3.14 → 0.3.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/README.md +1 -0
- data/bin/geet +5 -1
- data/geet.gemspec +1 -1
- data/lib/geet/commandline/commands.rb +1 -0
- data/lib/geet/commandline/configuration.rb +7 -0
- data/lib/geet/git/repository.rb +4 -0
- data/lib/geet/github/milestone.rb +14 -0
- data/lib/geet/services/comment_pr.rb +2 -2
- data/lib/geet/services/create_milestone.rb +24 -0
- data/lib/geet/version.rb +1 -1
- data/spec/integration/create_milestone_spec.rb +34 -0
- data/spec/vcr_cassettes/github_com/create_milestone.yml +82 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24fb5de6b678ccceae3bf6366beded7c208a6d44f75db7303063176436365a5d
|
4
|
+
data.tar.gz: 4de89e5bfd5414e12cdbf74badf7ed36254f657dc9b8c3fe54c85d8af617b025
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7631017c938ebf68f5c94e142fe00ab7a905cfa3c01383ed61296c0e1db29e76d743d7818c524732755cd7231d654316428bd2b23d2ae450dc83fac3856058e
|
7
|
+
data.tar.gz: b6e366dd0e923d4b8a4e91781ba5820365a885b866b377907ad965d54f71ac2a9dd061900e8b011c1f54e5c7619bf87d58af7474039deb476d1f3322c745242b
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
data/bin/geet
CHANGED
@@ -46,12 +46,16 @@ class GeetLauncher
|
|
46
46
|
Services::ListIssues.new(repository).execute(options)
|
47
47
|
when LABEL_LIST_COMMAND
|
48
48
|
Services::ListLabels.new(repository).execute
|
49
|
+
when MILESTONE_CREATE_COMMAND
|
50
|
+
title = options.delete(:title)
|
51
|
+
|
52
|
+
Services::CreateMilestone.new(repository).execute(title)
|
49
53
|
when MILESTONE_LIST_COMMAND
|
50
54
|
Services::ListMilestones.new(repository).execute
|
51
55
|
when PR_COMMENT_COMMAND
|
52
56
|
comment = options.delete(:comment)
|
53
57
|
|
54
|
-
Services::CommentPr.new(repository).execute(comment)
|
58
|
+
Services::CommentPr.new(repository).execute(comment, options)
|
55
59
|
when PR_CREATE_COMMAND
|
56
60
|
summary = options[:summary] || edit_pr_summary(base: options[:base])
|
57
61
|
title, description = split_summary(summary)
|
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.3.0'
|
12
12
|
s.authors = ['Saverio Miroddi']
|
13
|
-
s.date = '2019-
|
13
|
+
s.date = '2019-09-03'
|
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'
|
@@ -8,6 +8,7 @@ module Geet
|
|
8
8
|
LABEL_CREATE_COMMAND = 'label.create'
|
9
9
|
ISSUE_LIST_COMMAND = 'issue.list'
|
10
10
|
LABEL_LIST_COMMAND = 'label.list'
|
11
|
+
MILESTONE_CREATE_COMMAND = 'milestone.create'
|
11
12
|
MILESTONE_LIST_COMMAND = 'milestone.list'
|
12
13
|
PR_COMMENT_COMMAND = 'pr.comment'
|
13
14
|
PR_CREATE_COMMAND = 'pr.create'
|
@@ -45,11 +45,17 @@ module Geet
|
|
45
45
|
['-u', '--upstream', 'List on the upstream repository'],
|
46
46
|
].freeze
|
47
47
|
|
48
|
+
MILESTONE_CREATE_OPTIONS = [
|
49
|
+
'title',
|
50
|
+
long_help: 'Create a milestone.'
|
51
|
+
]
|
52
|
+
|
48
53
|
MILESTONE_LIST_OPTIONS = [
|
49
54
|
['-u', '--upstream', 'List on the upstream repository'],
|
50
55
|
].freeze
|
51
56
|
|
52
57
|
PR_COMMENT_OPTIONS = [
|
58
|
+
['-n', '--no-open-pr', "Don't open the PR link in the browser after creation"],
|
53
59
|
'comment',
|
54
60
|
long_help: 'Add a comment to the PR for the current branch.'
|
55
61
|
]
|
@@ -103,6 +109,7 @@ module Geet
|
|
103
109
|
'list' => LABEL_LIST_OPTIONS,
|
104
110
|
},
|
105
111
|
'milestone' => {
|
112
|
+
'create' => MILESTONE_CREATE_OPTIONS,
|
106
113
|
'list' => MILESTONE_LIST_OPTIONS,
|
107
114
|
},
|
108
115
|
'pr' => {
|
data/lib/geet/git/repository.rb
CHANGED
@@ -58,6 +58,10 @@ module Geet
|
|
58
58
|
attempt_provider_call(:Issue, :list, api_interface, assignee: assignee, milestone: milestone)
|
59
59
|
end
|
60
60
|
|
61
|
+
def create_milestone(title)
|
62
|
+
attempt_provider_call(:Milestone, :create, title, api_interface)
|
63
|
+
end
|
64
|
+
|
61
65
|
def milestone(number)
|
62
66
|
attempt_provider_call(:Milestone, :find, number, api_interface)
|
63
67
|
end
|
@@ -21,6 +21,20 @@ module Geet
|
|
21
21
|
@api_interface = api_interface
|
22
22
|
end
|
23
23
|
|
24
|
+
# See https://developer.github.com/v3/issues/milestones/#create-a-milestone
|
25
|
+
def self.create(title, api_interface)
|
26
|
+
api_path = 'milestones'
|
27
|
+
request_data = { title: title }
|
28
|
+
|
29
|
+
response = api_interface.send_request(api_path, data: request_data)
|
30
|
+
|
31
|
+
number = response.fetch('number')
|
32
|
+
title = response.fetch('title')
|
33
|
+
due_on = nil
|
34
|
+
|
35
|
+
new(number, title, due_on, api_interface)
|
36
|
+
end
|
37
|
+
|
24
38
|
# See https://developer.github.com/v3/issues/milestones/#get-a-single-milestone
|
25
39
|
#
|
26
40
|
def self.find(number, api_interface)
|
@@ -19,11 +19,11 @@ module Geet
|
|
19
19
|
@git_client = git_client
|
20
20
|
end
|
21
21
|
|
22
|
-
def execute(comment)
|
22
|
+
def execute(comment, no_open_pr: nil)
|
23
23
|
merge_owner, merge_head = find_merge_head
|
24
24
|
pr = checked_find_branch_pr(merge_owner, merge_head)
|
25
25
|
pr.comment(comment)
|
26
|
-
open_file_with_default_application(pr.link)
|
26
|
+
open_file_with_default_application(pr.link) unless no_open_pr
|
27
27
|
pr
|
28
28
|
end
|
29
29
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Geet
|
4
|
+
module Services
|
5
|
+
class CreateMilestone
|
6
|
+
def initialize(repository, out: $stdout)
|
7
|
+
@repository = repository
|
8
|
+
@out = out
|
9
|
+
end
|
10
|
+
|
11
|
+
def execute(title)
|
12
|
+
create_milestone(title)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def create_milestone(title)
|
18
|
+
@out.puts 'Creating milestone...'
|
19
|
+
|
20
|
+
@repository.create_milestone(title)
|
21
|
+
end
|
22
|
+
end # class CreateMilestone
|
23
|
+
end # module Services
|
24
|
+
end # module Geet
|
data/lib/geet/version.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
require_relative '../../lib/geet/git/repository'
|
6
|
+
require_relative '../../lib/geet/services/create_milestone'
|
7
|
+
|
8
|
+
describe Geet::Services::CreateMilestone do
|
9
|
+
let(:git_client) { Geet::Utils::GitClient.new }
|
10
|
+
let(:repository) { Geet::Git::Repository.new(git_client: git_client) }
|
11
|
+
let(:upstream_repository) { Geet::Git::Repository.new(upstream: true, git_client: git_client) }
|
12
|
+
|
13
|
+
context 'with github.com' do
|
14
|
+
it 'should create a milestone' do
|
15
|
+
allow(git_client).to receive(:remote).with('origin').and_return('git@github.com:donaldduck/testrepo_upstream')
|
16
|
+
|
17
|
+
expected_output = <<~STR
|
18
|
+
Creating milestone...
|
19
|
+
STR
|
20
|
+
|
21
|
+
actual_output = StringIO.new
|
22
|
+
|
23
|
+
actual_created_label = VCR.use_cassette('github_com/create_milestone') do
|
24
|
+
described_class.new(repository, out: actual_output).execute('my_milestone')
|
25
|
+
end
|
26
|
+
|
27
|
+
expect(actual_output.string).to eql(expected_output)
|
28
|
+
|
29
|
+
expect(actual_created_label.number).to eql(6)
|
30
|
+
expect(actual_created_label.title).to eql('my_milestone')
|
31
|
+
expect(actual_created_label.due_on).to be(nil)
|
32
|
+
end
|
33
|
+
end # context 'with github.com'
|
34
|
+
end # describe Geet::Services::CreateLabel
|
@@ -0,0 +1,82 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.github.com/repos/donaldduck/testrepo_upstream/milestones
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"title":"my_milestone"}'
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- application/vnd.github.v3+json
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
Host:
|
17
|
+
- api.github.com
|
18
|
+
Authorization:
|
19
|
+
- Basic <GITHUB_CREDENTIALS>
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 201
|
23
|
+
message: Created
|
24
|
+
headers:
|
25
|
+
Date:
|
26
|
+
- Tue, 03 Sep 2019 16:01:12 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json; charset=utf-8
|
29
|
+
Content-Length:
|
30
|
+
- '1506'
|
31
|
+
Server:
|
32
|
+
- GitHub.com
|
33
|
+
Status:
|
34
|
+
- 201 Created
|
35
|
+
X-Ratelimit-Limit:
|
36
|
+
- '5000'
|
37
|
+
X-Ratelimit-Remaining:
|
38
|
+
- '4927'
|
39
|
+
X-Ratelimit-Reset:
|
40
|
+
- '1567530072'
|
41
|
+
Cache-Control:
|
42
|
+
- private, max-age=60, s-maxage=60
|
43
|
+
Vary:
|
44
|
+
- Accept, Authorization, Cookie, X-GitHub-OTP
|
45
|
+
- Accept-Encoding
|
46
|
+
Etag:
|
47
|
+
- '"21f10fbd46b93fec45025c213c4f1623"'
|
48
|
+
X-Oauth-Scopes:
|
49
|
+
- admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook,
|
50
|
+
delete_repo, gist, notifications, repo, user
|
51
|
+
X-Accepted-Oauth-Scopes:
|
52
|
+
- ''
|
53
|
+
Location:
|
54
|
+
- https://api.github.com/repos/donaldduck/testrepo_upstream/milestones/6
|
55
|
+
X-Github-Media-Type:
|
56
|
+
- github.v3; format=json
|
57
|
+
Access-Control-Expose-Headers:
|
58
|
+
- ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining,
|
59
|
+
X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval,
|
60
|
+
X-GitHub-Media-Type
|
61
|
+
Access-Control-Allow-Origin:
|
62
|
+
- "*"
|
63
|
+
Strict-Transport-Security:
|
64
|
+
- max-age=31536000; includeSubdomains; preload
|
65
|
+
X-Frame-Options:
|
66
|
+
- deny
|
67
|
+
X-Content-Type-Options:
|
68
|
+
- nosniff
|
69
|
+
X-Xss-Protection:
|
70
|
+
- 1; mode=block
|
71
|
+
Referrer-Policy:
|
72
|
+
- origin-when-cross-origin, strict-origin-when-cross-origin
|
73
|
+
Content-Security-Policy:
|
74
|
+
- default-src 'none'
|
75
|
+
X-Github-Request-Id:
|
76
|
+
- A894:36DFC:1D8B744:23F04F8:5D6E8E48
|
77
|
+
body:
|
78
|
+
encoding: UTF-8
|
79
|
+
string: '{"url":"https://api.github.com/repos/donaldduck/testrepo_upstream/milestones/6","html_url":"https://github.com/donaldduck/testrepo_upstream/milestone/6","labels_url":"https://api.github.com/repos/donaldduck/testrepo_upstream/milestones/6/labels","id":123456,"node_id":"MDk6TWlsZXN0b25lNDYyNTM3NQ==","number":6,"title":"my_milestone","description":null,"creator":{"login":"donaldduck","id":123456,"node_id":"MDQ6VXNlcjE1OTUzNTY=","avatar_url":"https://avatars2.githubusercontent.com/u/123456?v=4","gravatar_id":"","url":"https://api.github.com/users/donaldduck","html_url":"https://github.com/donaldduck","followers_url":"https://api.github.com/users/donaldduck/followers","following_url":"https://api.github.com/users/donaldduck/following{/other_user}","gists_url":"https://api.github.com/users/donaldduck/gists{/gist_id}","starred_url":"https://api.github.com/users/donaldduck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/donaldduck/subscriptions","organizations_url":"https://api.github.com/users/donaldduck/orgs","repos_url":"https://api.github.com/users/donaldduck/repos","events_url":"https://api.github.com/users/donaldduck/events{/privacy}","received_events_url":"https://api.github.com/users/donaldduck/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":0,"state":"open","created_at":"2019-09-03T16:01:12Z","updated_at":"2019-09-03T16:01:12Z","due_on":null,"closed_at":null}'
|
80
|
+
http_version:
|
81
|
+
recorded_at: Tue, 03 Sep 2019 16:01:12 GMT
|
82
|
+
recorded_with: VCR 3.0.3
|
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.3.
|
4
|
+
version: 0.3.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Saverio Miroddi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simple_scripting
|
@@ -105,6 +105,7 @@ files:
|
|
105
105
|
- lib/geet/services/create_gist.rb
|
106
106
|
- lib/geet/services/create_issue.rb
|
107
107
|
- lib/geet/services/create_label.rb
|
108
|
+
- lib/geet/services/create_milestone.rb
|
108
109
|
- lib/geet/services/create_pr.rb
|
109
110
|
- lib/geet/services/list_issues.rb
|
110
111
|
- lib/geet/services/list_labels.rb
|
@@ -124,6 +125,7 @@ files:
|
|
124
125
|
- spec/integration/create_gist_spec.rb
|
125
126
|
- spec/integration/create_issue_spec.rb
|
126
127
|
- spec/integration/create_label_spec.rb
|
128
|
+
- spec/integration/create_milestone_spec.rb
|
127
129
|
- spec/integration/create_pr_spec.rb
|
128
130
|
- spec/integration/list_issues_spec.rb
|
129
131
|
- spec/integration/list_labels_spec.rb
|
@@ -140,6 +142,7 @@ files:
|
|
140
142
|
- spec/vcr_cassettes/github_com/create_label.yml
|
141
143
|
- spec/vcr_cassettes/github_com/create_label_upstream.yml
|
142
144
|
- spec/vcr_cassettes/github_com/create_label_with_random_color.yml
|
145
|
+
- spec/vcr_cassettes/github_com/create_milestone.yml
|
143
146
|
- spec/vcr_cassettes/github_com/create_pr.yml
|
144
147
|
- spec/vcr_cassettes/github_com/create_pr_in_auto_mode_create_upstream.yml
|
145
148
|
- spec/vcr_cassettes/github_com/create_pr_in_auto_mode_with_push.yml
|
@@ -182,8 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
185
|
- !ruby/object:Gem::Version
|
183
186
|
version: '0'
|
184
187
|
requirements: []
|
185
|
-
|
186
|
-
rubygems_version: 2.7.8
|
188
|
+
rubygems_version: 3.0.6
|
187
189
|
signing_key:
|
188
190
|
specification_version: 4
|
189
191
|
summary: Commandline interface for performing SCM host operations, eg. create a PR
|