Class: BundlerSourcePathext::PathExtSource

Inherits:
Bundler::Source
  • Object
show all
Defined in:
lib/bundler-source-pathext.rb

Instance Method Summary collapse

Instance Method Details

#cached!Object



60
# File 'lib/bundler-source-pathext.rb', line 60

def cached!; end

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

Called by Bundler once per gem that gets installed from this source.

Note that opts are the install options passed in by Bundler (:build_args, :previous_spec, ...), whereas options are the source options that came from the Gemfile or the lockfile.



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/bundler-source-pathext.rb', line 18

def install(spec, opts = {})
  using_message = "Using #{version_message(spec, opts[:previous_spec])} from #{self}"
  using_message += " and installing its executables" unless spec.executables.empty?
  print_using_message using_message

  # Bundler's installer would build the extensions into the regular extension
  # directory, we build them ourselves below instead
  generate_bin(spec, disable_extensions: true)

  build_local_extensions(spec, opts[:build_args])

  nil # no post-install message
end

#local!Object

The gems are always used in place, so there is nothing to fetch, cache or refresh here - all of these are intentional no-ops:

local! - fetch the specs and install from the local system remote! - fetch the specs and install from a remote path cached! - fetch the specs and install from app_cache_path unlock! - refresh the cache/specs (e.g. git sources make a fresh clone)



58
# File 'lib/bundler-source-pathext.rb', line 58

def local!; end

#remote!Object



59
# File 'lib/bundler-source-pathext.rb', line 59

def remote!; end

#specsObject

Bundler plugin api, we need to return a Bundler::Index



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/bundler-source-pathext.rb', line 33

def specs
  # A relative path in the Gemfile is relative to the Gemfile itself (i.e.
  # the bundler root), and not to the directory bundler was run from
  files = Dir.glob(File.join(File.expand_path(uri, root), '*.gemspec'))

  Bundler::Index.build do |index|
    files.each do |file|
      next unless spec = Bundler.load_gemspec(file)
      spec.installed_by_version = Gem::VERSION
      spec.source = self
      spec.extension_dir = File.join(File.dirname(file), 'tmp', RUBY_PLATFORM, spec.name, RUBY_VERSION)
      Bundler.rubygems.validate(spec)

      index << spec
    end
  end
end

#unlock!Object



61
# File 'lib/bundler-source-pathext.rb', line 61

def unlock!; end