diff options
Diffstat (limited to 'doc/development/gemfile.md')
-rw-r--r-- | doc/development/gemfile.md | 66 |
1 files changed, 1 insertions, 65 deletions
diff --git a/doc/development/gemfile.md b/doc/development/gemfile.md index add93e37024..e6275068ea8 100644 --- a/doc/development/gemfile.md +++ b/doc/development/gemfile.md @@ -112,71 +112,7 @@ ourselves, or because we think it would benefit the wider community. Extracting code to a gem also means that we can be sure that the gem does not contain any hidden dependencies on our application code. -In general, we want to think carefully before doing this as there are -also disadvantages: - -### Potential disadvantages - -1. Gems - even those maintained by GitLab - do not necessarily go - through the same [code review process](code_review.md) as the main - Rails application. -1. Extracting the code into a separate project means that we need a - minimum of two merge requests to change functionality: one in the gem - to make the functional change, and one in the Rails app to bump the - version. -1. Our needs for our own usage of the gem may not align with the wider - community's needs. In general, if we are not using the latest version - of our own gem, that might be a warning sign. - -### Create and publish a Ruby gem - -In the case where we do want to extract some library code we've written -to a gem, go through these steps: - -1. Determine a suitable name for the gem. If it's a GitLab-owned gem, prefix - the gem name with `gitlab-`. For example, `gitlab-sidekiq-fetcher`. -1. Create the gem or fork as necessary. -1. Ensure the `gitlab_rubygems` group is an owner of the new gem by running: - - ```shell - gem owner <gem-name> --add gitlab_rubygems - ``` - -1. [Publish the gem to rubygems.org](https://guides.rubygems.org/publishing/#publishing-to-rubygemsorg) -1. Visit `https://rubygems.org/gems/<gem-name>` and verify that the gem published - successfully and `gitlab_rubygems` is also an owner. -1. Start with the code in the Rails application. Here it's fine to have - the code in `lib/` and loaded automatically. We can skip this step if - the step below makes more sense initially. -1. Before extracting to its own project, move the gem to `vendor/gems` and - load it in the `Gemfile` using the `path` option. This gives us a gem - that can be published to RubyGems.org, with its own test suite and - isolated set of dependencies, that is still in our main code tree and - goes through the standard code review process. - - For an example, see the [merge request !57805](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/57805). -1. Once the gem is stable - we have been using it in production for a - while with few, if any, changes - extract to its own project under - the [`gitlab-org/ruby/gems` namespace](https://gitlab.com/gitlab-org/ruby/gems/). - - - To create this project: - 1. Follow the [instructions for new projects](https://about.gitlab.com/handbook/engineering/gitlab-repositories/#creating-a-new-project). - 1. Follow the instructions for setting up a [CI/CD configuration](https://about.gitlab.com/handbook/engineering/gitlab-repositories/#cicd-configuration). - 1. Follow the instructions for [publishing a project](https://about.gitlab.com/handbook/engineering/gitlab-repositories/#publishing-a-project). - - See [issue #325463](https://gitlab.com/gitlab-org/gitlab/-/issues/325463) - for an example. - - In some cases we may want to move a gem to its own namespace. Some - examples might be that it will naturally have more than one project - (say, something that has plugins as separate libraries), or that we - expect non-GitLab-team-members to be maintainers on this project as - well as GitLab team members. - - The latter situation (maintainers from outside GitLab) could also - apply if someone who currently works at GitLab wants to maintain - the gem beyond their time working at GitLab. - -When publishing a gem to RubyGems.org, also note the section on -[gem owners](https://about.gitlab.com/handbook/developer-onboarding/#ruby-gems) -in the handbook. +Read more about [Gems development guidelines](gems.md). ## Upgrade Rails |