Class: Bundler::Plugin::VaultSource

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler/plugin/vault_source.rb

Overview

Bundler plugin source that installs gems from a .gemv vault file.

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ VaultSource

Returns a new instance of VaultSource.



8
9
10
11
# File 'lib/bundler/plugin/vault_source.rb', line 8

def initialize(opts)
  super
  @vault_path = resolve_vault_path(@uri)
end

Instance Method Details

#cache(spec, custom_path = nil) ⇒ Object

No source-level install_path to copy: VaultSource#install installs each gem into Bundler.bundle_path via RubyGemsGemInstaller, so the default Source#cache would dereference a non-existent directory.



37
# File 'lib/bundler/plugin/vault_source.rb', line 37

def cache(spec, custom_path = nil); end

#fetch_gemspec_filesObject



13
14
15
16
17
18
19
# File 'lib/bundler/plugin/vault_source.rb', line 13

def fetch_gemspec_files
  validate_vault_exists!

  Gemvault::Vault.open(@vault_path) do |vault|
    vault.gem_entries.map { |entry| gemspec_file_for(vault, entry) }
  end
end

#install(spec, opts = {}) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/bundler/plugin/vault_source.rb', line 21

def install(spec, opts = {})
  gem_dir = gem_dir_for(spec.full_name)
  return use_installed_gem(spec, gem_dir) if File.directory?(gem_dir) && !opts[:force]

  Bundler.ui.confirm "Installing #{version_message(spec)} from vault #{@uri}"
  install_into_bundle(spec, opts)
  spec.post_install_message
end

#options_to_lockObject



30
31
32
# File 'lib/bundler/plugin/vault_source.rb', line 30

def options_to_lock
  {}
end

#to_sObject



39
40
41
# File 'lib/bundler/plugin/vault_source.rb', line 39

def to_s
  "vault at #{@uri}"
end