code.gitea.io/gitea@v1.22.3/docs/content/usage/packages/rubygems.en-us.md (about) 1 --- 2 date: "2021-07-20T00:00:00+00:00" 3 title: "RubyGems Package Registry" 4 slug: "rubygems" 5 sidebar_position: 110 6 draft: false 7 toc: false 8 menu: 9 sidebar: 10 parent: "packages" 11 name: "RubyGems" 12 sidebar_position: 110 13 identifier: "rubygems" 14 --- 15 16 # RubyGems Package Registry 17 18 Publish [RubyGems](https://guides.rubygems.org/) packages for your user or organization. 19 20 ## Requirements 21 22 To work with the RubyGems package registry, you need to use the [gem](https://guides.rubygems.org/command-reference/) command line tool to consume and publish packages. 23 24 ## Configuring the package registry 25 26 To register the package registry edit the `~/.gem/credentials` file and add: 27 28 ```ini 29 --- 30 https://gitea.example.com/api/packages/{owner}/rubygems: Bearer {token} 31 ``` 32 33 | Parameter | Description | 34 | ------------- | ----------- | 35 | `owner` | The owner of the package. | 36 | `token` | Your [personal access token](development/api-usage.md#authentication). | 37 38 For example: 39 40 ``` 41 --- 42 https://gitea.example.com/api/packages/testuser/rubygems: Bearer 3bd626f84b01cd26b873931eace1e430a5773cc4 43 ``` 44 45 ## Publish a package 46 47 Publish a package by running the following command: 48 49 ```shell 50 gem push --host {host} {package_file} 51 ``` 52 53 | Parameter | Description | 54 | -------------- | ----------- | 55 | `host` | URL to the package registry. | 56 | `package_file` | Path to the package `.gem` file. | 57 58 For example: 59 60 ```shell 61 gem push --host https://gitea.example.com/api/packages/testuser/rubygems test_package-1.0.0.gem 62 ``` 63 64 You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. 65 66 ## Install a package 67 68 To install a package from the package registry you can use [Bundler](https://bundler.io) or `gem`. 69 70 ### Bundler 71 72 Add a new `source` block to your `Gemfile`: 73 74 ``` 75 source "https://gitea.example.com/api/packages/{owner}/rubygems" do 76 gem "{package_name}" 77 end 78 ``` 79 80 | Parameter | Description | 81 | ----------------- | ----------- | 82 | `owner` | The owner of the package. | 83 | `package_name` | The package name. | 84 85 For example: 86 87 ``` 88 source "https://gitea.example.com/api/packages/testuser/rubygems" do 89 gem "test_package" 90 end 91 ``` 92 93 Afterwards run the following command: 94 95 ```shell 96 bundle install 97 ``` 98 99 ### gem 100 101 Execute the following command: 102 103 ```shell 104 gem install --host https://gitea.example.com/api/packages/{owner}/rubygems {package_name} 105 ``` 106 107 | Parameter | Description | 108 | ----------------- | ----------- | 109 | `owner` | The owner of the package. | 110 | `package_name` | The package name. | 111 112 For example: 113 114 ```shell 115 gem install --host https://gitea.example.com/api/packages/testuser/rubygems test_package 116 ``` 117 118 ## Supported commands 119 120 ``` 121 gem install 122 bundle install 123 gem push 124 ```