Class: Gemkeeper::BundlerMirrorConfigurator

Inherits:
Object
  • Object
show all
Defined in:
lib/gemkeeper/bundler_mirror_configurator.rb

Overview

Configures Bundler mirror settings so private gem registries proxy through local Geminabox.

Instance Method Summary collapse

Constructor Details

#initialize(candidates, port:, global:) ⇒ BundlerMirrorConfigurator

Returns a new instance of BundlerMirrorConfigurator.



6
7
8
9
10
# File 'lib/gemkeeper/bundler_mirror_configurator.rb', line 6

def initialize(candidates, port:, global:)
  @remotes = candidates.filter_map { |c| c[:remote] if c[:source_type] == :private_gem }.uniq
  @local_url = "http://localhost:#{port}"
  @scope = global ? "--global" : "--local"
end

Instance Method Details

#configure(output: $stdout) ⇒ Object



12
13
14
15
16
17
# File 'lib/gemkeeper/bundler_mirror_configurator.rb', line 12

def configure(output: $stdout)
  return if @remotes.empty?

  output.puts ""
  @remotes.each { |remote| configure_mirror(remote, output) }
end