matching_bundle 0.2.1 → 0.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee7ae4447cd671e2fd003ec60d24737a5d650caa805c493af0e600d45836b193
4
- data.tar.gz: fb7c70f0103e317cf84747626e1fb452a3a2bdcea9ee16823c0dc655efe122cb
3
+ metadata.gz: 30269020c86fa6f75cb9f79d2dc1bc1aedffc0825f1e847e31910226d173b0ba
4
+ data.tar.gz: 2ccdaa16e32999bd55be285cb831f6430848970e1c6ceef7a1049101fa8364f4
5
5
  SHA512:
6
- metadata.gz: 6d5a4ba494cb2004fec6f419aac66fd9404cce23be8bafe99c66914a4f4338395b6a00a7188c3ed49630e8aa810c4ac1ca649bf6ef136839aaa306ad5522f739
7
- data.tar.gz: 9d5d6d22b7ee375dedeb4258958d1c06394f53f621b44e83496b1f1dc29e8b59447cc35d89d958bc9b01993ba8ef27cf53892c63db6b57a676e05215282a5815
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
- exec "bundle", *ARGV unless File.exist?(lockfile) # nothing we can do, regular bundle it is
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
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module MatchingBundle
3
- VERSION = "0.2.1"
3
+ VERSION = "0.3.0"
4
4
  end
@@ -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.find { |version| version =~ /^=\s*\d/ } || versions.first
50
+ versions.grep(/^=\s*\d/).first || versions.first
50
51
  end
51
52
  end
52
53
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: matching_bundle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser