This site is a work-in-progress. Some of the information is incomplete and may not work as described. See the homepage for details.

Table of Contents:

Add .rb Files to _plugin Directory

Every time you make a change to your .rb file, you will need to restart the server to see the changes. Plugins are picked up when the server starts and cached (similar to how changes in your _config.yml file aren’t picked up until you restart the server).

Creating a Gem

Using Bundler to Create Plugin Scaffolding

Running bundle gem gem-name will create a new directory called gem-name with some scaffolding. Note that this command will create a directory with the name of the gem. If you want the code to be in ~/projects/gem-name, cd to your projects directory and run the command.

$ bundle gem gem-name
Creating gem 'gem-name'...
Initializing git repo in /home/user/projects/gem-name
      create  gem-name/Gemfile
      create  gem-name/lib/gem/name.rb
      create  gem-name/lib/gem/name/version.rb
      create  gem-name/gem-name.gemspec
      create  gem-name/Rakefile
      create  gem-name/README.md
      create  gem-name/bin/console
      create  gem-name/bin/setup
      create  gem-name/.gitignore
      create  gem-name/CHANGELOG.md
      create  gem-name/.rubocop.yml
Gem 'gem-name' was successfully created. For more information on making a RubyGem visit https://bundler.io/guides/creating_gem.html

Note that Bundler splits the gem name at hyphens. This is intentional and used for creating namespaces. You can read more about that on RubyGem’s Guide on Naming.