Class: Bundler::Plugin::VaultSource
- Inherits:
-
Object
- Object
- Bundler::Plugin::VaultSource
- Defined in:
- lib/bundler/plugin/vault_source.rb
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
- #to_s ⇒ Object
Constructor Details
#initialize(opts) ⇒ VaultSource
Returns a new instance of VaultSource.
7 8 9 10 11 |
# File 'lib/bundler/plugin/vault_source.rb', line 7 def initialize(opts) super @vault_path = resolve_vault_path(@uri) validate_vault_exists! 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.
82 |
# File 'lib/bundler/plugin/vault_source.rb', line 82 def cache(spec, custom_path = nil); end |
#fetch_gemspec_files ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/bundler/plugin/vault_source.rb', line 13 def fetch_gemspec_files gemspec_files = [] Gemvault::Vault.open(@vault_path) do |vault| vault.gem_entries.each do |entry| spec = vault.spec_from_blob(entry.name, entry.version, entry.platform) full_name = spec.full_name spec_ruby = spec.to_ruby gem_dir = gem_dir_for(full_name) if File.directory?(gem_dir) gemspec_files << anchor_gemspec(gem_dir, full_name, spec_ruby) else gemspec_dir = File.join(Bundler.tmp("vault_source"), "specifications") FileUtils.mkdir_p(gemspec_dir) gemspec_path = File.join(gemspec_dir, "#{full_name}.gemspec") File.write(gemspec_path, spec_ruby) gemspec_files << gemspec_path end end end gemspec_files end |
#install(spec, opts = {}) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/bundler/plugin/vault_source.rb', line 38 def install(spec, opts = {}) gem_dir = gem_dir_for(spec.full_name) if File.directory?(gem_dir) && !opts[:force] Bundler.ui.debug "Using #{(spec)} from vault #{File.basename(@vault_path)}" gemspec_in_gem = File.join(gem_dir, "#{spec.full_name}.gemspec") spec.full_gem_path = gem_dir spec.loaded_from = gemspec_in_gem return nil end Bundler.ui.confirm "Installing #{(spec)} from vault #{File.basename(@vault_path)}" Gemvault::Vault.open(@vault_path) do |vault| vault.with_gem_file(spec.name, spec.version.to_s, platform: spec.platform.to_s) do |gem_path| require "bundler/rubygems_gem_installer" installer = Bundler::RubyGemsGemInstaller.at( gem_path, install_dir: Bundler.bundle_path.to_s, bin_dir: Bundler.system_bindir.to_s, ignore_dependencies: true, wrappers: true, env_shebang: true, build_args: opts[:build_args] || [], ) installed_spec = installer.install gem_dir = installed_spec.full_gem_path spec.full_gem_path = gem_dir spec.loaded_from = anchor_gemspec(gem_dir, spec.full_name, installed_spec.to_ruby) end end spec. end |
#options_to_lock ⇒ Object
75 76 77 |
# File 'lib/bundler/plugin/vault_source.rb', line 75 def {} end |
#to_s ⇒ Object
84 85 86 |
# File 'lib/bundler/plugin/vault_source.rb', line 84 def to_s "vault at #{@uri}" end |