devpack 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +1 -1
- data/lib/devpack/gem_glob.rb +16 -8
- 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: 57a7f13b41361d7f9c45a147a99221d6f88e3b8d0ee1ede4f59ccdaeb878c7e8
|
4
|
+
data.tar.gz: 5e631a6efa73d770ecafcb8b55278240f83f4ffb58702fbc7c6f48cd101e45ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 057fcdb72061f64c1fd330722e958eb2680936756b861fb1d6777878e860cda2a645d050721e2d29f9518a2057bfaaf386d5d166938c9c4de1cb498cee83dd1e
|
7
|
+
data.tar.gz: 5f145c0cac07ae44eb0375aa62d68cf12bf0d1966d353eed205857f5e9d5d69ebe13387df2c44fd0b8914fc7ab34bbe9572e1192908df5452d2337f75ff1aa09
|
data/CHANGELOG.md
CHANGED
@@ -21,3 +21,9 @@ Use `Gem::Specification` to load "rendered" gemspec (i.e. the file created by ru
|
|
21
21
|
Recursively include gem dependencies in `$LOAD_PATH` rather than assuming that any dependencies are already loaded.
|
22
22
|
|
23
23
|
Include original error message when warning that a gem was unable to be loaded.
|
24
|
+
|
25
|
+
## 0.1.3
|
26
|
+
|
27
|
+
Use a more appropriate method of identifying the latest version of a gem (use `Gem::Version` to sort matched gem paths).
|
28
|
+
|
29
|
+
Fix edge case where e.g. `pry-rails-0.1.0` was matching for `pry` due to naive match logic. Split on last dash instead of first (i.e. don't assume gems will not have a dash in their name; last dash separates gem name from version in directory name).
|
data/README.md
CHANGED
data/lib/devpack/gem_glob.rb
CHANGED
@@ -4,13 +4,7 @@ module Devpack
|
|
4
4
|
# Locates gems by searching in paths listed in GEM_PATH
|
5
5
|
class GemGlob
|
6
6
|
def find(name)
|
7
|
-
|
8
|
-
pathname = Pathname.new(path)
|
9
|
-
next unless pathname.directory?
|
10
|
-
|
11
|
-
basename = pathname.basename.to_s
|
12
|
-
match?(name, basename)
|
13
|
-
end.max # FIXME: Quick-and-dirty way to get latest version - will have many edge cases.
|
7
|
+
matched_paths(name).max { |a, b| version(a) <=> version(b) }
|
14
8
|
end
|
15
9
|
|
16
10
|
private
|
@@ -27,10 +21,24 @@ module Devpack
|
|
27
21
|
|
28
22
|
def match?(name_with_version, basename)
|
29
23
|
name, _, version = name_with_version.partition(':')
|
30
|
-
return true if version.empty? && basename.
|
24
|
+
return true if version.empty? && basename.rpartition('-').first == name
|
31
25
|
return true if !version.empty? && basename == "#{name}-#{version}"
|
32
26
|
|
33
27
|
false
|
34
28
|
end
|
29
|
+
|
30
|
+
def matched_paths(name)
|
31
|
+
glob.select do |path|
|
32
|
+
pathname = Pathname.new(path)
|
33
|
+
next unless pathname.directory?
|
34
|
+
|
35
|
+
basename = pathname.basename.to_s
|
36
|
+
match?(name, basename)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def version(path)
|
41
|
+
Gem::Version.new(File.split(path).last.rpartition('-').last)
|
42
|
+
end
|
35
43
|
end
|
36
44
|
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.1.
|
4
|
+
version: 0.1.3
|
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-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|