Class: Bundler::Plugin::VaultSource
- Inherits:
-
Object
- Object
- Bundler::Plugin::VaultSource
- Defined in:
- lib/bundler/plugin/vault_source.rb
Overview
Bundler plugin source that installs gems from a .gemv vault file.
Instance Method Summary collapse
-
#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.
- #fetch_gemspec_files ⇒ Object
-
#initialize(opts) ⇒ VaultSource
constructor
A new instance of VaultSource.
- #install(spec, opts = {}) ⇒ Object
- #options_to_lock ⇒ Object
-
#remote! ⇒ Object
Bundler first asks a source, in local mode, which gems are already unpacked so it can tell what still needs installing, then switches to remote mode to resolve and install the rest.
- #to_s ⇒ Object
Constructor Details
#initialize(opts) ⇒ VaultSource
Returns a new instance of VaultSource.
8 9 10 11 12 |
# File 'lib/bundler/plugin/vault_source.rb', line 8 def initialize(opts) super @vault_path = resolve_vault_path(@uri) @allow_remote = false 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.
49 |
# File 'lib/bundler/plugin/vault_source.rb', line 49 def cache(spec, custom_path = nil); end |
#fetch_gemspec_files ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/bundler/plugin/vault_source.rb', line 14 def fetch_gemspec_files validate_vault_exists! Gemvault::Vault.open(@vault_path) do |vault| vault.gem_entries.filter_map { |entry| gemspec_file_for(vault, entry) } end end |
#install(spec, opts = {}) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/bundler/plugin/vault_source.rb', line 33 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 #{(spec)} from vault #{@uri}" install_into_bundle(spec, opts) spec. end |
#options_to_lock ⇒ Object
42 43 44 |
# File 'lib/bundler/plugin/vault_source.rb', line 42 def {} end |
#remote! ⇒ Object
Bundler first asks a source, in local mode, which gems are already unpacked so it can tell what still needs installing, then switches to remote mode to resolve and install the rest. A vault gem is not on the load path until it is unpacked, so advertising one that still lives only inside the archive makes Bundler believe it is installed: it skips the install and the later require fails. Advertise not-yet-unpacked gems only once Bundler has asked for remote specs.
29 30 31 |
# File 'lib/bundler/plugin/vault_source.rb', line 29 def remote! @allow_remote = true end |
#to_s ⇒ Object
51 52 53 |
# File 'lib/bundler/plugin/vault_source.rb', line 51 def to_s "vault at #{@uri}" end |