mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-10-30 22:11:07 +00:00 
			
		
		
		
	This PR cleans up the docs in a way to make them simpler to ingest by our [docs repo](https://gitea.com/gitea/gitea-docusaurus). 1. It includes all of the sed invocations our ingestion did, removing the need to do it at build time. 2. It replaces the shortcode variable replacement method with `@variable@` style, simply for easier sed invocations when required. 3. It removes unused files and moves the docs up a level as cleanup. --------- Signed-off-by: jolheiser <john.olheiser@gmail.com>
		
			
				
	
	
	
	
		
			2.9 KiB
		
	
	
	
	
	
	
	
			
		
		
	
	
			2.9 KiB
		
	
	
	
	
	
	
	
| date | title | slug | sidebar_position | draft | toc | menu | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2021-07-20T00:00:00+00:00 | RubyGems 软件包注册表 | rubygems | 110 | false | false | 
 | 
RubyGems 软件包注册表
为您的用户或组织发布 RubyGems 软件包。
要求
要使用RubyGems软件包注册表,您需要使用 gem 命令行工具来消费和发布软件包。
配置软件包注册表
要注册软件包注册表,请编辑 ~/.gem/credentials 文件并添加:
---
https://gitea.example.com/api/packages/{owner}/rubygems: Bearer {token}
| 参数 | 描述 | 
|---|---|
| owner | 软件包的所有者 | 
| token | 您的个人访问令牌 | 
例如:
---
https://gitea.example.com/api/packages/testuser/rubygems: Bearer 3bd626f84b01cd26b873931eace1e430a5773cc4
发布软件包
通过运行以下命令来发布软件包:
gem push --host {host} {package_file}
| 参数 | 描述 | 
|---|---|
| host | 软件包注册表的URL | 
| package_file | 软件包 .gem文件的路径 | 
例如:
gem push --host https://gitea.example.com/api/packages/testuser/rubygems test_package-1.0.0.gem
如果已经存在相同名称和版本的软件包,您将无法发布软件包。您必须先删除现有的软件包。
安装软件包
要从软件包注册表安装软件包,您可以使用 Bundler 或 gem。
Bundler
在您的 Gemfile 中添加一个新的 source 块:
source "https://gitea.example.com/api/packages/{owner}/rubygems" do
  gem "{package_name}"
end
| 参数 | 描述 | 
|---|---|
| owner | 软件包的所有者 | 
| package_name | 软件包名称 | 
例如:
source "https://gitea.example.com/api/packages/testuser/rubygems" do
  gem "test_package"
end
之后运行以下命令:
bundle install
gem
执行以下命令:
gem install --host https://gitea.example.com/api/packages/{owner}/rubygems {package_name}
| 参数 | 描述 | 
|---|---|
| owner | 软件包的所有者 | 
| package_name | 软件包名称 | 
例如:
gem install --host https://gitea.example.com/api/packages/testuser/rubygems test_package
支持的命令
gem install
bundle install
gem push