Module: Gem

Defined in:
lib/executable-hooks/hooks.rb

Defined Under Namespace

Classes: ExecutableHooks

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#executables_hooksObject (readonly)

Returns the value of attribute executables_hooks.



10
11
12
# File 'lib/executable-hooks/hooks.rb', line 10

def executables_hooks
  @executables_hooks
end

Instance Method Details

#execute(&hook) ⇒ Object



6
7
8
# File 'lib/executable-hooks/hooks.rb', line 6

def execute(&hook)
  @executables_hooks << hook
end

#load_executable_pluginsObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/executable-hooks/hooks.rb', line 14

def load_executable_plugins
  if ENV['RUBYGEMS_LOAD_ALL_PLUGINS']
    load_plugin_files find_files('rubygems_executable_plugin', false)
  else
    begin
      load_plugin_files find_latest_files('rubygems_executable_plugin', false)
    rescue NoMethodError
      load_plugin_files find_files('rubygems_executable_plugin', false)
    end
  end
rescue ArgumentError, NoMethodError
  # old rubygems
  plugins = find_files('rubygems_executable_plugin')

  plugins.each do |plugin|

    # Skip older versions of the GemCutter plugin: Its commands are in
    # RubyGems proper now.

    next if plugin =~ /gemcutter-0\.[0-3]/

    begin
      load plugin
    rescue ::Exception => e
      details = "#{plugin.inspect}: #{e.message} (#{e.class})"
      warn "Error loading RubyGems plugin #{details}"
    end
  end
end