I came across Rails issue #3153 on Github which involved someone thinking
bundle install didn’t work with Rails generators.
When working with Rails generators it’s important to remember that generators use Yehuda Katz’s Thor gem. The issue arose because the user tried to run the command
bundle install from inside the directory in which the generator file had been created.
1 2 3 4 5 6 7 8
Again, the issue is that the command
bundle install is being run from inside the directory
Issue3153/lib/generators/something/. I’ll let you take a quick look at the Thor source code at lib/thor/actions.rb. As you have now seen, we can use the
inside method to run the
bundle install command from the root directory of our app Issue3153.
1 2 3 4 5 6 7 8 9 10 11
This now works!
- Rails generators use Thor Actions
- The bundle install command must be run in the directory where the Gemfile of interest resides