geet 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/geet.gemspec +1 -1
- data/lib/geet/git/repository.rb +2 -3
- data/lib/geet/github/api_interface.rb +0 -1
- data/lib/geet/github/label.rb +0 -2
- data/lib/geet/github/pr.rb +2 -2
- data/lib/geet/github/user.rb +32 -0
- data/lib/geet/gitlab/api_interface.rb +0 -1
- data/lib/geet/gitlab/label.rb +0 -2
- data/lib/geet/services/create_issue.rb +6 -4
- data/lib/geet/services/create_pr.rb +8 -5
- data/lib/geet/services/list_issues.rb +4 -2
- data/lib/geet/utils/attributes_selection_manager.rb +11 -1
- data/lib/geet/version.rb +1 -1
- data/spec/integration/create_gist_spec.rb +5 -4
- data/spec/integration/create_label_spec.rb +9 -5
- data/spec/integration/create_pr_spec.rb +1 -1
- data/spec/spec_helper.rb +5 -0
- data/spec/vcr_cassettes/create_gist_private.yml +1 -1
- data/spec/vcr_cassettes/create_gist_public.yml +1 -1
- data/spec/vcr_cassettes/create_issue_upstream.yml +0 -155
- data/spec/vcr_cassettes/create_label_with_random_color.yml +1 -1
- metadata +4 -5
- data/Gemfile.lock +0 -93
- data/lib/geet/github/account.rb +0 -19
- data/lib/geet/github/collaborator.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9069b26e04387727f7ae73ba34dbf83375f3c65
|
4
|
+
data.tar.gz: 8647d63bb9fa5e471e07dfd04c4da24ce60aa4e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 852bc60cf052d3bde605a7851a32054bc60e7aabaff31a793f5ba3d4f2ad1aadb44a3dc00a406b015a095d6bc4103ad04f6030b19439292d62fa3e5df08c8af5
|
7
|
+
data.tar.gz: 76fd3f5cd74b34fed1a527c65827f093d9c75ba2e2c6c7f8012bad4d851858ec48408f2887d03a6edcb1082ce067a5ce7c31b88f5058918f49bb2cda57fe1c1b
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Gemfile.lock
|
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 = '2018-
|
13
|
+
s.date = '2018-02-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 (eg. GitHub) operations (eg. PR creation).'
|
data/lib/geet/git/repository.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'shellwords'
|
4
3
|
require_relative '../utils/git_client'
|
5
4
|
|
6
5
|
module Geet
|
@@ -33,7 +32,7 @@ module Geet
|
|
33
32
|
# REMOTE FUNCTIONALITIES (REPOSITORY)
|
34
33
|
|
35
34
|
def collaborators
|
36
|
-
attempt_provider_call(:
|
35
|
+
attempt_provider_call(:User, :list_collaborators, api_interface)
|
37
36
|
end
|
38
37
|
|
39
38
|
def labels
|
@@ -85,7 +84,7 @@ module Geet
|
|
85
84
|
# REMOTE FUNCTIONALITIES (ACCOUNT)
|
86
85
|
|
87
86
|
def authenticated_user
|
88
|
-
attempt_provider_call(:
|
87
|
+
attempt_provider_call(:User, :authenticated, api_interface)
|
89
88
|
end
|
90
89
|
|
91
90
|
# OTHER/CONVENIENCE FUNCTIONALITIES
|
data/lib/geet/github/label.rb
CHANGED
data/lib/geet/github/pr.rb
CHANGED
@@ -12,8 +12,8 @@ module Geet
|
|
12
12
|
api_path = 'pulls'
|
13
13
|
|
14
14
|
if api_interface.upstream?
|
15
|
-
|
16
|
-
head = "#{
|
15
|
+
authenticated_user = Geet::Github::User.authenticated(api_interface).username
|
16
|
+
head = "#{authenticated_user}:#{head}"
|
17
17
|
end
|
18
18
|
|
19
19
|
request_data = { title: title, body: description, head: head, base: 'master' }
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Geet
|
4
|
+
module Github
|
5
|
+
class User
|
6
|
+
attr_reader :username
|
7
|
+
|
8
|
+
def initialize(username)
|
9
|
+
@username = username
|
10
|
+
end
|
11
|
+
|
12
|
+
# See https://developer.github.com/v3/users/#get-the-authenticated-user
|
13
|
+
#
|
14
|
+
def self.authenticated(api_interface)
|
15
|
+
api_path = '/user'
|
16
|
+
|
17
|
+
response = api_interface.send_request(api_path)
|
18
|
+
|
19
|
+
new(response.fetch('login'))
|
20
|
+
end
|
21
|
+
|
22
|
+
# Returns an array of User instances
|
23
|
+
#
|
24
|
+
def self.list_collaborators(api_interface)
|
25
|
+
api_path = 'collaborators'
|
26
|
+
response = api_interface.send_request(api_path, multipage: true)
|
27
|
+
|
28
|
+
response.map { |user_entry| new(user_entry.fetch('login')) }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/geet/gitlab/label.rb
CHANGED
@@ -43,7 +43,7 @@ module Geet
|
|
43
43
|
|
44
44
|
selection_manager.add_attribute(:labels, 'label', labels, :multiple, name_method: :name) if labels
|
45
45
|
selection_manager.add_attribute(:milestones, 'milestone', milestone, :single, name_method: :title) if milestone
|
46
|
-
selection_manager.add_attribute(:collaborators, 'assignee', assignees, :multiple) if assignees
|
46
|
+
selection_manager.add_attribute(:collaborators, 'assignee', assignees, :multiple, name_method: :username) if assignees
|
47
47
|
|
48
48
|
selection_manager.select_attributes
|
49
49
|
end
|
@@ -91,10 +91,12 @@ module Geet
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def assign_users(issue, users)
|
94
|
-
|
94
|
+
usernames = users.map(&:username)
|
95
|
+
|
96
|
+
@out.puts "Assigning users #{usernames.join(', ')}..."
|
95
97
|
|
96
98
|
Thread.new do
|
97
|
-
issue.assign_users(
|
99
|
+
issue.assign_users(usernames)
|
98
100
|
end
|
99
101
|
end
|
100
102
|
|
@@ -102,7 +104,7 @@ module Geet
|
|
102
104
|
@out.puts 'Assigning authenticated user...'
|
103
105
|
|
104
106
|
Thread.new do
|
105
|
-
issue.assign_users(@repository.authenticated_user)
|
107
|
+
issue.assign_users(@repository.authenticated_user.username)
|
106
108
|
end
|
107
109
|
end
|
108
110
|
end
|
@@ -59,8 +59,9 @@ module Geet
|
|
59
59
|
selection_manager.add_attribute(:milestones, 'milestone', milestone, :single, name_method: :title) if milestone
|
60
60
|
|
61
61
|
if reviewers
|
62
|
-
selection_manager.add_attribute(:collaborators, 'reviewer', reviewers, :multiple) do |all_reviewers|
|
63
|
-
|
62
|
+
selection_manager.add_attribute(:collaborators, 'reviewer', reviewers, :multiple, name_method: :username) do |all_reviewers|
|
63
|
+
authenticated_user = @repository.authenticated_user
|
64
|
+
all_reviewers.delete_if { |reviewer| reviewer.username == authenticated_user.username }
|
64
65
|
end
|
65
66
|
end
|
66
67
|
|
@@ -106,7 +107,7 @@ module Geet
|
|
106
107
|
@out.puts 'Assigning authenticated user...'
|
107
108
|
|
108
109
|
Thread.new do
|
109
|
-
pr.assign_users(@repository.authenticated_user)
|
110
|
+
pr.assign_users(@repository.authenticated_user.username)
|
110
111
|
end
|
111
112
|
end
|
112
113
|
|
@@ -129,10 +130,12 @@ module Geet
|
|
129
130
|
end
|
130
131
|
|
131
132
|
def request_review(pr, reviewers)
|
132
|
-
|
133
|
+
reviewer_usernames = reviewers.map(&:username)
|
134
|
+
|
135
|
+
@out.puts "Requesting review from #{reviewer_usernames.join(', ')}..."
|
133
136
|
|
134
137
|
Thread.new do
|
135
|
-
pr.request_review(
|
138
|
+
pr.request_review(reviewer_usernames)
|
136
139
|
end
|
137
140
|
end
|
138
141
|
end
|
@@ -25,9 +25,11 @@ module Geet
|
|
25
25
|
def find_and_select_attributes(assignee)
|
26
26
|
selection_manager = Geet::Utils::AttributesSelectionManager.new(@repository, out: @out)
|
27
27
|
|
28
|
-
selection_manager.add_attribute(:collaborators, 'assignee', assignee, :single)
|
28
|
+
selection_manager.add_attribute(:collaborators, 'assignee', assignee, :single, name_method: :username)
|
29
29
|
|
30
|
-
selection_manager.select_attributes
|
30
|
+
selected_assignee, _ = selection_manager.select_attributes
|
31
|
+
|
32
|
+
selected_assignee&.username
|
31
33
|
end
|
32
34
|
end
|
33
35
|
end
|
@@ -16,6 +16,12 @@ module Geet
|
|
16
16
|
class AttributesSelectionManager
|
17
17
|
include Geet::Shared::Constants
|
18
18
|
|
19
|
+
# Workaround for VCR not supporting multithreading; see https://github.com/vcr/vcr/issues/200.
|
20
|
+
#
|
21
|
+
class << self
|
22
|
+
attr_accessor :serialize_requests
|
23
|
+
end
|
24
|
+
|
19
25
|
# Initialize the instance, and starts the background threads.
|
20
26
|
#
|
21
27
|
def initialize(repository, out: output)
|
@@ -54,9 +60,13 @@ module Geet
|
|
54
60
|
def find_attribute_entries(repository_call)
|
55
61
|
@out.puts "Finding #{repository_call}..."
|
56
62
|
|
57
|
-
Thread.new do
|
63
|
+
finder_thread = Thread.new do
|
58
64
|
@repository.send(repository_call)
|
59
65
|
end
|
66
|
+
|
67
|
+
finder_thread.join if self.class.serialize_requests
|
68
|
+
|
69
|
+
finder_thread
|
60
70
|
end
|
61
71
|
|
62
72
|
# Sample call:
|
data/lib/geet/version.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
|
-
require '
|
4
|
+
require 'tmpdir'
|
5
5
|
|
6
6
|
require_relative '../../lib/geet/git/repository'
|
7
7
|
require_relative '../../lib/geet/services/create_gist'
|
8
8
|
|
9
9
|
describe Geet::Services::CreateGist do
|
10
|
-
let(:
|
10
|
+
let(:temp_filename) { File.join(Dir.tmpdir, 'geet_gist_test.md') }
|
11
|
+
let(:temp_file) { File.open(temp_filename, 'w') { |file| file << 'testcontent' } }
|
11
12
|
|
12
13
|
it 'should create a public gist' do
|
13
14
|
expected_output = <<~STR
|
@@ -19,7 +20,7 @@ describe Geet::Services::CreateGist do
|
|
19
20
|
|
20
21
|
VCR.use_cassette('create_gist_public') do
|
21
22
|
described_class.new(out: actual_output).execute(
|
22
|
-
|
23
|
+
temp_file.path, description: 'testdescription', publik: true, no_browse: true
|
23
24
|
)
|
24
25
|
end
|
25
26
|
|
@@ -36,7 +37,7 @@ describe Geet::Services::CreateGist do
|
|
36
37
|
|
37
38
|
VCR.use_cassette('create_gist_private') do
|
38
39
|
described_class.new(out: actual_output).execute(
|
39
|
-
|
40
|
+
temp_file.path, description: 'testdescription', no_browse: true
|
40
41
|
)
|
41
42
|
end
|
42
43
|
|
@@ -59,15 +59,19 @@ describe Geet::Services::CreateLabel do
|
|
59
59
|
it 'should create a label' do
|
60
60
|
allow(git_client).to receive(:remote).with('origin').and_return('git@github.com:donaldduck/testrepo')
|
61
61
|
|
62
|
+
actual_output = StringIO.new
|
63
|
+
|
64
|
+
service_instance = described_class.new(repository, out: actual_output)
|
65
|
+
|
66
|
+
expect(service_instance).to receive(:rand).with(2**24).and_return(38911)
|
67
|
+
|
62
68
|
expected_output_template = <<~STR
|
63
69
|
Creating label...
|
64
|
-
Created with color
|
70
|
+
Created with color #0097ff
|
65
71
|
STR
|
66
72
|
|
67
|
-
actual_output = StringIO.new
|
68
|
-
|
69
73
|
actual_created_label = VCR.use_cassette('create_label_with_random_color') do
|
70
|
-
|
74
|
+
service_instance.execute('my_label')
|
71
75
|
end
|
72
76
|
|
73
77
|
expected_output = format(expected_output_template, color: actual_created_label.color)
|
@@ -75,7 +79,7 @@ describe Geet::Services::CreateLabel do
|
|
75
79
|
expect(actual_output.string).to eql(expected_output)
|
76
80
|
|
77
81
|
expect(actual_created_label.name).to eql('my_label')
|
78
|
-
expect(actual_created_label.color).to
|
82
|
+
expect(actual_created_label.color).to eql('0097ff')
|
79
83
|
end
|
80
84
|
end
|
81
85
|
end
|
@@ -12,7 +12,7 @@ describe Geet::Services::CreatePr do
|
|
12
12
|
|
13
13
|
context 'with labels, reviewers and milestones' do
|
14
14
|
it 'should create a PR' do
|
15
|
-
allow(git_client).to receive(:current_branch).and_return('
|
15
|
+
allow(git_client).to receive(:current_branch).and_return('mybranch')
|
16
16
|
allow(git_client).to receive(:remote).with('origin').and_return('git@github.com:donaldduck/testrepo')
|
17
17
|
|
18
18
|
expected_output = <<~STR
|
data/spec/spec_helper.rb
CHANGED
@@ -5,9 +5,12 @@
|
|
5
5
|
require 'vcr'
|
6
6
|
require 'base64'
|
7
7
|
|
8
|
+
require_relative '../lib/geet/utils/attributes_selection_manager'
|
9
|
+
|
8
10
|
VCR.configure do |config|
|
9
11
|
config.cassette_library_dir = 'spec/vcr_cassettes'
|
10
12
|
config.hook_into :webmock
|
13
|
+
config.default_cassette_options = {match_requests_on: [:method, :uri, :body], allow_unused_http_interactions: false}
|
11
14
|
|
12
15
|
# See https://github.com/vcr/vcr/issues/201
|
13
16
|
config.filter_sensitive_data('<GITHUB_CREDENTIALS>') do
|
@@ -22,6 +25,8 @@ VCR.configure do |config|
|
|
22
25
|
end
|
23
26
|
end
|
24
27
|
|
28
|
+
Geet::Utils::AttributesSelectionManager.serialize_requests = true
|
29
|
+
|
25
30
|
# This file was generated by the `rspec --init` command. Conventionally, all
|
26
31
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
27
32
|
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
@@ -5,7 +5,7 @@ http_interactions:
|
|
5
5
|
uri: https://api.github.com/gists
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string: '{"public":false,"files":{"
|
8
|
+
string: '{"public":false,"files":{"geet_gist_test.md":{"content":"testcontent"}},"description":"testdescription"}'
|
9
9
|
headers:
|
10
10
|
Accept-Encoding:
|
11
11
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
@@ -5,7 +5,7 @@ http_interactions:
|
|
5
5
|
uri: https://api.github.com/gists
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string: '{"public":true,"files":{"
|
8
|
+
string: '{"public":true,"files":{"geet_gist_test.md":{"content":"testcontent"}},"description":"testdescription"}'
|
9
9
|
headers:
|
10
10
|
Accept-Encoding:
|
11
11
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
@@ -77,159 +77,4 @@ http_interactions:
|
|
77
77
|
string: '{"url":"https://api.github.com/repos/donald-fr/testrepo_u/issues/7","repository_url":"https://api.github.com/repos/donald-fr/testrepo_u","labels_url":"https://api.github.com/repos/donald-fr/testrepo_u/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/donald-fr/testrepo_u/issues/7/comments","events_url":"https://api.github.com/repos/donald-fr/testrepo_u/issues/7/events","html_url":"https://github.com/donald-fr/testrepo_u/issues/7","id":123456767,"number":7,"title":"Title","user":{"login":"donaldduck","id":1234566,"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},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-11-21T13:01:25Z","updated_at":"2017-11-21T13:01:25Z","closed_at":null,"author_association":"COLLABORATOR","body":"Description","closed_by":null}'
|
78
78
|
http_version:
|
79
79
|
recorded_at: Tue, 21 Nov 2017 13:01:25 GMT
|
80
|
-
- request:
|
81
|
-
method: get
|
82
|
-
uri: https://api.github.com/user
|
83
|
-
body:
|
84
|
-
encoding: US-ASCII
|
85
|
-
string: ''
|
86
|
-
headers:
|
87
|
-
Accept-Encoding:
|
88
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
89
|
-
Accept:
|
90
|
-
- application/vnd.github.v3+json
|
91
|
-
User-Agent:
|
92
|
-
- Ruby
|
93
|
-
Host:
|
94
|
-
- api.github.com
|
95
|
-
Authorization:
|
96
|
-
- Basic <GITHUB_CREDENTIALS>
|
97
|
-
response:
|
98
|
-
status:
|
99
|
-
code: 200
|
100
|
-
message: OK
|
101
|
-
headers:
|
102
|
-
Server:
|
103
|
-
- GitHub.com
|
104
|
-
Date:
|
105
|
-
- Tue, 21 Nov 2017 13:01:25 GMT
|
106
|
-
Content-Type:
|
107
|
-
- application/json; charset=utf-8
|
108
|
-
Transfer-Encoding:
|
109
|
-
- chunked
|
110
|
-
Status:
|
111
|
-
- 200 OK
|
112
|
-
X-Ratelimit-Limit:
|
113
|
-
- '5000'
|
114
|
-
X-Ratelimit-Remaining:
|
115
|
-
- '4985'
|
116
|
-
X-Ratelimit-Reset:
|
117
|
-
- '1511270582'
|
118
|
-
Cache-Control:
|
119
|
-
- private, max-age=60, s-maxage=60
|
120
|
-
Vary:
|
121
|
-
- Accept, Authorization, Cookie, X-GitHub-OTP
|
122
|
-
Etag:
|
123
|
-
- W/"9e810c6be4e1faca1be292a0179eded7"
|
124
|
-
Last-Modified:
|
125
|
-
- Mon, 20 Nov 2017 21:53:27 GMT
|
126
|
-
X-Oauth-Scopes:
|
127
|
-
- admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook,
|
128
|
-
delete_repo, gist, notifications, repo, user
|
129
|
-
X-Accepted-Oauth-Scopes:
|
130
|
-
- ''
|
131
|
-
X-Github-Media-Type:
|
132
|
-
- github.v3; format=json
|
133
|
-
Access-Control-Expose-Headers:
|
134
|
-
- ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining,
|
135
|
-
X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
136
|
-
Access-Control-Allow-Origin:
|
137
|
-
- "*"
|
138
|
-
Content-Security-Policy:
|
139
|
-
- default-src 'none'
|
140
|
-
Strict-Transport-Security:
|
141
|
-
- max-age=31536000; includeSubdomains; preload
|
142
|
-
X-Content-Type-Options:
|
143
|
-
- nosniff
|
144
|
-
X-Frame-Options:
|
145
|
-
- deny
|
146
|
-
X-Xss-Protection:
|
147
|
-
- 1; mode=block
|
148
|
-
X-Runtime-Rack:
|
149
|
-
- '0.055102'
|
150
|
-
X-Github-Request-Id:
|
151
|
-
- EA88:2B89:3D7743:9B8368:5A1423A5
|
152
|
-
body:
|
153
|
-
encoding: ASCII-8BIT
|
154
|
-
string: '{"login":"donaldduck","id":1234566,"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,"name":"Donald
|
155
|
-
Duck","company":"@mickeymouselaws","blog":"","location":"Duckburg","email":"donald.pub2@gmail.com","hireable":true,"bio":null,"public_repos":12,"public_gists":0,"followers":7,"following":0,"created_at":"2012-04-01T11:52:16Z","updated_at":"2017-11-20T21:53:27Z","private_gists":0,"total_private_repos":1,"owned_private_repos":0,"disk_usage":32253,"collaborators":0,"two_factor_authentication":true,"plan":{"name":"free","space":976562499,"collaborators":0,"private_repos":0}}'
|
156
|
-
http_version:
|
157
|
-
recorded_at: Tue, 21 Nov 2017 13:01:25 GMT
|
158
|
-
- request:
|
159
|
-
method: post
|
160
|
-
uri: https://api.github.com/repos/donald-fr/testrepo_u/issues/7/assignees
|
161
|
-
body:
|
162
|
-
encoding: UTF-8
|
163
|
-
string: '{"assignees":["donaldduck"]}'
|
164
|
-
headers:
|
165
|
-
Accept-Encoding:
|
166
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
167
|
-
Accept:
|
168
|
-
- application/vnd.github.v3+json
|
169
|
-
User-Agent:
|
170
|
-
- Ruby
|
171
|
-
Host:
|
172
|
-
- api.github.com
|
173
|
-
Authorization:
|
174
|
-
- Basic <GITHUB_CREDENTIALS>
|
175
|
-
response:
|
176
|
-
status:
|
177
|
-
code: 201
|
178
|
-
message: Created
|
179
|
-
headers:
|
180
|
-
Server:
|
181
|
-
- GitHub.com
|
182
|
-
Date:
|
183
|
-
- Tue, 21 Nov 2017 13:01:26 GMT
|
184
|
-
Content-Type:
|
185
|
-
- application/json; charset=utf-8
|
186
|
-
Content-Length:
|
187
|
-
- '3589'
|
188
|
-
Status:
|
189
|
-
- 201 Created
|
190
|
-
X-Ratelimit-Limit:
|
191
|
-
- '5000'
|
192
|
-
X-Ratelimit-Remaining:
|
193
|
-
- '4984'
|
194
|
-
X-Ratelimit-Reset:
|
195
|
-
- '1511270582'
|
196
|
-
Cache-Control:
|
197
|
-
- private, max-age=60, s-maxage=60
|
198
|
-
Vary:
|
199
|
-
- Accept, Authorization, Cookie, X-GitHub-OTP
|
200
|
-
Etag:
|
201
|
-
- '"9660bab5625d238cbfd0ba8b50f56e26"'
|
202
|
-
X-Oauth-Scopes:
|
203
|
-
- admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook,
|
204
|
-
delete_repo, gist, notifications, repo, user
|
205
|
-
X-Accepted-Oauth-Scopes:
|
206
|
-
- ''
|
207
|
-
Location:
|
208
|
-
- https://api.github.com/repos/donald-fr/testrepo_u/issues/7
|
209
|
-
X-Github-Media-Type:
|
210
|
-
- github.v3; format=json
|
211
|
-
Access-Control-Expose-Headers:
|
212
|
-
- ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining,
|
213
|
-
X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
214
|
-
Access-Control-Allow-Origin:
|
215
|
-
- "*"
|
216
|
-
Content-Security-Policy:
|
217
|
-
- default-src 'none'
|
218
|
-
Strict-Transport-Security:
|
219
|
-
- max-age=31536000; includeSubdomains; preload
|
220
|
-
X-Content-Type-Options:
|
221
|
-
- nosniff
|
222
|
-
X-Frame-Options:
|
223
|
-
- deny
|
224
|
-
X-Xss-Protection:
|
225
|
-
- 1; mode=block
|
226
|
-
X-Runtime-Rack:
|
227
|
-
- '0.176071'
|
228
|
-
X-Github-Request-Id:
|
229
|
-
- C4AC:2B89:3D779E:9B842A:5A1423A6
|
230
|
-
body:
|
231
|
-
encoding: UTF-8
|
232
|
-
string: '{"url":"https://api.github.com/repos/donald-fr/testrepo_u/issues/7","repository_url":"https://api.github.com/repos/donald-fr/testrepo_u","labels_url":"https://api.github.com/repos/donald-fr/testrepo_u/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/donald-fr/testrepo_u/issues/7/comments","events_url":"https://api.github.com/repos/donald-fr/testrepo_u/issues/7/events","html_url":"https://github.com/donald-fr/testrepo_u/issues/7","id":123456767,"number":7,"title":"Title","user":{"login":"donaldduck","id":1234566,"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},"labels":[],"state":"open","locked":false,"assignee":{"login":"donaldduck","id":1234566,"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},"assignees":[{"login":"donaldduck","id":1234566,"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}],"milestone":null,"comments":0,"created_at":"2017-11-21T13:01:25Z","updated_at":"2017-11-21T13:01:26Z","closed_at":null,"author_association":"COLLABORATOR","body":"Description"}'
|
233
|
-
http_version:
|
234
|
-
recorded_at: Tue, 21 Nov 2017 13:01:26 GMT
|
235
80
|
recorded_with: VCR 3.0.3
|
@@ -5,7 +5,7 @@ http_interactions:
|
|
5
5
|
uri: https://api.github.com/repos/donaldduck/testrepo/labels
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string: '{"name":"my_label","color":"
|
8
|
+
string: '{"name":"my_label","color":"0097ff"}'
|
9
9
|
headers:
|
10
10
|
Accept-Encoding:
|
11
11
|
- gzip;q=1.0,deflate;q=0.6,identity;q=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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Saverio Miroddi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simple_scripting
|
@@ -61,13 +61,13 @@ executables:
|
|
61
61
|
extensions: []
|
62
62
|
extra_rdoc_files: []
|
63
63
|
files:
|
64
|
+
- ".gitignore"
|
64
65
|
- ".rspec"
|
65
66
|
- ".rubocop.yml"
|
66
67
|
- ".rubocop_todo.yml"
|
67
68
|
- ".ruby-version"
|
68
69
|
- ".travis.yml"
|
69
70
|
- Gemfile
|
70
|
-
- Gemfile.lock
|
71
71
|
- LICENSE
|
72
72
|
- README.md
|
73
73
|
- Rakefile
|
@@ -80,15 +80,14 @@ files:
|
|
80
80
|
- lib/geet/commandline/editor.rb
|
81
81
|
- lib/geet/git/repository.rb
|
82
82
|
- lib/geet/github/abstract_issue.rb
|
83
|
-
- lib/geet/github/account.rb
|
84
83
|
- lib/geet/github/api_interface.rb
|
85
84
|
- lib/geet/github/branch.rb
|
86
|
-
- lib/geet/github/collaborator.rb
|
87
85
|
- lib/geet/github/gist.rb
|
88
86
|
- lib/geet/github/issue.rb
|
89
87
|
- lib/geet/github/label.rb
|
90
88
|
- lib/geet/github/milestone.rb
|
91
89
|
- lib/geet/github/pr.rb
|
90
|
+
- lib/geet/github/user.rb
|
92
91
|
- lib/geet/gitlab/api_interface.rb
|
93
92
|
- lib/geet/gitlab/issue.rb
|
94
93
|
- lib/geet/gitlab/label.rb
|
data/Gemfile.lock
DELETED
@@ -1,93 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
geet (0.3.1)
|
5
|
-
simple_scripting (~> 0.9.4)
|
6
|
-
temp-fork-tp-filter (= 0.0.3)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
addressable (2.5.2)
|
12
|
-
public_suffix (>= 2.0.2, < 4.0)
|
13
|
-
ast (2.3.0)
|
14
|
-
byebug (9.1.0)
|
15
|
-
crack (0.4.3)
|
16
|
-
safe_yaml (~> 1.0.0)
|
17
|
-
diff-lcs (1.3)
|
18
|
-
equatable (0.5.0)
|
19
|
-
hashdiff (0.3.7)
|
20
|
-
hitimes (1.2.6)
|
21
|
-
necromancer (0.4.0)
|
22
|
-
parallel (1.12.1)
|
23
|
-
parseconfig (1.0.8)
|
24
|
-
parser (2.4.0.2)
|
25
|
-
ast (~> 2.3)
|
26
|
-
pastel (0.7.2)
|
27
|
-
equatable (~> 0.5.0)
|
28
|
-
tty-color (~> 0.4.0)
|
29
|
-
powerpack (0.1.1)
|
30
|
-
public_suffix (3.0.1)
|
31
|
-
rainbow (3.0.0)
|
32
|
-
rake (12.3.0)
|
33
|
-
rspec (3.7.0)
|
34
|
-
rspec-core (~> 3.7.0)
|
35
|
-
rspec-expectations (~> 3.7.0)
|
36
|
-
rspec-mocks (~> 3.7.0)
|
37
|
-
rspec-core (3.7.0)
|
38
|
-
rspec-support (~> 3.7.0)
|
39
|
-
rspec-expectations (3.7.0)
|
40
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
41
|
-
rspec-support (~> 3.7.0)
|
42
|
-
rspec-mocks (3.7.0)
|
43
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
44
|
-
rspec-support (~> 3.7.0)
|
45
|
-
rspec-support (3.7.0)
|
46
|
-
rubocop (0.52.0)
|
47
|
-
parallel (~> 1.10)
|
48
|
-
parser (>= 2.4.0.2, < 3.0)
|
49
|
-
powerpack (~> 0.1)
|
50
|
-
rainbow (>= 2.2.2, < 4.0)
|
51
|
-
ruby-progressbar (~> 1.7)
|
52
|
-
unicode-display_width (~> 1.0, >= 1.0.1)
|
53
|
-
ruby-progressbar (1.9.0)
|
54
|
-
safe_yaml (1.0.4)
|
55
|
-
simple_scripting (0.9.4)
|
56
|
-
parseconfig (~> 1.0)
|
57
|
-
temp-fork-tp-filter (0.0.3)
|
58
|
-
necromancer (~> 0.4.0)
|
59
|
-
pastel (~> 0.7.0)
|
60
|
-
timers (~> 4.1.2)
|
61
|
-
tty-cursor (~> 0.5.0)
|
62
|
-
tty-reader (~> 0.2.0)
|
63
|
-
timers (4.1.2)
|
64
|
-
hitimes
|
65
|
-
tty-color (0.4.2)
|
66
|
-
tty-cursor (0.5.0)
|
67
|
-
tty-reader (0.2.0)
|
68
|
-
tty-cursor (~> 0.5.0)
|
69
|
-
tty-screen (~> 0.6.4)
|
70
|
-
wisper (~> 2.0.0)
|
71
|
-
tty-screen (0.6.4)
|
72
|
-
unicode-display_width (1.3.0)
|
73
|
-
vcr (3.0.3)
|
74
|
-
webmock (3.1.1)
|
75
|
-
addressable (>= 2.3.6)
|
76
|
-
crack (>= 0.3.2)
|
77
|
-
hashdiff
|
78
|
-
wisper (2.0.0)
|
79
|
-
|
80
|
-
PLATFORMS
|
81
|
-
ruby
|
82
|
-
|
83
|
-
DEPENDENCIES
|
84
|
-
byebug (~> 9.1.0)
|
85
|
-
geet!
|
86
|
-
rake (~> 12.3.0)
|
87
|
-
rspec (~> 3.7.0)
|
88
|
-
rubocop (~> 0.52.0)
|
89
|
-
vcr (~> 3.0.3)
|
90
|
-
webmock (~> 3.1.1)
|
91
|
-
|
92
|
-
BUNDLED WITH
|
93
|
-
1.16.1
|
data/lib/geet/github/account.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Geet
|
4
|
-
module Github
|
5
|
-
class Account
|
6
|
-
def initialize(api_interface)
|
7
|
-
@api_interface = api_interface
|
8
|
-
end
|
9
|
-
|
10
|
-
def authenticated_user
|
11
|
-
api_path = '/user'
|
12
|
-
|
13
|
-
response = @api_interface.send_request(api_path)
|
14
|
-
|
15
|
-
response.fetch('login')
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'date'
|
4
|
-
|
5
|
-
module Geet
|
6
|
-
module Github
|
7
|
-
class Collaborator
|
8
|
-
# Returns a flat list of names in string form.
|
9
|
-
def self.list(api_interface)
|
10
|
-
api_path = 'collaborators'
|
11
|
-
response = api_interface.send_request(api_path, multipage: true)
|
12
|
-
|
13
|
-
response.map { |user_entry| user_entry.fetch('login') }
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|