devpack 0.1.1 → 0.1.2
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/CHANGELOG.md +6 -0
- data/README.md +1 -1
- data/lib/devpack/gem_path.rb +33 -5
- data/lib/devpack/gems.rb +2 -2
- data/lib/devpack/messages.rb +2 -2
- data/lib/devpack/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ec75af91bddba1020bdc23508c881dfc9da92c5c0a69793935c1839d699139e
|
4
|
+
data.tar.gz: 7751b678c8a59010a8a5160a108e3c0c672d37104ca44e41c8f4d0c2c6ec280c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09208ee73b785fbf9c67ad5375ab672e15241bf561216e27cab3db7292d0e7f2ed198d0cf159f544acaef4cd6241f9ed1f0e9e44beb31b1fef236f8ccd47fe36'
|
7
|
+
data.tar.gz: e4301ef053caf42a34463f9ffc1f816d6203144d36e9920c21895d92cbb17354c27b90716c1e5177b878d0d4cae73b6523a7e2e2f96db3643be6164144d68ccb
|
data/CHANGELOG.md
CHANGED
@@ -15,3 +15,9 @@ Load latest version of gem by default. Allow specifying version with rubygems sy
|
|
15
15
|
Permit comments in config file.
|
16
16
|
|
17
17
|
Use `Gem::Specification` to load "rendered" gemspec (i.e. the file created by rubygems when the gem is installed). This version of the gemspec will load very quickly so no need to do custom gemspec parsing any more. This also accounts for "missing" gemspecs.
|
18
|
+
|
19
|
+
## 0.1.2
|
20
|
+
|
21
|
+
Recursively include gem dependencies in `$LOAD_PATH` rather than assuming that any dependencies are already loaded.
|
22
|
+
|
23
|
+
Include original error message when warning that a gem was unable to be loaded.
|
data/README.md
CHANGED
data/lib/devpack/gem_path.rb
CHANGED
@@ -9,17 +9,28 @@ module Devpack
|
|
9
9
|
@glob = glob
|
10
10
|
end
|
11
11
|
|
12
|
-
def require_paths
|
12
|
+
def require_paths(visited = Set.new)
|
13
13
|
return [] unless gemspec_path&.exist? && gem_path&.exist?
|
14
14
|
|
15
|
-
|
16
|
-
.
|
17
|
-
.require_paths
|
18
|
-
.map { |path| gem_path.join(path).to_s }
|
15
|
+
(immediate_require_paths + dependency_require_paths(visited))
|
16
|
+
.compact.flatten.uniq
|
19
17
|
end
|
20
18
|
|
21
19
|
private
|
22
20
|
|
21
|
+
def dependency_require_paths(visited)
|
22
|
+
dependencies.map do |dependency|
|
23
|
+
next nil if visited.include?(dependency)
|
24
|
+
|
25
|
+
visited << dependency
|
26
|
+
GemPath.new(@glob, name_with_version(dependency)).require_paths(visited)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def dependencies
|
31
|
+
gemspec.runtime_dependencies
|
32
|
+
end
|
33
|
+
|
23
34
|
def gem_path
|
24
35
|
return nil if located_gem.nil?
|
25
36
|
|
@@ -33,6 +44,23 @@ module Devpack
|
|
33
44
|
.expand_path
|
34
45
|
end
|
35
46
|
|
47
|
+
def gemspec
|
48
|
+
@gemspec ||= Gem::Specification.load(gemspec_path.to_s)
|
49
|
+
end
|
50
|
+
|
51
|
+
def immediate_require_paths
|
52
|
+
gemspec
|
53
|
+
.require_paths
|
54
|
+
.map { |path| gem_path.join(path).to_s }
|
55
|
+
end
|
56
|
+
|
57
|
+
def name_with_version(dependency)
|
58
|
+
spec = dependency.to_spec
|
59
|
+
"#{spec.name}:#{spec.version}"
|
60
|
+
rescue Gem::MissingSpecError
|
61
|
+
dependency.name
|
62
|
+
end
|
63
|
+
|
36
64
|
def located_gem
|
37
65
|
@located_gem ||= @glob.find(@name)
|
38
66
|
end
|
data/lib/devpack/gems.rb
CHANGED
data/lib/devpack/messages.rb
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
module Devpack
|
4
4
|
# Generates output messages.
|
5
5
|
class Messages
|
6
|
-
def self.failure_message(name)
|
6
|
+
def self.failure_message(name, error)
|
7
7
|
base = "Failed to load `#{name}`"
|
8
8
|
install = "bundle exec gem install #{name}"
|
9
|
-
"#{base}. Try `#{install}`"
|
9
|
+
"#{base}. Try `#{install}` (#{error})"
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.loaded_message(path, gems, time)
|
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.1.
|
4
|
+
version: 0.1.2
|
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-07-
|
11
|
+
date: 2020-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|