devpack 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/lib/devpack.rb +1 -1
- data/lib/devpack/{gem_path.rb → gem_spec.rb} +6 -6
- data/lib/devpack/gems.rb +13 -4
- data/lib/devpack/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9502f5bb5412be236b272450cf30b9410a37676ce9a8ff7a769e01e08ebedc0f
|
4
|
+
data.tar.gz: f96bfcfbd97d530ee6a93ff54a8fef02066e5206c468d50d0ef0e4e8501055bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b94fee5740d2a0a57db65fdb9533d63397f0a1200babc95ea48104789084eab958570d0e659ba76cae1bbfc65e00839ab822ba9ebe300e8edc66d7490d28f266
|
7
|
+
data.tar.gz: 8d05d1b3839e26b658357613fa6f5a3f2c2251aa939aa6ac68b509cc9733530dddf21024933c11b84e52894bd48c7290fc713307b1e1882c04bd1d0b477d7eb6
|
data/CHANGELOG.md
CHANGED
@@ -35,3 +35,7 @@ Add support for initializers. Files located in a `.devpack_initializers` directo
|
|
35
35
|
Show full tracebacks of load errors when `DEVPACK_DEBUG` is set in environment.
|
36
36
|
|
37
37
|
Rename `DISABLE_DEVPACK` environment variable to `DEVPACK_DISABLE` for consistency.
|
38
|
+
|
39
|
+
## 0.2.1
|
40
|
+
|
41
|
+
Fully activate gem on load: add gem spec to `Gem.loaded_specs` and set instance variables `@loaded` and `@activated` to `true`. This mimics `Gem::Specification#activate` to ensure that anything that depends on these characteristics will function as normal.
|
data/README.md
CHANGED
data/lib/devpack.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module Devpack
|
4
4
|
# Locates relevant gemspec for a given gem and provides a full list of paths
|
5
5
|
# for all `require_paths` listed in gemspec.
|
6
|
-
class
|
6
|
+
class GemSpec
|
7
7
|
def initialize(glob, name)
|
8
8
|
@name = name
|
9
9
|
@glob = glob
|
@@ -16,6 +16,10 @@ module Devpack
|
|
16
16
|
.compact.flatten.uniq
|
17
17
|
end
|
18
18
|
|
19
|
+
def gemspec
|
20
|
+
@gemspec ||= Gem::Specification.load(gemspec_path.to_s)
|
21
|
+
end
|
22
|
+
|
19
23
|
private
|
20
24
|
|
21
25
|
def dependency_require_paths(visited)
|
@@ -23,7 +27,7 @@ module Devpack
|
|
23
27
|
next nil if visited.include?(dependency)
|
24
28
|
|
25
29
|
visited << dependency
|
26
|
-
|
30
|
+
GemSpec.new(@glob, name_with_version(dependency)).require_paths(visited)
|
27
31
|
end
|
28
32
|
end
|
29
33
|
|
@@ -44,10 +48,6 @@ module Devpack
|
|
44
48
|
.expand_path
|
45
49
|
end
|
46
50
|
|
47
|
-
def gemspec
|
48
|
-
@gemspec ||= Gem::Specification.load(gemspec_path.to_s)
|
49
|
-
end
|
50
|
-
|
51
51
|
def immediate_require_paths
|
52
52
|
gemspec
|
53
53
|
.require_paths
|
data/lib/devpack/gems.rb
CHANGED
@@ -25,13 +25,22 @@ module Devpack
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def load_gem(name)
|
28
|
-
|
29
|
-
[name, Kernel.require(name)]
|
28
|
+
[name, activate(name)]
|
30
29
|
rescue LoadError => e
|
31
30
|
warn(Messages.failure(name, load_error_message(e)))
|
32
31
|
nil
|
33
32
|
end
|
34
33
|
|
34
|
+
def activate(name)
|
35
|
+
spec = GemSpec.new(gem_glob, name)
|
36
|
+
update_load_path(spec.require_paths)
|
37
|
+
loaded = Kernel.require(name)
|
38
|
+
Gem.loaded_specs[name] = spec.gemspec
|
39
|
+
spec.gemspec&.activated = true
|
40
|
+
spec.gemspec&.instance_variable_set(:@loaded, true)
|
41
|
+
loaded
|
42
|
+
end
|
43
|
+
|
35
44
|
def warn(message)
|
36
45
|
Devpack.warn(message)
|
37
46
|
end
|
@@ -46,8 +55,8 @@ module Devpack
|
|
46
55
|
@gem_glob ||= GemGlob.new
|
47
56
|
end
|
48
57
|
|
49
|
-
def update_load_path(
|
50
|
-
$LOAD_PATH.concat(
|
58
|
+
def update_load_path(paths)
|
59
|
+
$LOAD_PATH.concat(paths)
|
51
60
|
end
|
52
61
|
end
|
53
62
|
end
|
data/lib/devpack/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devpack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Farrell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|
@@ -103,7 +103,7 @@ files:
|
|
103
103
|
- lib/devpack.rb
|
104
104
|
- lib/devpack/config.rb
|
105
105
|
- lib/devpack/gem_glob.rb
|
106
|
-
- lib/devpack/
|
106
|
+
- lib/devpack/gem_spec.rb
|
107
107
|
- lib/devpack/gems.rb
|
108
108
|
- lib/devpack/initializers.rb
|
109
109
|
- lib/devpack/messages.rb
|