bundler-source-pathext 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -2
- data/bundler-source-pathext.gemspec +1 -1
- data/lib/bundler-source-pathext.rb +46 -3
- metadata +3 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 74f39d19bde0adf306918257f3c5fffb56084f083adbc66e56045f7662cfb445
|
|
4
|
+
data.tar.gz: 4369b733c6b795dc497f8aeaa6477bcd957b72583801a4279e63f0b2d8ca000e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b51052c526b45864b3be82804cd2647eebdf462e73e1220232362d6cf86331b3aee1ecea49c892ae789769f8823027eccb951f8f0f159e3ce09086f648bd890d
|
|
7
|
+
data.tar.gz: d46411773b33d982fb0b03608670cdbca622cb5179e23a3675929989743a7eec943eebde776c16a8e40e5c3dd74d051d86adb196a5b8d7f77949dd607b10991e
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
bundler-source-pathext (0.
|
|
4
|
+
bundler-source-pathext (0.4.1)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
@@ -11,10 +11,11 @@ GEM
|
|
|
11
11
|
PLATFORMS
|
|
12
12
|
arm64-darwin-24
|
|
13
13
|
x86_64-darwin-17
|
|
14
|
+
x86_64-linux
|
|
14
15
|
|
|
15
16
|
DEPENDENCIES
|
|
16
17
|
bundler-source-pathext!
|
|
17
18
|
rake (~> 12.0)
|
|
18
19
|
|
|
19
20
|
BUNDLED WITH
|
|
20
|
-
|
|
21
|
+
4.1.0.beta2
|
|
@@ -10,6 +10,27 @@ class BundlerSourcePathext < Bundler::Plugin::API
|
|
|
10
10
|
HAS_NJOBS = Gem.rubygems_version >= Gem::Version.new("4.0.2")
|
|
11
11
|
|
|
12
12
|
class PathExtSource < Bundler::Source
|
|
13
|
+
# Where each source's relative path is resolved from, keyed by its uri.
|
|
14
|
+
#
|
|
15
|
+
# Bundler builds a source twice: once from the Gemfile, and once from the
|
|
16
|
+
# lockfile, and it keeps the latter (see Definition#converge_sources). The
|
|
17
|
+
# lockfile records nothing but the relative remote, so the rebuilt source
|
|
18
|
+
# cannot tell which Gemfile that path was written in - but the Gemfile is
|
|
19
|
+
# always evaluated before the lockfile is parsed, so the copy that does know
|
|
20
|
+
# leaves the answer here for the copy that doesn't.
|
|
21
|
+
ROOT_PATHS = {}
|
|
22
|
+
|
|
23
|
+
# Bundler hands its own path source the directory that relative paths are
|
|
24
|
+
# resolved against, as "root_path", but it does not do so for plugin sources,
|
|
25
|
+
# so we work it out ourselves below. Accepting the option regardless means we
|
|
26
|
+
# pick it up for free if Bundler ever starts passing it.
|
|
27
|
+
def initialize(opts)
|
|
28
|
+
super
|
|
29
|
+
root_path = opts['root_path'] || declaring_gemfile_dir(caller_locations)
|
|
30
|
+
ROOT_PATHS[uri] = root_path if root_path
|
|
31
|
+
@root_path = ROOT_PATHS[uri] || root
|
|
32
|
+
end
|
|
33
|
+
|
|
13
34
|
# Called by Bundler once per gem that gets installed from this source.
|
|
14
35
|
#
|
|
15
36
|
# Note that `opts` are the install options passed in by Bundler (:build_args,
|
|
@@ -31,9 +52,9 @@ class BundlerSourcePathext < Bundler::Plugin::API
|
|
|
31
52
|
|
|
32
53
|
# Bundler plugin api, we need to return a Bundler::Index
|
|
33
54
|
def specs
|
|
34
|
-
# A relative path in the Gemfile is relative to the Gemfile itself
|
|
35
|
-
#
|
|
36
|
-
files = Dir.glob(File.join(File.expand_path(uri,
|
|
55
|
+
# A relative path in the Gemfile is relative to the Gemfile itself, and not
|
|
56
|
+
# to the directory bundler was run from
|
|
57
|
+
files = Dir.glob(File.join(File.expand_path(uri, @root_path), '*.gemspec'))
|
|
37
58
|
|
|
38
59
|
Bundler::Index.build do |index|
|
|
39
60
|
files.each do |file|
|
|
@@ -62,6 +83,28 @@ class BundlerSourcePathext < Bundler::Plugin::API
|
|
|
62
83
|
|
|
63
84
|
private
|
|
64
85
|
|
|
86
|
+
# Bundler.root is the directory of the Gemfile bundler was pointed at, which
|
|
87
|
+
# is not necessarily the one that declared this source: a wrapper Gemfile
|
|
88
|
+
# that pulls the real one in through eval_gemfile (as the Ruby LSP and
|
|
89
|
+
# Appraisal do) moves the root into its own directory, while the source path
|
|
90
|
+
# still refers to the Gemfile it was written in.
|
|
91
|
+
#
|
|
92
|
+
# Bundler evaluates every Gemfile with `instance_eval(contents, gemfile_path)`,
|
|
93
|
+
# so while a source is being declared the Gemfile is the innermost frame
|
|
94
|
+
# outside of bundler, and its caller is bundler's DSL. Requiring both keeps
|
|
95
|
+
# an ordinary bundler stack from being mistaken for a Gemfile: a source
|
|
96
|
+
# rebuilt from the lockfile has no Gemfile frame, and falls back to the root.
|
|
97
|
+
def declaring_gemfile_dir(locations)
|
|
98
|
+
dsl = Bundler::Dsl.instance_method(:eval_gemfile).source_location.first
|
|
99
|
+
bundler_lib = File.dirname(File.dirname(dsl)) + File::SEPARATOR
|
|
100
|
+
|
|
101
|
+
index = locations.index { |location| !location.path.start_with?(bundler_lib) }
|
|
102
|
+
return if index.nil? || index.zero?
|
|
103
|
+
return unless locations[index - 1].path == dsl
|
|
104
|
+
|
|
105
|
+
File.dirname(File.expand_path(locations[index].path))
|
|
106
|
+
end
|
|
107
|
+
|
|
65
108
|
def build_local_extensions(spec, build_args = nil)
|
|
66
109
|
# Bundler passes in whatever "bundle config build.GEM" is set to, and the
|
|
67
110
|
# source options allow setting build args for all gems of a source
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bundler-source-pathext
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- pganalyze Team
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies: []
|
|
13
12
|
description: Bundler source plugin that works like a path source, but also builds
|
|
14
13
|
the native extensions of the gems it provides, like a remote gem source does.
|
|
@@ -32,7 +31,6 @@ homepage: https://github.com/pganalyze/bundler-path-build-ext
|
|
|
32
31
|
licenses:
|
|
33
32
|
- BSD-3-Clause
|
|
34
33
|
metadata: {}
|
|
35
|
-
post_install_message:
|
|
36
34
|
rdoc_options: []
|
|
37
35
|
require_paths:
|
|
38
36
|
- lib
|
|
@@ -47,8 +45,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
47
45
|
- !ruby/object:Gem::Version
|
|
48
46
|
version: '0'
|
|
49
47
|
requirements: []
|
|
50
|
-
rubygems_version: 3.
|
|
51
|
-
signing_key:
|
|
48
|
+
rubygems_version: 3.6.9
|
|
52
49
|
specification_version: 4
|
|
53
50
|
summary: Bundler source plugin for local gems with native extensions
|
|
54
51
|
test_files: []
|