class Bundler::Plugin::API

Public Class Methods

command(command, cls = self) click to toggle source

The plugins should declare that they handle a command through this helper.

@param [String] command being handled by them @param [Class] (optional) class that handles the command. If not

provided, the `self` class will be used.
# File bundler/plugin/api.rb, line 33
def self.command(command, cls = self)
  Plugin.add_command command, cls
end
hook(event, &block) click to toggle source
# File bundler/plugin/api.rb, line 48
def self.hook(event, &block)
  Plugin.add_hook(event, &block)
end
source(source, cls = self) click to toggle source

The plugins should declare that they provide a installation source through this helper.

@param [String] the source type they provide @param [Class] (optional) class that handles the source. If not

provided, the `self` class will be used.
# File bundler/plugin/api.rb, line 43
def self.source(source, cls = self)
  cls.send :include, Bundler::Plugin::API::Source
  Plugin.add_source source, cls
end

Public Instance Methods

cache_dir() click to toggle source

The cache dir to be used by the plugins for storage

@return [Pathname] path of the cache dir

# File bundler/plugin/api.rb, line 55
def cache_dir
  Plugin.cache.join("plugins")
end
method_missing(name, *args, &blk) click to toggle source
Calls superclass method
# File bundler/plugin/api.rb, line 67
def method_missing(name, *args, &blk)
  return Bundler.send(name, *args, &blk) if Bundler.respond_to?(name)

  return SharedHelpers.send(name, *args, &blk) if SharedHelpers.respond_to?(name)

  super
end
respond_to_missing?(name, include_private = false) click to toggle source
Calls superclass method
# File bundler/plugin/api.rb, line 75
def respond_to_missing?(name, include_private = false)
  SharedHelpers.respond_to?(name, include_private) ||
    Bundler.respond_to?(name, include_private) || super
end
tmp(*names) click to toggle source

A tmp dir to be used by plugins Accepts names that get concatenated as suffix

@return [Pathname] object for the new directory created

# File bundler/plugin/api.rb, line 63
def tmp(*names)
  Bundler.tmp(["plugin", *names].join("-"))
end