require 'bundler/setup' require 'alki/bin'
Creating executables with Alki is very straightforward. Below are some guidelines for how to do so.
Without a gemspec
If your project isn’t a gem, and doesn’t have a gemspec, executables should go in
bin and should include these two
require-ing any other files.
After that you can use your library.
require 'bundler/setup' require 'alki/bin' require 'my_project' MyProject.new.cli.run
$ bin/my_exe ...
With a gemspec
If your project is a gem, it should be done differently.
First, in your gemspec, set the
bindir option to
'bin'). Also if automatically setting
executables option, make sure it is looking for files in
This is done to avoid collisions between your raw executable files, and binstubs generated by bundler.
Executables should be placed in
Finally, once your gemspec is setup, run
bundle binstubs <gem name> where
<gem name> is whatever
spec.name to in your gemspec.
Once done, you should have binstubs in
bin for each executable you have in
exe. These are what you
should run for testing/development. If you add new executables to
exe, just run
bundle install to
generate new binstubs for them.
Second, executables in
exe shouldn’t require any extra files other then the project files they need to
run (do not require
require 'my_gem' MyGem.new.cli.run
$ bundle binstubs my_gem $ bin/my_exe ...