Skip to content

Instantly share code, notes, and snippets.

@methodmissing
Created December 18, 2008 21:53
Show Gist options
  • Save methodmissing/37681 to your computer and use it in GitHub Desktop.
Save methodmissing/37681 to your computer and use it in GitHub Desktop.
# Returns the path to the rails/init.rb file for the given extension,
# or nil if no gem provides it.
def init_path_for_extension(extension)
return if extension.blank?
return unless spec = Gem.searcher.find(extension.to_s)
returning File.join(spec.full_gem_path, 'rails', 'init.rb') do |path|
return unless File.file?(path)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment