Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

Updating Teams

Emma Sax edited this page Jan 11, 2016 · 1 revision

Sometimes the teams for an organization change and switch around. In this case, it's beneficial to be able to update the teams that Hubstats is following and to move the users of the organization to new teams. In this case, it's important to make changes in the right order to ensure that Hubstats is following the correct teams.

  1. Firstly, on GitHub, make your new team, if necessary, and add users to this team. You may take users off of the old teams as well. If simple updates of names of teams or users of teams are necessary, then just move the users around on GitHub and rename teams as necessary.
  2. Then, update your whitelist of teams (probably found in test/dummy/config/octokit.yml). Take any teams you are discontinuing off the list, and add any necessary teams. If teams were renamed, then change the name of the team on the whitelist as well.
  3. Thirdly, run the rake command rake hubstats:update_teams_from_file. This will look at your updated whitelist and your database and will check that every team in the database (where the hubstats boolean is set to true) is on the whitelist. If there's a team on the database that isn't on the whitelist (your discontinued team), then it will set the hubstats boolean to false. Although this will keep the team on the database entirely, setting this boolean to false will make it so that the team will be ignored for future use. If a team was renamed, then that'll be fixed next...
  4. Now, run rake hubstats:update_teams. This will go back to GitHub and take any new/renamed/updated teams on GitHub. If the team isn't on the database, it will add it there. If a team was renamed, this command will treat the team as new (since it was set to false in the previous command under the old name). It will update all of the users on the teams as well. Now, things should be fully updated!

Note that the rake hubstats:update_teams command will ignore any teams that are not on the whitelist. Therefore, it's imperative that the whitelist remains up to date on what teams you want Hubstats to be following. If it isn't on the whitelist, then Hubstats won't care.

Best of luck with your team management!