geet 0.1.11 → 0.1.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1a2f49ae01e6ee8ffb49547325a0a863fcdbf5a3
4
- data.tar.gz: 278afc31f3bde847a85888ae1a41d9f59f4bf971
3
+ metadata.gz: cc8920121911b4f4ce4fe3d0d090be3bef017587
4
+ data.tar.gz: 5a85cb49ef2e87aef1fb930e314c83042b3b2abd
5
5
  SHA512:
6
- metadata.gz: a26048f5c129330b17d077172b2533d8a38f19ca8dcc588eb580cc58ebc381708581713bebc5605b6bf4d7aca45723478f49d1f93cd59377cd026921bd8e984f
7
- data.tar.gz: 50de5cca0d6d813bfdb6a2ac32143a7fb4d710e090f4ee15e24f92da6499ac148abca94ae22ef6fb656c54e8ebf4a0c041aee633fe29ebe7413c9b2936199bd0
6
+ metadata.gz: d0a8ca5e66586a583c84e7113fef8e83e1e0897f9ab07f04bf0cf7cc4545d16f83ae43acbbef4e079255fd5233a3330b007d2a0e1b89fe85171f3075af260265
7
+ data.tar.gz: 617080f5cce9ddd914aaca259f68aee020251b5157bf352dd736d24e27555c72d6a13527a8698a3ffe3c78d594e42e2ad7dbbdc8e3aae589d277b132dc9f9693
data/bin/geet CHANGED
@@ -29,6 +29,10 @@ class GeetLauncher
29
29
  options[:milestone_pattern] = options.delete(:milestone) if options.key?(:milestone)
30
30
 
31
31
  Services::CreateIssue.new.execute(repository, title, description, options)
32
+ when LABEL_CREATE_COMMAND
33
+ name = options.delete(:name)
34
+
35
+ Services::CreateLabel.new.execute(repository, name, options)
32
36
  when ISSUE_LIST_COMMAND
33
37
  Services::ListIssues.new.execute(repository)
34
38
  when LABEL_LIST_COMMAND
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.required_ruby_version = '>= 2.2.0'
12
12
  s.authors = ['Saverio Miroddi']
13
- s.date = '2017-11-27'
13
+ s.date = '2017-12-23'
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).'
@@ -3,6 +3,7 @@ module Geet
3
3
  module Commands
4
4
  GIST_CREATE_COMMAND = 'gist.create'
5
5
  ISSUE_CREATE_COMMAND = 'issue.create'
6
+ LABEL_CREATE_COMMAND = 'label.create'
6
7
  ISSUE_LIST_COMMAND = 'issue.list'
7
8
  LABEL_LIST_COMMAND = 'label.list'
8
9
  MILESTONE_LIST_COMMAND = 'milestone.list'
@@ -27,6 +27,11 @@ module Geet
27
27
  'description'
28
28
  ].freeze
29
29
 
30
+ LABEL_CREATE_OPTIONS = [
31
+ ['-c', '--color color', '6-digits hex color; if not specified, a random one is created'],
32
+ 'name',
33
+ ].freeze
34
+
30
35
  ISSUE_LIST_OPTIONS = [
31
36
  ['-u', '--upstream', 'List on the upstream repository'],
32
37
  ].freeze
@@ -68,6 +73,7 @@ module Geet
68
73
  'list' => ISSUE_LIST_OPTIONS,
69
74
  },
70
75
  'label' => {
76
+ 'create' => LABEL_CREATE_OPTIONS,
71
77
  'list' => LABEL_LIST_OPTIONS,
72
78
  },
73
79
  'milestone' => {
@@ -43,6 +43,10 @@ module Geet
43
43
  attempt_provider_call(:Issue, :create, title, description, api_interface)
44
44
  end
45
45
 
46
+ def create_label(name, color)
47
+ attempt_provider_call(:Label, :create, name, color, api_interface)
48
+ end
49
+
46
50
  def abstract_issues(milestone: nil)
47
51
  attempt_provider_call(:AbstractIssue, :list, api_interface, milestone: milestone)
48
52
  end
@@ -49,6 +49,8 @@ module Geet
49
49
  @api_interface.send_request(api_path, data: request_data)
50
50
  end
51
51
 
52
+ # labels: array of strings.
53
+ #
52
54
  def add_labels(labels)
53
55
  api_path = "issues/#{@number}/labels"
54
56
  request_data = labels
@@ -5,12 +5,34 @@ require 'date'
5
5
  module Geet
6
6
  module Github
7
7
  class Label
8
+ attr_reader :name, :color
9
+
10
+ def initialize(name, color)
11
+ @name = name
12
+ @color = color
13
+ end
14
+
8
15
  # Returns a flat list of names in string form.
9
16
  def self.list(api_interface)
10
17
  api_path = 'labels'
11
18
  response = api_interface.send_request(api_path, multipage: true)
12
19
 
13
- response.map { |label_entry| label_entry.fetch('name') }
20
+ response.map do |label_entry|
21
+ name = label_entry.fetch('name')
22
+ color = label_entry.fetch('color')
23
+
24
+ new(name, color)
25
+ end
26
+ end
27
+
28
+ # See https://developer.github.com/v3/issues/labels/#create-a-label
29
+ def self.create(name, color, api_interface)
30
+ api_path = 'labels'
31
+ request_data = {name: name, color: color }
32
+
33
+ api_interface.send_request(api_path, data: request_data)
34
+
35
+ new(name, color)
14
36
  end
15
37
  end
16
38
  end
@@ -5,12 +5,24 @@ require 'date'
5
5
  module Geet
6
6
  module Gitlab
7
7
  class Label
8
+ attr_reader :name, :color
9
+
10
+ def initialize(name, color)
11
+ @name = name
12
+ @color = color
13
+ end
14
+
8
15
  # Returns a flat list of names in string form.
9
16
  def self.list(api_interface)
10
17
  api_path = "projects/#{api_interface.path_with_namespace(encoded: true)}/labels"
11
18
  response = api_interface.send_request(api_path, multipage: true)
12
19
 
13
- response.map { |label_entry| label_entry.fetch('name') }
20
+ response.map do |label_entry|
21
+ name = label_entry.fetch('name')
22
+ color = label_entry.fetch('color').sub('#', '') # normalize
23
+
24
+ new(name, color)
25
+ end
14
26
  end
15
27
  end
16
28
  end
@@ -62,7 +62,7 @@ module Geet
62
62
  Thread.new do
63
63
  all_labels = repository.labels
64
64
 
65
- select_entries(all_labels, label_patterns, type: 'labels')
65
+ select_entries(all_labels, label_patterns, type: 'labels', instance_method: :name)
66
66
  end
67
67
  end
68
68
 
@@ -91,10 +91,12 @@ module Geet
91
91
  end
92
92
 
93
93
  def add_labels(issue, selected_labels, output)
94
- output.puts "Adding labels #{selected_labels.join(', ')}..."
94
+ labels_list = selected_labels.map(&:name).join(', ')
95
+
96
+ output.puts "Adding labels #{labels_list}..."
95
97
 
96
98
  Thread.new do
97
- issue.add_labels(selected_labels)
99
+ issue.add_labels(selected_labels.map(&:name))
98
100
  end
99
101
  end
100
102
 
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Geet
4
+ module Services
5
+ class CreateLabel
6
+ def execute(repository, name, color: generate_random_color, output: $stdout)
7
+ label = create_label(repository, name, color, output)
8
+
9
+ output.puts "Created with color ##{label.color}"
10
+
11
+ label
12
+ end
13
+
14
+ private
15
+
16
+ def create_label(repository, name, color, output)
17
+ output.puts 'Creating label...'
18
+
19
+ repository.create_label(name, color)
20
+ end
21
+
22
+ # Return a 6-digits hex random color.
23
+ def generate_random_color
24
+ hex_number = rand(2**24).to_s(16)
25
+
26
+ hex_number.rjust(6, '0')
27
+ end
28
+ end
29
+ end
30
+ end
@@ -52,7 +52,7 @@ module Geet
52
52
  Thread.new do
53
53
  all_labels = repository.labels
54
54
 
55
- select_entries(all_labels, label_patterns, type: 'labels')
55
+ select_entries(all_labels, label_patterns, type: 'labels', instance_method: :name)
56
56
  end
57
57
  end
58
58
 
@@ -95,10 +95,12 @@ module Geet
95
95
  end
96
96
 
97
97
  def add_labels(pr, selected_labels, output)
98
- output.puts "Adding labels #{selected_labels.join(', ')}..."
98
+ labels_list = selected_labels.map(&:name).join(', ')
99
+
100
+ output.puts "Adding labels #{labels_list}..."
99
101
 
100
102
  Thread.new do
101
- pr.add_labels(selected_labels)
103
+ pr.add_labels(selected_labels.map(&:name))
102
104
  end
103
105
  end
104
106
 
@@ -7,7 +7,7 @@ module Geet
7
7
  labels = repository.labels
8
8
 
9
9
  labels.each do |label|
10
- output.puts "- #{label}"
10
+ output.puts "- #{label.name} (##{label.color})"
11
11
  end
12
12
  end
13
13
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Geet
4
- VERSION = '0.1.11'
4
+ VERSION = '0.1.12'
5
5
  end
@@ -0,0 +1,54 @@
1
+ require 'spec_helper'
2
+
3
+ require_relative '../../lib/geet/git/repository'
4
+ require_relative '../../lib/geet/services/create_label'
5
+
6
+ describe Geet::Services::CreateLabel do
7
+ let(:repository) { Geet::Git::Repository.new }
8
+
9
+ context 'with user-specified color' do
10
+ it 'should create a label' do
11
+ allow(repository).to receive(:remote).with('origin').and_return('git@github.com:donaldduck/testrepo')
12
+
13
+ expected_output = <<~STR
14
+ Creating label...
15
+ Created with color #c64c64
16
+ STR
17
+
18
+ actual_output = StringIO.new
19
+
20
+ actual_created_label = VCR.use_cassette("create_label") do
21
+ described_class.new.execute(repository, 'my_label', color: 'c64c64', output: actual_output)
22
+ end
23
+
24
+ expect(actual_output.string).to eql(expected_output)
25
+
26
+ expect(actual_created_label.name).to eql('my_label')
27
+ expect(actual_created_label.color).to eql('c64c64')
28
+ end
29
+ end
30
+
31
+ context 'with auto-generated color' do
32
+ it 'should create a label' do
33
+ allow(repository).to receive(:remote).with('origin').and_return('git@github.com:donaldduck/testrepo')
34
+
35
+ expected_output_template = <<~STR
36
+ Creating label...
37
+ Created with color #%s
38
+ STR
39
+
40
+ actual_output = StringIO.new
41
+
42
+ actual_created_label = VCR.use_cassette("create_label_with_random_color") do
43
+ described_class.new.execute(repository, 'my_label', output: actual_output)
44
+ end
45
+
46
+ expected_output = expected_output_template % actual_created_label.color
47
+
48
+ expect(actual_output.string).to eql(expected_output)
49
+
50
+ expect(actual_created_label.name).to eql('my_label')
51
+ expect(actual_created_label.color).to match(/\A[0-9a-f]{6}\z/)
52
+ end
53
+ end
54
+ end
@@ -7,46 +7,71 @@ describe Geet::Services::ListIssues do
7
7
  let(:repository) { Geet::Git::Repository.new }
8
8
  let(:upstream_repository) { Geet::Git::Repository.new(upstream: true) }
9
9
 
10
- it 'should list the issues' do
11
- allow(repository).to receive(:remote).with('origin').and_return('git@github.com:donaldduck/testrepo')
10
+ context 'with github.com' do
11
+ it 'should list the issues' do
12
+ allow(repository).to receive(:remote).with('origin').and_return('git@github.com:donaldduck/testrepo')
12
13
 
13
- expected_output = <<~STR
14
- 5. Title 2 (https://github.com/donaldduck/testrepo/issues/5)
15
- 4. Title 1 (https://github.com/donaldduck/testrepo/issues/4)
16
- STR
17
- expected_issue_numbers = [5, 4]
14
+ expected_output = <<~STR
15
+ 5. Title 2 (https://github.com/donaldduck/testrepo/issues/5)
16
+ 4. Title 1 (https://github.com/donaldduck/testrepo/issues/4)
17
+ STR
18
+ expected_issue_numbers = [5, 4]
18
19
 
19
- actual_output = StringIO.new
20
+ actual_output = StringIO.new
20
21
 
21
- service_result = VCR.use_cassette("list_issues") do
22
- described_class.new.execute(repository, output: actual_output)
22
+ service_result = VCR.use_cassette("github_com/list_issues") do
23
+ described_class.new.execute(repository, output: actual_output)
24
+ end
25
+
26
+ actual_issue_numbers = service_result.map(&:number)
27
+
28
+ expect(actual_output.string).to eql(expected_output)
29
+ expect(actual_issue_numbers).to eql(expected_issue_numbers)
23
30
  end
24
31
 
25
- actual_issue_numbers = service_result.map(&:number)
32
+ it 'should list the upstream issues' do
33
+ allow(upstream_repository).to receive(:remote).with('origin').and_return('git@github.com:donaldduck/testrepo_2f')
34
+ allow(upstream_repository).to receive(:remote).with('upstream').and_return('git@github.com:donald-fr/testrepo_u')
26
35
 
27
- expect(actual_output.string).to eql(expected_output)
28
- expect(actual_issue_numbers).to eql(expected_issue_numbers)
29
- end
36
+ expected_output = <<~STR
37
+ 2. Title 2 U (https://github.com/donald-fr/testrepo_u/issues/2)
38
+ 1. Title 1 U (https://github.com/donald-fr/testrepo_u/issues/1)
39
+ STR
40
+ expected_issue_numbers = [2, 1]
30
41
 
31
- it 'should list the upstream issues' do
32
- allow(upstream_repository).to receive(:remote).with('origin').and_return('git@github.com:donaldduck/testrepo_2f')
33
- allow(upstream_repository).to receive(:remote).with('upstream').and_return('git@github.com:donald-fr/testrepo_u')
42
+ actual_output = StringIO.new
34
43
 
35
- expected_output = <<~STR
36
- 2. Title 2 U (https://github.com/donald-fr/testrepo_u/issues/2)
37
- 1. Title 1 U (https://github.com/donald-fr/testrepo_u/issues/1)
38
- STR
39
- expected_issue_numbers = [2, 1]
44
+ service_result = VCR.use_cassette("github_com/list_issues_upstream") do
45
+ described_class.new.execute(upstream_repository, output: actual_output)
46
+ end
40
47
 
41
- actual_output = StringIO.new
48
+ actual_issue_numbers = service_result.map(&:number)
42
49
 
43
- service_result = VCR.use_cassette("list_issues_upstream") do
44
- described_class.new.execute(upstream_repository, output: actual_output)
50
+ expect(actual_output.string).to eql(expected_output)
51
+ expect(actual_issue_numbers).to eql(expected_issue_numbers)
45
52
  end
53
+ end
54
+
55
+ context 'with gitlab.com' do
56
+ it 'should list the issues' do
57
+ allow(repository).to receive(:remote).with('origin').and_return('git@gitlab.com:donaldduck/testproject')
46
58
 
47
- actual_issue_numbers = service_result.map(&:number)
59
+ expected_output = <<~STR
60
+ 2. I like more pizza (https://gitlab.com/donaldduck/testproject/issues/2)
61
+ 1. I like pizza (https://gitlab.com/donaldduck/testproject/issues/1)
62
+ STR
63
+ expected_issue_numbers = [2, 1]
48
64
 
49
- expect(actual_output.string).to eql(expected_output)
50
- expect(actual_issue_numbers).to eql(expected_issue_numbers)
65
+ actual_output = StringIO.new
66
+
67
+ service_result = VCR.use_cassette("gitlab_com/list_issues") do
68
+ described_class.new.execute(repository, output: actual_output)
69
+ end
70
+
71
+ actual_issue_numbers = service_result.map(&:number)
72
+
73
+ expect(actual_output.string).to eql(expected_output)
74
+ expect(actual_issue_numbers).to eql(expected_issue_numbers)
75
+ end
51
76
  end
52
77
  end
@@ -11,20 +11,22 @@ describe Geet::Services::ListLabels do
11
11
  allow(repository).to receive(:remote).with('origin').and_return('git@github.com:donaldduck/geet')
12
12
 
13
13
  expected_output = <<~STR
14
- - bug
15
- - enhancement
16
- - technical_debt
17
- - top_priority
14
+ - bug (#ee0701)
15
+ - enhancement (#84b6eb)
16
+ - technical_debt (#ee0701)
17
+ - top_priority (#d93f0b)
18
18
  STR
19
- expected_labels = %w[bug enhancement technical_debt top_priority]
19
+ expected_label_names = %w[bug enhancement technical_debt top_priority]
20
20
 
21
21
  actual_output = StringIO.new
22
22
  actual_labels = VCR.use_cassette("github.com/list_labels") do
23
23
  described_class.new.execute(repository, output: actual_output)
24
24
  end
25
25
 
26
+ actual_label_names = actual_labels.map(&:name)
27
+
26
28
  expect(actual_output.string).to eql(expected_output)
27
- expect(actual_labels).to eql(expected_labels)
29
+ expect(actual_label_names).to eql(expected_label_names)
28
30
  end
29
31
  end
30
32
 
@@ -33,24 +35,26 @@ describe Geet::Services::ListLabels do
33
35
  allow(repository).to receive(:remote).with('origin').and_return('git@gitlab.com:donaldduck/testproject')
34
36
 
35
37
  expected_output = <<~STR
36
- - bug
37
- - confirmed
38
- - critical
39
- - discussion
40
- - documentation
41
- - enhancement
42
- - suggestion
43
- - support
38
+ - bug (#d9534f)
39
+ - confirmed (#d9534f)
40
+ - critical (#d9534f)
41
+ - discussion (#428bca)
42
+ - documentation (#f0ad4e)
43
+ - enhancement (#5cb85c)
44
+ - suggestion (#428bca)
45
+ - support (#f0ad4e)
44
46
  STR
45
- expected_labels = %w[bug confirmed critical discussion documentation enhancement suggestion support]
47
+ expected_label_names = %w[bug confirmed critical discussion documentation enhancement suggestion support]
46
48
 
47
49
  actual_output = StringIO.new
48
50
  actual_labels = VCR.use_cassette("gitlab.com/list_labels") do
49
51
  described_class.new.execute(repository, output: actual_output)
50
52
  end
51
53
 
54
+ actual_label_names = actual_labels.map(&:name)
55
+
52
56
  expect(actual_output.string).to eql(expected_output)
53
- expect(actual_labels).to eql(expected_labels)
57
+ expect(actual_label_names).to eql(expected_label_names)
54
58
  end
55
59
  end
56
60
  end
@@ -0,0 +1,80 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.github.com/repos/donaldduck/testrepo/labels
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"name":"my_label","color":"c64c64"}'
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
+ Server:
26
+ - GitHub.com
27
+ Date:
28
+ - Sat, 23 Dec 2017 18:03:21 GMT
29
+ Content-Type:
30
+ - application/json; charset=utf-8
31
+ Content-Length:
32
+ - '138'
33
+ Status:
34
+ - 201 Created
35
+ X-Ratelimit-Limit:
36
+ - '5000'
37
+ X-Ratelimit-Remaining:
38
+ - '4976'
39
+ X-Ratelimit-Reset:
40
+ - '1514053576'
41
+ Cache-Control:
42
+ - private, max-age=60, s-maxage=60
43
+ Vary:
44
+ - Accept, Authorization, Cookie, X-GitHub-OTP
45
+ Etag:
46
+ - '"1ea6b12ceb9b563a57d3a6be15fa628c"'
47
+ X-Oauth-Scopes:
48
+ - admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook,
49
+ delete_repo, gist, notifications, repo, user
50
+ X-Accepted-Oauth-Scopes:
51
+ - ''
52
+ Location:
53
+ - https://api.github.com/repos/donaldduck/testrepo/labels/my_label
54
+ X-Github-Media-Type:
55
+ - github.v3; format=json
56
+ Access-Control-Expose-Headers:
57
+ - ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining,
58
+ X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
59
+ Access-Control-Allow-Origin:
60
+ - "*"
61
+ Content-Security-Policy:
62
+ - default-src 'none'
63
+ Strict-Transport-Security:
64
+ - max-age=31536000; includeSubdomains; preload
65
+ X-Content-Type-Options:
66
+ - nosniff
67
+ X-Frame-Options:
68
+ - deny
69
+ X-Xss-Protection:
70
+ - 1; mode=block
71
+ X-Runtime-Rack:
72
+ - '0.037893'
73
+ X-Github-Request-Id:
74
+ - D320:7F5B:18C0222:4994D7F:5A3E9A69
75
+ body:
76
+ encoding: UTF-8
77
+ string: '{"id":786495522,"url":"https://api.github.com/repos/donaldduck/testrepo/labels/my_label","name":"my_label","color":"c64c64","default":false}'
78
+ http_version:
79
+ recorded_at: Sat, 23 Dec 2017 18:03:21 GMT
80
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,80 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.github.com/repos/donaldduck/testrepo/labels
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"name":"my_label","color":"9aa53a"}'
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
+ Server:
26
+ - GitHub.com
27
+ Date:
28
+ - Sat, 23 Dec 2017 18:07:18 GMT
29
+ Content-Type:
30
+ - application/json; charset=utf-8
31
+ Content-Length:
32
+ - '140'
33
+ Status:
34
+ - 201 Created
35
+ X-Ratelimit-Limit:
36
+ - '5000'
37
+ X-Ratelimit-Remaining:
38
+ - '4974'
39
+ X-Ratelimit-Reset:
40
+ - '1514053576'
41
+ Cache-Control:
42
+ - private, max-age=60, s-maxage=60
43
+ Vary:
44
+ - Accept, Authorization, Cookie, X-GitHub-OTP
45
+ Etag:
46
+ - '"d40831c543892438bb03c0751514c999"'
47
+ X-Oauth-Scopes:
48
+ - admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook,
49
+ delete_repo, gist, notifications, repo, user
50
+ X-Accepted-Oauth-Scopes:
51
+ - ''
52
+ Location:
53
+ - https://api.github.com/repos/donaldduck/testrepo/labels/my_label
54
+ X-Github-Media-Type:
55
+ - github.v3; format=json
56
+ Access-Control-Expose-Headers:
57
+ - ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining,
58
+ X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
59
+ Access-Control-Allow-Origin:
60
+ - "*"
61
+ Content-Security-Policy:
62
+ - default-src 'none'
63
+ Strict-Transport-Security:
64
+ - max-age=31536000; includeSubdomains; preload
65
+ X-Content-Type-Options:
66
+ - nosniff
67
+ X-Frame-Options:
68
+ - deny
69
+ X-Xss-Protection:
70
+ - 1; mode=block
71
+ X-Runtime-Rack:
72
+ - '0.039601'
73
+ X-Github-Request-Id:
74
+ - ECE0:7F59:1879FF8:328EDB9:5A3E9B55
75
+ body:
76
+ encoding: UTF-8
77
+ string: '{"id":786496976,"url":"https://api.github.com/repos/donaldduck/testrepo/labels/my_label","name":"my_label","color":"9aa53a","default":false}'
78
+ http_version:
79
+ recorded_at: Sat, 23 Dec 2017 18:07:18 GMT
80
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,84 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://gitlab.com/api/v4/projects/donaldduck%2Ftestproject/issues
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Host:
17
+ - gitlab.com
18
+ Private-Token:
19
+ - "<GITLAB_CREDENTIALS>"
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - nginx
27
+ Date:
28
+ - Mon, 27 Nov 2017 20:58:06 GMT
29
+ Content-Type:
30
+ - application/json
31
+ Content-Length:
32
+ - '1648'
33
+ Cache-Control:
34
+ - max-age=0, private, must-revalidate
35
+ Etag:
36
+ - W/"622f178aa3f7cf68c0314a3faa6c520f"
37
+ Link:
38
+ - <https://gitlab.com/api/v4/projects/donaldduck%2Ftestproject/issues?id=donaldduck%2Ftestproject&order_by=created_at&page=1&per_page=20&sort=desc&state=all>;
39
+ rel="first", <https://gitlab.com/api/v4/projects/donaldduck%2Ftestproject/issues?id=donaldduck%2Ftestproject&order_by=created_at&page=1&per_page=20&sort=desc&state=all>;
40
+ rel="last"
41
+ Vary:
42
+ - Origin
43
+ X-Content-Type-Options:
44
+ - nosniff
45
+ X-Frame-Options:
46
+ - SAMEORIGIN
47
+ X-Next-Page:
48
+ - ''
49
+ X-Page:
50
+ - '1'
51
+ X-Per-Page:
52
+ - '20'
53
+ X-Prev-Page:
54
+ - ''
55
+ X-Request-Id:
56
+ - 9d46bac0-142f-464f-af89-4cac318e4563
57
+ X-Runtime:
58
+ - '0.428030'
59
+ X-Total:
60
+ - '2'
61
+ X-Total-Pages:
62
+ - '1'
63
+ Strict-Transport-Security:
64
+ - max-age=31536000
65
+ Ratelimit-Limit:
66
+ - '600'
67
+ Ratelimit-Observed:
68
+ - '1'
69
+ Ratelimit-Remaining:
70
+ - '599'
71
+ Ratelimit-Reset:
72
+ - '1511816346'
73
+ Ratelimit-Resettime:
74
+ - Tue, 27 Nov 2017 20:59:06 GMT
75
+ body:
76
+ encoding: UTF-8
77
+ string: '[{"id":7921197,"iid":2,"project_id":4749339,"title":"I like more pizza","description":"And
78
+ you should, too!","state":"opened","created_at":"2017-11-26T20:56:53.870Z","updated_at":"2017-11-27T18:57:07.289Z","closed_at":null,"labels":[],"milestone":null,"assignees":[],"author":{"id":1161211,"name":"Saverio
79
+ Miroddi","username":"donaldduck","state":"active","avatar_url":"https://secure.gravatar.com/avatar/8209debe0ccee5d905ea2797cb94a5b0?s=80\u0026d=identicon","web_url":"https://gitlab.com/donaldduck"},"assignee":null,"user_notes_count":1,"upvotes":0,"downvotes":0,"due_date":null,"confidential":false,"weight":null,"discussion_locked":null,"web_url":"https://gitlab.com/donaldduck/testproject/issues/2","time_stats":{"time_estimate":0,"total_time_spent":0,"human_time_estimate":null,"human_total_time_spent":null}},{"id":7921196,"iid":1,"project_id":4749339,"title":"I
80
+ like pizza","description":"How about you?","state":"opened","created_at":"2017-11-26T20:56:42.241Z","updated_at":"2017-11-26T20:56:42.241Z","closed_at":null,"labels":[],"milestone":null,"assignees":[],"author":{"id":1161211,"name":"Saverio
81
+ Miroddi","username":"donaldduck","state":"active","avatar_url":"https://secure.gravatar.com/avatar/8209debe0ccee5d905ea2797cb94a5b0?s=80\u0026d=identicon","web_url":"https://gitlab.com/donaldduck"},"assignee":null,"user_notes_count":0,"upvotes":0,"downvotes":0,"due_date":null,"confidential":false,"weight":null,"discussion_locked":null,"web_url":"https://gitlab.com/donaldduck/testproject/issues/1","time_stats":{"time_estimate":0,"total_time_spent":0,"human_time_estimate":null,"human_total_time_spent":null}}]'
82
+ http_version:
83
+ recorded_at: Mon, 27 Nov 2017 20:58:06 GMT
84
+ 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.1.11
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saverio Miroddi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-27 00:00:00.000000000 Z
11
+ date: 2017-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simple_scripting
@@ -61,6 +61,7 @@ files:
61
61
  - lib/geet/helpers/os_helper.rb
62
62
  - lib/geet/services/create_gist.rb
63
63
  - lib/geet/services/create_issue.rb
64
+ - lib/geet/services/create_label.rb
64
65
  - lib/geet/services/create_pr.rb
65
66
  - lib/geet/services/list_issues.rb
66
67
  - lib/geet/services/list_labels.rb
@@ -70,6 +71,7 @@ files:
70
71
  - lib/geet/version.rb
71
72
  - spec/integration/create_gist_spec.rb
72
73
  - spec/integration/create_issue_spec.rb
74
+ - spec/integration/create_label_spec.rb
73
75
  - spec/integration/create_pr_spec.rb
74
76
  - spec/integration/list_issues_spec.rb
75
77
  - spec/integration/list_labels_spec.rb
@@ -81,12 +83,15 @@ files:
81
83
  - spec/vcr_cassettes/create_gist_public.yml
82
84
  - spec/vcr_cassettes/create_issue.yml
83
85
  - spec/vcr_cassettes/create_issue_upstream.yml
86
+ - spec/vcr_cassettes/create_label.yml
87
+ - spec/vcr_cassettes/create_label_with_random_color.yml
84
88
  - spec/vcr_cassettes/create_pr.yml
85
89
  - spec/vcr_cassettes/create_pr_upstream.yml
90
+ - spec/vcr_cassettes/github_com/list_issues.yml
91
+ - spec/vcr_cassettes/github_com/list_issues_upstream.yml
86
92
  - spec/vcr_cassettes/github_com/list_labels.yml
93
+ - spec/vcr_cassettes/gitlab_com/list_issues.yml
87
94
  - spec/vcr_cassettes/gitlab_com/list_labels.yml
88
- - spec/vcr_cassettes/list_issues.yml
89
- - spec/vcr_cassettes/list_issues_upstream.yml
90
95
  - spec/vcr_cassettes/list_milestones.yml
91
96
  - spec/vcr_cassettes/list_prs.yml
92
97
  - spec/vcr_cassettes/list_prs_upstream.yml
@@ -111,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
116
  version: '0'
112
117
  requirements: []
113
118
  rubyforge_project:
114
- rubygems_version: 2.6.11
119
+ rubygems_version: 2.6.13
115
120
  signing_key:
116
121
  specification_version: 4
117
122
  summary: Commandline interface for performing SCM (eg. GitHub) operations (eg. PR