First of all, isolate your custom generator to a separated engine, so you can add this excerpt to "script/rails" or "bin/rails", depending on rails version, in the engine which you want the generators available:
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
then add rails, your custom generator gem and all dependencies to the Gemfile of your engine
gem 'rails', '~> 4.0.2'
gem 'my_custom_generator', :path => "/path/to/my_custom_generator"