I want to create a command that extracts a few stats for me. So I’m trying to create a local command in the _plugins
folder.
To start, I added this code in the _plugins/hello.rb
file :
class Hello < Jekyll::Command
class << self
def init_with_program(prog)
prog.command(:hello) do |c|
c.action do |args, options|
Jekyll.logger.info "Hello!"
end
end
end
end
end
and in config.yml
plugins:
- ./_plugins/hello.rb
I can start a server without error, but when I try to launch bundle exec jekyll hello
, I get this error :
fatal: 'jekyll hello' could not be found. You may need to install the jekyll-hello gem or a related gem to be able to use this subcommand.
Is it possible to create a command without a gem ? For me right now, a gem would be overkill, but it feels like I don’t have a choice.