如何建立 gem
· 1 分鐘閱讀
建立模板
bundle gem <GEM Name> -t
cd <GEM Name>
編輯 Gemspec
- 開啟
<GEM Name>.gemspec。 - 編輯
spec.summary、spec.description、spec.homepage, - 將首頁 URL 寫入
spec.metadata["allowed_push_host"] - 將 Gem 的頁面寫入
spec.homepage - 將儲存庫 URL 寫入
spec.metadata["source_code_uri"] - 將
changelog.md的 URL 寫入spec.metadata["changelog_uri"]
至少需要設定上述內容。
推送到 GitHub 並安裝
git init
git add .
git commit -m First Commit
git remote add origin [email protected]:<username>/<GEM Name>.git
git push -u origin master
安裝
gem install specific_instal
gem specific_install -l "git://github.com/<username>/<GEM Name>.git"
Gemfile
gem "<GEM Name>", github: "<username>/<GEM Name>.git", branch: :main
読み込み中...