Module: GemPaths::Plugin

Defined in:
lib/gem_paths/plugin.rb

Class Method Summary collapse

Class Method Details

.registerObject

Registers the plugin and adds all needed hooks Will call troubleshoot via the after-install hook if the install does not succeed



10
11
12
13
14
15
16
17
18
19
# File 'lib/gem_paths/plugin.rb', line 10

def register
  return if defined?(@registered) && @registered
  @registered = true
  Bundler::Plugin.add_hook('after-install-all') do |spec_install|
    gem_paths_make_file = (Bundler::SharedHelpers.root + '.bundle' + 'gem_paths.make')
    puts "Updating #{gem_paths_make_file} ..."
    FileUtils.mkdir_p gem_paths_make_file.dirname unless File.directory?(gem_paths_make_file.dirname)
    File.write(gem_paths_make_file, GemPaths::List.to_make.join("\n") + "\n")
  end
end