matching_bundle 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/matching_bundle +13 -4
- data/lib/matching_bundle/version.rb +1 -1
- data/lib/matching_bundle.rb +2 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30269020c86fa6f75cb9f79d2dc1bc1aedffc0825f1e847e31910226d173b0ba
|
4
|
+
data.tar.gz: 2ccdaa16e32999bd55be285cb831f6430848970e1c6ceef7a1049101fa8364f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40a048bb2e8e6b7d8b05346a03d7d6eed6f7c2ad636e845e2b919f99286793661e7fd83626b9048eeeab7cadb2810c78cf40e26c9a47816abdd86357a8f494ad
|
7
|
+
data.tar.gz: 7f9afbb816f26e7a10be12bd953453b15f93c36999e95e7b536a4c5d43937593c0811a90d70f35e82e08e81e46a915bfcdcea1261f8ad5dbb2da89293aa5853e
|
data/bin/matching_bundle
CHANGED
@@ -2,13 +2,22 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
gemfile = ENV["BUNDLE_GEMFILE"] || "Gemfile"
|
5
|
+
|
6
|
+
unless File.exist?(gemfile)
|
7
|
+
warn "#{gemfile} not found"
|
8
|
+
exec "bundle", *ARGV
|
9
|
+
end
|
10
|
+
|
5
11
|
lockfile = "#{gemfile}.lock"
|
6
|
-
|
12
|
+
if File.exist?(lockfile)
|
13
|
+
content = File.read(lockfile)
|
14
|
+
else
|
15
|
+
warn "Locking #{lockfile}"
|
16
|
+
content = `bundle lock 2>&1`
|
17
|
+
exec "bundle", *ARGV if $?.success?
|
18
|
+
end
|
7
19
|
|
8
20
|
require 'matching_bundle'
|
9
|
-
|
10
|
-
content = File.read(lockfile)
|
11
21
|
if version = MatchingBundle.find_or_install_matching_version(content)
|
12
|
-
warn "Using bundler #{version}"
|
13
22
|
exec "bundle", "_#{version}_", *ARGV
|
14
23
|
end
|
data/lib/matching_bundle.rb
CHANGED
@@ -8,6 +8,7 @@ module MatchingBundle
|
|
8
8
|
return unless requirement = bundler_requirement(gemfile_content)
|
9
9
|
|
10
10
|
if version = find_matching_local_bundler_version(requirement)
|
11
|
+
warn "Found bundler #{version}"
|
11
12
|
return version
|
12
13
|
end
|
13
14
|
|
@@ -46,7 +47,7 @@ module MatchingBundle
|
|
46
47
|
def bundler_requirement(gemfile_content)
|
47
48
|
found = gemfile_content.scan(/^\s*bundler \((.*)\)/)
|
48
49
|
versions = found.map(&:last)
|
49
|
-
versions.
|
50
|
+
versions.grep(/^=\s*\d/).first || versions.first
|
50
51
|
end
|
51
52
|
end
|
52
53
|
end
|