I'm building a CLI gem with Ruby using Thor. I run rake install which runs rake build then the task to install the gem locally. However when I try to run it in the commandline, it cannot locate the command. The gem is called smokestack so theoretically I should be able to run it in terminal once it's installed.
Structure:
├── CODE_OF_CONDUCT.md
├── Gemfile
├── Gemfile.lock
├── LICENSE.txt
├── README.md
├── Rakefile
├── bin
│ ├── console
│ ├── setup
│ └── smokestack
├── lib
│ ├── smokestack
│ │ ├── build.rb
│ │ ├── cli.rb
│ │ └── version.rb
│ └── smokestack.rb
├── pkg
│ └── smokestack-0.1.0.gem
├── smokestack.gemspec
└── test
├── build_test.rb
├── smokestack_test.rb
└── test_helper.rb
bin/smokestack:
#!/usr/bin/env ruby -wU
require 'smokestack'
Smokestack::Cli.start(ARGV)
You can see in the tree the pkg folder from when I ran rake install.
Here's the result when I run that:
smokestack 0.1.0 built to pkg/smokestack-0.1.0.gem.
smokestack (0.1.0) installed.
I then run smokestack in my terminal and get the error: zsh: command not found: smokestack
I've also tried gem install --local ~/path/to/gem/pkg/gem.gem
Result:
Successfully installed smokestack-0.1.0
Parsing documentation for smokestack-0.1.0
Done installing documentation for smokestack after 0 seconds
1 gem installed
This results in the same 'command not found error'.
Question How am I supposed to run this CLI locally to test it out during development?
It ideally interacts with the current project it's in, so just running bundle exec bin/smokestack inside of it's own directory won't yield the results I need properly. It should be a system CLI anyway right?
Here is the repo for additional context if necessary.