How to create a gem
· One min read
Creating a Template
bundle gem <GEM Name> -t
cd <GEM Name>
Editing the Gemspec
- Open
<GEM Name>.gemspec. - Edit
spec.summary,spec.description,spec.homepage, - Write the homepage URL to
spec.metadata["allowed_push_host"] - Write the Gem's page to
spec.homepage - Write the repository URL to
spec.metadata["source_code_uri"] - Write the URL of
changelog.mdtospec.metadata["changelog_uri"]
Set at least this much.
Push to GitHub and Install
git init
git add .
git commit -m First Commit
git remote add origin [email protected]:<username>/<GEM Name>.git
git push -u origin master
Install
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
