Module: Bundler::Github::DslPatch

Defined in:
lib/bundler/github/dsl_patch.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(mod) ⇒ Object



20
21
22
23
# File 'lib/bundler/github/dsl_patch.rb', line 20

def self.included(mod)
  mod.send :alias_method, :_normalize_options_without_github, :_normalize_options
  mod.send :alias_method, :_normalize_options, :_normalize_options_with_github
end

Instance Method Details

#_normalize_options_with_github(*args) ⇒ Object

The list of valid options is buried in this original method, so to add an option without reimplementing (and duplicating) code, we rescue the exception, and swap our :github option for :git, with the expanded URI



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/bundler/github/dsl_patch.rb', line 7

def _normalize_options_with_github(*args)
  begin
    _normalize_options_without_github(*args)
  rescue Bundler::InvalidOption => exception
    if exception.message =~ /:github/
      Bundler::Github.expand_options(*args)
      retry
    else
      raise exception
    end
  end
end