peoplegroup-connectors 0.1.3 → 0.1.4

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: eb962e9d43875bb0a19ac206165c335097c6147148d23944a4479e97460613f3
4
- data.tar.gz: 521103c3b8289e98752fb6a06f125ed8db47ef5d160030032b00ab478263498d
3
+ metadata.gz: e340134de5e6005a6abbaf23e43a8eb58a2b544c98ae255c211f58f4e977c12a
4
+ data.tar.gz: ded841507c511fa4086074c0dcfb0d8a1d23eb1c3635bb98c1653480abf6cca3
5
5
  SHA512:
6
- metadata.gz: d52daa4d4fddc9a989dc41e601d208167c6a27c36d1c2a0ba09b164c25a9eb829486bae15f09a64bb6c670f57ea803fc37e25966410761f2fefe11b165206700
7
- data.tar.gz: 472b1e602fb9ae87b5b25fb6987e4d625a31b2b668c24429ab850adc06314980a7dbd8533f518104d475a554df9fe94b16ac87e365247137636acba14dbcf432
6
+ metadata.gz: 4f5cce06b2badfcce8d829e1a9a644093b107fdd3ad44e12090d2b664e563f1037aa4e129eacabde7b87b41dc9421ade5ff0119db466d147d6a74b54b82ce6a6
7
+ data.tar.gz: 480a77c30f5158fc601a543b7b49bc05e7168230a1b243319526aa67c028dd8ecd3be4bd58296c38681441d47a6647505c85e50f5756704e9d6527e7f496c40f
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.6.5
6
+ before_install: gem install bundler -v 2.1.4
data/Gemfile CHANGED
@@ -1,9 +1,7 @@
1
- # frozen_string_literal: true
1
+ source "https://rubygems.org"
2
2
 
3
- source 'https://rubygems.org'
4
-
5
- # Specify your gem's dependencies in gl-people-connectors.gemspec
3
+ # Specify your gem's dependencies in connectors.gemspec
6
4
  gemspec
7
5
 
8
- gem 'rake', '~> 12.0'
9
- gem 'rspec', '~> 3.0'
6
+ gem "rake", "~> 12.0"
7
+ gem "rspec", "~> 3.0"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- peoplegroup-connectors (0.1.2)
4
+ connectors (0.1.0)
5
5
  gitlab
6
6
 
7
7
  GEM
@@ -64,7 +64,7 @@ PLATFORMS
64
64
  ruby
65
65
 
66
66
  DEPENDENCIES
67
- peoplegroup-connectors!
67
+ connectors!
68
68
  rake (~> 12.0)
69
69
  rspec (~> 3.0)
70
70
  rubocop (~> 0.85)
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # PeopleGroup::Connectors
1
+ # Connectors
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/peoplegroup/connectors`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/connectors`. To experiment with that code, run `bin/console` for an interactive prompt.
4
4
 
5
5
  TODO: Delete this and the text above, and describe your gem
6
6
 
@@ -9,7 +9,7 @@ TODO: Delete this and the text above, and describe your gem
9
9
  Add this line to your application's Gemfile:
10
10
 
11
11
  ```ruby
12
- gem 'peoplegroup-connectors'
12
+ gem 'connectors'
13
13
  ```
14
14
 
15
15
  And then execute:
@@ -18,7 +18,7 @@ And then execute:
18
18
 
19
19
  Or install it yourself as:
20
20
 
21
- $ gem install peoplegroup-connectors
21
+ $ gem install connectors
22
22
 
23
23
  ## Usage
24
24
 
@@ -30,11 +30,15 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
30
30
 
31
31
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
32
 
33
- ## Contributing and Code of Conduct
33
+ ## Contributing
34
34
 
35
- Bug reports and pull requests are welcome on GitLab at https://gitlab.com/gitlab-com/people-group/peopleops-eng/connectors-gem. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/connectors. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/connectors/blob/master/CODE_OF_CONDUCT.md).
36
36
 
37
37
 
38
38
  ## License
39
39
 
40
40
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
41
+
42
+ ## Code of Conduct
43
+
44
+ Everyone interacting in the Connectors project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/connectors/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile CHANGED
@@ -1,8 +1,6 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
5
3
 
6
4
  RSpec::Core::RakeTask.new(:spec)
7
5
 
8
- task default: :spec
6
+ task :default => :spec
data/bin/console CHANGED
@@ -1,26 +1,14 @@
1
1
  #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
2
 
4
- require 'bundler/setup'
5
- require 'peoplegroup/connectors'
3
+ require "bundler/setup"
4
+ require "connectors"
6
5
 
7
- def reload!(print: true)
8
- puts 'Reloading ...' if print
9
- # Main project directory.
10
- root_dir = File.expand_path('..', __dir__)
11
- # Directories within the project that should be reloaded.
12
- reload_dirs = %w[lib]
13
- # Loop through and reload every file in all relevant project directories.
14
- reload_dirs.each do |dir|
15
- Dir.glob("#{root_dir}/#{dir}/**/*.rb").each { |f| load(f) }
16
- end
17
- # Return true when complete.
18
- true
19
- end
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
20
8
 
21
9
  # (If you use this, don't forget to add pry to your Gemfile!)
22
10
  # require "pry"
23
11
  # Pry.start
24
12
 
25
- require 'irb'
13
+ require "irb"
26
14
  IRB.start(__FILE__)
@@ -0,0 +1,34 @@
1
+ require_relative 'lib/connectors/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "peoplegroup-connectors"
5
+ spec.version = Connectors::VERSION
6
+ spec.authors = ["lien van den steen"]
7
+ spec.email = ["lvandensteen@gitlab.com"]
8
+
9
+ spec.summary = 'Library for our shared connectors.'
10
+ spec.description = 'Avoid repeating methods in different projects for our connectos.'
11
+ spec.homepage = 'https://gitlab.com/gitlab-com/people-group/peopleops-eng/connectors-gem'
12
+ spec.license = "MIT"
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
+
15
+ spec.metadata['homepage_uri'] = spec.homepage
16
+ spec.metadata['source_code_uri'] = spec.homepage
17
+ spec.metadata['changelog_uri'] = spec.homepage
18
+
19
+ # Specify which files should be added to the gem when it is released.
20
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
22
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
+ end
24
+ spec.bindir = "exe"
25
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
+ spec.require_paths = ["lib"]
27
+
28
+ spec.add_dependency 'gitlab'
29
+
30
+ spec.add_development_dependency 'rspec', '~> 3.2'
31
+ spec.add_development_dependency 'rubocop', '~> 0.85'
32
+ spec.add_development_dependency 'rubocop-packaging', '~> 0.1'
33
+ spec.add_development_dependency 'rubocop-rspec', '~> 1.39'
34
+ end
data/lib/connectors.rb ADDED
@@ -0,0 +1,7 @@
1
+ require "connectors/version"
2
+ require "connectors/gitlab"
3
+
4
+ module Connectors
5
+ class Error < StandardError; end
6
+ # Your code goes here...
7
+ end
@@ -0,0 +1,3 @@
1
+ module Connectors
2
+ VERSION = "0.1.4"
3
+ end
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peoplegroup-connectors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - lien van den steen
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
11
  date: 2021-02-01 00:00:00.000000000 Z
12
12
  dependencies:
@@ -83,17 +83,14 @@ dependencies:
83
83
  description: Avoid repeating methods in different projects for our connectos.
84
84
  email:
85
85
  - lvandensteen@gitlab.com
86
- executables:
87
- - console
88
- - setup
86
+ executables: []
89
87
  extensions: []
90
88
  extra_rdoc_files: []
91
89
  files:
92
90
  - ".gitignore"
93
91
  - ".gitlab-ci.yml"
94
92
  - ".rspec"
95
- - ".rubocop.yml"
96
- - ".rubocop_todo.yml"
93
+ - ".travis.yml"
97
94
  - CODE_OF_CONDUCT.md
98
95
  - Gemfile
99
96
  - Gemfile.lock
@@ -102,13 +99,10 @@ files:
102
99
  - Rakefile
103
100
  - bin/console
104
101
  - bin/setup
105
- - lib/peoplegroup/connectors.rb
106
- - lib/peoplegroup/connectors/gitlab.rb
107
- - lib/peoplegroup/connectors/version.rb
108
- - peoplegroup-connectors.gemspec
109
- - spec/peoplegroup/connectors/gitlab_spec.rb
110
- - spec/peoplegroup/connectors_spec.rb
111
- - spec/spec_helper.rb
102
+ - connectors.gemspec
103
+ - lib/connectors.rb
104
+ - lib/connectors/gitlab.rb
105
+ - lib/connectors/version.rb
112
106
  homepage: https://gitlab.com/gitlab-com/people-group/peopleops-eng/connectors-gem
113
107
  licenses:
114
108
  - MIT
@@ -131,11 +125,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
125
  - !ruby/object:Gem::Version
132
126
  version: '0'
133
127
  requirements: []
134
- rubygems_version: 3.1.4
128
+ rubygems_version: 3.0.3
135
129
  signing_key:
136
130
  specification_version: 4
137
131
  summary: Library for our shared connectors.
138
- test_files:
139
- - spec/peoplegroup/connectors/gitlab_spec.rb
140
- - spec/peoplegroup/connectors_spec.rb
141
- - spec/spec_helper.rb
132
+ test_files: []
data/.rubocop.yml DELETED
@@ -1,21 +0,0 @@
1
- inherit_from: .rubocop_todo.yml
2
-
3
- require:
4
- - rubocop-rspec
5
- - rubocop-packaging
6
-
7
- AllCops:
8
- TargetRubyVersion: 2.7
9
- # Cop names are displayed in offense messages by default. Change behavior
10
- # by overriding DisplayCopNames, or by giving the `--no-display-cop-names`
11
- # option.
12
- DisplayCopNames: true
13
- # Style guide URLs are not displayed in offense messages by default. Change
14
- # behavior by overriding DisplayStyleGuide, or by giving the
15
- # -S/--display-style-guide option.
16
- DisplayStyleGuide: false
17
- # Exclude some GitLab files
18
- NewCops: enable
19
-
20
- Style/Documentation:
21
- Enabled: false
data/.rubocop_todo.yml DELETED
@@ -1,72 +0,0 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2021-01-29 12:09:47 UTC using RuboCop version 0.93.1.
4
- # The point is for the user to remove these configuration records
5
- # one by one as the offenses are removed from the code base.
6
- # Note that changes in the inspected code, or installation of new
7
- # versions of RuboCop, may require this file to be generated again.
8
-
9
- # Offense count: 1
10
- # Configuration parameters: Include.
11
- # Include: **/*.gemspec
12
- Gemspec/RequiredRubyVersion:
13
- Exclude:
14
- - 'peoplegroup-connectors.gemspec'
15
-
16
- # Offense count: 1
17
- # Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
18
- # ExcludedMethods: refine
19
- Metrics/BlockLength:
20
- Max: 104
21
-
22
- # Offense count: 2
23
- # Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
24
- Metrics/MethodLength:
25
- Max: 22
26
-
27
- # Offense count: 2
28
- # Configuration parameters: CountKeywordArgs.
29
- Metrics/ParameterLists:
30
- Max: 6
31
-
32
- # Offense count: 1
33
- Packaging/GemspecGit:
34
- Exclude:
35
- - 'peoplegroup-connectors.gemspec'
36
-
37
- # Offense count: 1
38
- # Configuration parameters: Max.
39
- RSpec/ExampleLength:
40
- Exclude:
41
- - 'spec/peoplegroup/connectors/gitlab_spec.rb'
42
-
43
- # Offense count: 2
44
- # Configuration parameters: CustomTransform, IgnoreMethods, SpecSuffixOnly.
45
- RSpec/FilePath:
46
- Exclude:
47
- - 'spec/peoplegroup/connectors/gitlab_spec.rb'
48
- - 'spec/peoplegroup/connectors_spec.rb'
49
-
50
- # Offense count: 3
51
- RSpec/MultipleExpectations:
52
- Max: 3
53
-
54
- # Offense count: 5
55
- # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
56
- RSpec/VerifiedDoubles:
57
- Exclude:
58
- - 'spec/peoplegroup/connectors/gitlab_spec.rb'
59
-
60
- # Offense count: 2
61
- # Cop supports --auto-correct.
62
- # Configuration parameters: AllowOnConstant.
63
- Style/CaseEquality:
64
- Exclude:
65
- - 'lib/peoplegroup/connectors/gitlab.rb'
66
-
67
- # Offense count: 6
68
- # Cop supports --auto-correct.
69
- # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
70
- # URISchemes: http, https
71
- Layout/LineLength:
72
- Max: 185
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'connectors/version'
4
- require_relative 'connectors/gitlab'
5
-
6
- module PeopleGroup
7
- module Connectors
8
- class Error < StandardError; end
9
- end
10
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module PeopleGroup
4
- module Connectors
5
- VERSION = '0.1.3'
6
- end
7
- end
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'lib/peoplegroup/connectors/version'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = 'peoplegroup-connectors'
7
- spec.version = PeopleGroup::Connectors::VERSION
8
- spec.authors = ['lien van den steen']
9
- spec.email = ['lvandensteen@gitlab.com']
10
-
11
- spec.summary = 'Library for our shared connectors.'
12
- spec.description = 'Avoid repeating methods in different projects for our connectos.'
13
- spec.homepage = 'https://gitlab.com/gitlab-com/people-group/peopleops-eng/connectors-gem'
14
- spec.license = 'MIT'
15
- spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
16
-
17
- spec.metadata['homepage_uri'] = spec.homepage
18
- spec.metadata['source_code_uri'] = spec.homepage
19
- spec.metadata['changelog_uri'] = spec.homepage
20
-
21
- spec.files = `git ls-files -z`.split("\x0")
22
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
23
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
24
- spec.require_paths = ['lib']
25
-
26
- spec.add_dependency 'gitlab'
27
-
28
- spec.add_development_dependency 'rspec', '~> 3.2'
29
- spec.add_development_dependency 'rubocop', '~> 0.85'
30
- spec.add_development_dependency 'rubocop-packaging', '~> 0.1'
31
- spec.add_development_dependency 'rubocop-rspec', '~> 1.39'
32
- end
@@ -1,125 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe PeopleGroup::Connectors::GitLab do
4
- let(:gitlab_members) { spy }
5
- let(:gitlab_mock) do
6
- instance_double(
7
- Gitlab::Client,
8
- group_members: gitlab_members,
9
- create_issue: true,
10
- issues: double(auto_paginate: true),
11
- create_issue_note: true,
12
- create_epic: true,
13
- epics: double(auto_paginate: []),
14
- create_branch: true,
15
- create_merge_request: true,
16
- create_commit: true,
17
- create_epic_note: true,
18
- epic_issues: double(auto_paginate: []),
19
- edit_epic: true
20
- )
21
- end
22
-
23
- before do
24
- allow(Gitlab).to receive(:client).and_return(gitlab_mock)
25
- end
26
-
27
- describe '#find_gitlabber' do
28
- context 'when given empty query' do
29
- it 'returns nil' do
30
- expect(described_class.new.find_gitlabber(:username, nil)).to be_nil
31
- end
32
- end
33
-
34
- context 'when given non-empty query' do
35
- it 'calls correct method with proper args' do
36
- described_class.new.find_gitlabber(:name, 'john')
37
-
38
- expect(gitlab_mock).to have_received(:group_members).with('gitlab-com', query: 'john')
39
- expect(gitlab_members).to have_received(:find)
40
- end
41
- end
42
- end
43
-
44
- describe '#create_issue' do
45
- it 'calls correct method with proper args' do
46
- described_class.new.create_issue('foo/bar', 'My Issue Title', assignee_id: 123_456)
47
- expect(gitlab_mock).to have_received(:create_issue).with('foo/bar', 'My Issue Title', assignee_id: 123_456)
48
- end
49
- end
50
-
51
- describe '#get_onboarding_issues' do
52
- it 'uses specified arguments' do
53
- described_class.new.get_onboarding_issues('foo/bar', per_page: 500)
54
-
55
- expect(gitlab_mock).to have_received(:issues).with('foo/bar', per_page: 500)
56
- end
57
- end
58
-
59
- describe '#create_issue_note' do
60
- it 'calls correct method with proper args' do
61
- described_class.new.create_issue_note('foo/bar', 15, 'My issue comment')
62
-
63
- expect(gitlab_mock).to have_received(:create_issue_note).with('foo/bar', 15, 'My issue comment')
64
- end
65
- end
66
-
67
- describe '#find_or_create_epic' do
68
- it 'calls correct method with proper args' do
69
- described_class.new.find_or_create_epic(123, 'My Epic Title', assignee_id: 123_456)
70
- expect(gitlab_mock).to have_received(:create_epic).with(123, 'My Epic Title', { assignee_id: 123_456, confidential: true })
71
- end
72
-
73
- context 'when the epic was closed' do
74
- before do
75
- allow(gitlab_mock).to receive(:epics).and_return(double(auto_paginate: [double(iid: 1, group_id: 2, web_url: 'foo.bar/issues/1', state: 'closed', title: 'Existing Epic')]))
76
- end
77
-
78
- it 'reopens the epic' do
79
- described_class.new.find_or_create_epic(2, 'Existing Epic', assignee_id: 123_456)
80
- expect(gitlab_mock).not_to have_received(:create_epic)
81
- expect(gitlab_mock).to have_received(:edit_epic).with(2, 1, state_event: 'reopen')
82
- end
83
- end
84
- end
85
-
86
- describe '#commit_change_to_new_merge_request' do
87
- it 'calls correct method with proper args' do
88
- described_class.new.commit_change_to_new_merge_request(123, 'my-new-branch', 'foo/bar.md', 'the changed text', 'my commit message')
89
- expect(gitlab_mock).to have_received(:create_branch).with(123, 'my-new-branch', 'master')
90
- action = {
91
- action: 'update',
92
- file_path: 'foo/bar.md',
93
- content: 'the changed text'
94
- }
95
- expect(gitlab_mock).to have_received(:create_commit).with(123, 'my-new-branch', 'my commit message', [action])
96
- expect(gitlab_mock).to have_received(:create_merge_request).with(123, 'my commit message', { source_branch: 'my-new-branch', target_branch: 'master', remove_source_branch: true })
97
- end
98
- end
99
-
100
- describe '#get_epics' do
101
- it 'calls correct method with proper args' do
102
- described_class.new.get_epics(123)
103
- expect(gitlab_mock).to have_received(:epics).with(123, {})
104
- end
105
-
106
- it 'calls correct method with proper args when you add options' do
107
- described_class.new.get_epics(123, state: 'opened')
108
- expect(gitlab_mock).to have_received(:epics).with(123, { state: 'opened' })
109
- end
110
- end
111
-
112
- describe '#get_issue_epics' do
113
- it 'calls correct method with proper args' do
114
- described_class.new.get_issue_epics(123, 7)
115
- expect(gitlab_mock).to have_received(:epic_issues).with(123, 7)
116
- end
117
- end
118
-
119
- describe '#create_epic_note' do
120
- it 'calls correct method with proper args' do
121
- described_class.new.create_epic_note(123, 7, 'My epic note')
122
- expect(gitlab_mock).to have_received(:create_epic_note).with(123, 7, 'My epic note')
123
- end
124
- end
125
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe PeopleGroup::Connectors do
4
- it 'has a version number' do
5
- expect(PeopleGroup::Connectors::VERSION).not_to be nil
6
- end
7
- end
data/spec/spec_helper.rb DELETED
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'peoplegroup/connectors'
4
-
5
- RSpec.configure do |config|
6
- # Enable flags like --only-failures and --next-failure
7
- config.example_status_persistence_file_path = '.rspec_status'
8
-
9
- # Disable RSpec exposing methods globally on `Module` and `main`
10
- config.disable_monkey_patching!
11
-
12
- config.filter_run focus: true
13
- config.run_all_when_everything_filtered = true
14
-
15
- config.expect_with :rspec do |c|
16
- c.syntax = :expect
17
- end
18
- end