Skip to content

Commit 410e0cd

Browse files
author
Alex Evanczuk
authored
Change Teams to CodeTeams (#5)
* correct org name * change name to code_teams * Rename Teams to CodeTeams * bump major version * rename gemspec
1 parent 3cadc4d commit 410e0cd

File tree

11 files changed

+39
-40
lines changed

11 files changed

+39
-40
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
See https://github.com/bigrails/bigrails-teams/releases
1+
See https://github.com/rubyatscale/code_teams/releases

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
source 'https://rubygems.org'
22

3-
# Specify your gem's dependencies in teams.gemspec
3+
# Specify your gem's dependencies in code_teams.gemspec
44
gemspec

Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
bigrails-teams (0.1.1)
4+
code_teams (1.0.0)
55
sorbet-runtime
66

77
GEM
@@ -47,7 +47,7 @@ PLATFORMS
4747
x86_64-linux
4848

4949
DEPENDENCIES
50-
bigrails-teams!
50+
code_teams!
5151
pry
5252
rake
5353
rspec (~> 3.0)

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
# Teams
1+
# CodeTeams
22

3-
This gem is a simple, low-dependency, plugin-based manager for engineering teams within a codebase.
3+
This gem is a simple, low-dependency, plugin-based manager for teams within a codebase.
44

55
## Usage
66

7-
To use teams, add YML files in `config/teams` that start with structure:
7+
To use `code_teams`, add YML files in `config/teams` that start with structure:
88
`config/teams/my_team.yml`
99
```yml
1010
name: My Team
1111
```
1212
13-
`teams` leverages a plugin system because every organization's team practices are different. Say your organization uses GitHub and wants to ensure every team YML files has a GitHub owner. To do this, you create a plugin:
13+
`code_teams` leverages a plugin system because every organization's team practices are different. Say your organization uses GitHub and wants to ensure every team YML files has a GitHub owner. To do this, you create a plugin:
1414

1515
```ruby
16-
class MyGithubPlugin < Teams::Plugin
16+
class MyGithubPlugin < CodeTeams::Plugin
1717
extend T::Sig
1818
extend T::Helpers
1919
@@ -36,7 +36,7 @@ class MyGithubPlugin < Teams::Plugin
3636
members.include?(user)
3737
end
3838
39-
sig { override.params(teams: T::Array[Teams::Team]).returns(T::Array[String]) }
39+
sig { override.params(teams: T::Array[CodeTeams::Team]).returns(T::Array[String]) }
4040
def self.validation_errors(teams)
4141
errors = T.let([], T::Array[String])
4242
@@ -61,7 +61,7 @@ github:
6161

6262
1) You can now use the following API to get GitHub information about that team:
6363
```ruby
64-
team = Teams.find('My Team')
64+
team = CodeTeams.find('My Team')
6565
MyGithubPlugin.for(team).github
6666
```
6767
2) Running team validations (see below) will ensure all teams have a GitHub team specified
@@ -76,8 +76,8 @@ Your plugins can be as simple or as complex as you want. Here are some other thi
7676
## Configuration
7777
You'll want to ensure that all teams are valid in your CI environment. We recommend running code like this in CI:
7878
```ruby
79-
require 'teams'
80-
errors = ::Teams.validation_errors(::Teams.all)
79+
require 'code_teams'
80+
errors = ::CodeTeams.validation_errors(::CodeTeams.all)
8181
if errors.any?
8282
abort <<~ERROR
8383
Team validation failed with the following errors:

teams.gemspec renamed to code_teams.gemspec

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
Gem::Specification.new do |spec|
2-
spec.name = 'bigrails-teams'
3-
spec.version = '0.1.1'
2+
spec.name = 'code_teams'
3+
spec.version = '1.0.0'
44
spec.authors = ['Gusto Engineers']
55
spec.email = ['dev@gusto.com']
66
spec.summary = 'A low-dependency gem for declaring and querying engineering teams'
77
spec.description = 'A low-dependency gem for declaring and querying engineering teams'
8-
spec.homepage = 'https://github.com/bigrails/bigrails-teams'
8+
spec.homepage = 'https://github.com/rubyatscale/code_teams'
99
spec.license = 'MIT'
1010

1111
if spec.respond_to?(:metadata)
1212
spec.metadata['homepage_uri'] = spec.homepage
13-
spec.metadata['source_code_uri'] = 'https://github.com/bigrails/bigrails-teams'
14-
spec.metadata['changelog_uri'] = 'https://github.com/bigrails/bigrails-teams/releases'
13+
spec.metadata['source_code_uri'] = 'https://github.com/rubyatscale/code_teams'
14+
spec.metadata['changelog_uri'] = 'https://github.com/rubyatscale/code_teams/releases'
1515
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
1616
else
1717
raise 'RubyGems 2.0 or newer is required to protect against ' \

lib/bigrails-teams.rb

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/teams.rb renamed to lib/code_teams.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
require 'set'
77
require 'pathname'
88
require 'sorbet-runtime'
9-
require 'teams/plugin'
10-
require 'teams/plugins/identity'
9+
require 'code_teams/plugin'
10+
require 'code_teams/plugins/identity'
1111

12-
module Teams
12+
module CodeTeams
1313
extend T::Sig
1414

1515
class IncorrectPublicApiUsageError < StandardError; end
@@ -24,7 +24,7 @@ def self.all
2424

2525
sig { params(name: String).returns(T.nilable(Team)) }
2626
def self.find(name)
27-
@index_by_name = T.let(@index_by_name, T.nilable(T::Hash[String, Teams::Team]))
27+
@index_by_name = T.let(@index_by_name, T.nilable(T::Hash[String, CodeTeams::Team]))
2828
@index_by_name ||= begin
2929
result = {}
3030
all.each { |t| result[t.name] = t }
@@ -57,7 +57,7 @@ def self.tag_value_for(string)
5757

5858
# Generally, you should not ever need to do this, because once your ruby process loads, cached content should not change.
5959
# Namely, the YML files that are the source of truth for teams should not change, so we should not need to look at the YMLs again to verify.
60-
# The primary reason this is helpful is for clients of Teams who want to test their code, and each test context has different set of teams
60+
# The primary reason this is helpful is for clients of CodeTeams who want to test their code, and each test context has different set of teams
6161
sig { void }
6262
def self.bust_caches!
6363
@all = nil
@@ -109,12 +109,12 @@ def name
109109

110110
sig { returns(String) }
111111
def to_tag
112-
Teams.tag_value_for(name)
112+
CodeTeams.tag_value_for(name)
113113
end
114114

115115
sig { params(other: Object).returns(T::Boolean) }
116116
def ==(other)
117-
if other.is_a?(Teams::Team)
117+
if other.is_a?(CodeTeams::Team)
118118
self.name == other.name
119119
else
120120
false

lib/teams/plugin.rb renamed to lib/code_teams/plugin.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# typed: strict
22

3-
module Teams
3+
module CodeTeams
44
# Plugins allow a client to add validation on custom keys in the team YML.
55
# For now, only a single plugin is allowed to manage validation on a top-level key.
66
# In the future we can think of allowing plugins to be gracefully merged with each other.

lib/teams/plugins/identity.rb renamed to lib/code_teams/plugins/identity.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# typed: true
22

3-
module Teams
3+
module CodeTeams
44
module Plugins
55
class Identity < Plugin
66
extend T::Sig
@@ -15,7 +15,7 @@ def identity
1515
)
1616
end
1717

18-
sig { override.params(teams: T::Array[Teams::Team]).returns(T::Array[String]) }
18+
sig { override.params(teams: T::Array[CodeTeams::Team]).returns(T::Array[String]) }
1919
def self.validation_errors(teams)
2020
errors = T.let([], T::Array[String])
2121

spec/lib/teams_spec.rb renamed to spec/lib/code_teams_spec.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
RSpec.describe 'Teams' do
1+
RSpec.describe CodeTeams do
22
let(:team_yml) do
33
<<~YML.strip
44
name: My Team
@@ -7,14 +7,14 @@
77

88
before do
99
write_file('config/teams/my_team.yml', team_yml)
10-
Teams.bust_caches!
11-
allow(Teams::Plugin).to receive(:registry).and_return({})
10+
CodeTeams.bust_caches!
11+
allow(CodeTeams::Plugin).to receive(:registry).and_return({})
1212
end
1313

1414
describe '.all' do
1515
it 'correctly parses the team files' do
16-
expect(Teams.all.count).to eq 1
17-
team = Teams.all.first
16+
expect(CodeTeams.all.count).to eq 1
17+
team = CodeTeams.all.first
1818
expect(team.name).to eq 'My Team'
1919
expect(team.raw_hash['name']).to eq 'My Team'
2020
expect(team.config_yml).to eq 'config/teams/my_team.yml'
@@ -29,16 +29,16 @@
2929
end
3030

3131
it 'spits out a helpful error message' do
32-
expect { Teams.all }.to raise_error do |e|
33-
expect(e).to be_a Teams::IncorrectPublicApiUsageError
32+
expect { CodeTeams.all }.to raise_error do |e|
33+
expect(e).to be_a CodeTeams::IncorrectPublicApiUsageError
3434
expect(e.message).to eq('The YML in config/teams/my_team.yml has a syntax error!')
3535
end
3636
end
3737
end
3838
end
3939

4040
describe 'validation_errors' do
41-
subject(:validation_errors) { Teams.validation_errors(Teams.all) }
41+
subject(:validation_errors) { CodeTeams.validation_errors(CodeTeams.all) }
4242

4343
context 'there is one definition for all teams' do
4444
it 'has no errors' do
@@ -63,8 +63,8 @@
6363

6464
describe '==' do
6565
it 'handles nil correctly' do
66-
expect(Teams.all.first == nil).to eq false # rubocop:disable Style/NilComparison
67-
expect(nil == Teams.all.first).to eq false
66+
expect(CodeTeams.all.first == nil).to eq false # rubocop:disable Style/NilComparison
67+
expect(nil == CodeTeams.all.first).to eq false
6868
end
6969
end
7070
end

0 commit comments

Comments
 (0)