Method: Berkshelf::GithubLocation#initialize

Defined in:
lib/berkshelf/locations/github.rb

#initialize(dependency, options = {}) ⇒ GithubLocation

Returns a new instance of GithubLocation.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/berkshelf/locations/github.rb', line 4

def initialize(dependency, options = {})
  protocol = Berkshelf::Config.instance.github_protocol || :https
  case protocol
  when :ssh
    options[:git] = "git@#{HOST}:#{options.delete(:github)}.git"
  when :https
    options[:git] = "https://#{HOST}/#{options.delete(:github)}.git"
  when :git
    options[:git] = "https://#{HOST}/#{options.delete(:github)}.git"
  else
    # if some bizarre value is provided, treat it as :https
    options[:git] = "https://#{HOST}/#{options.delete(:github)}.git"
  end
  super
end