bundle_package_check 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d1a17e1431bbf2b59f7483d85131338d16ae9d2
4
- data.tar.gz: e1e22af5e5d15f59b16f7d372f840d6d8686090f
3
+ metadata.gz: e318763c7850044eaefc4dc35d4d962f4cb5f491
4
+ data.tar.gz: 8953005a4139089bd1159487321f606e1846dfa3
5
5
  SHA512:
6
- metadata.gz: 5aed2ecc1c0aca631668c4ce112fc9f5925649ea5b0ba99bb28ca42e91c0e84fbc7a5c0a8f6c609a76899d13779da64e0c545830a04d44da905faa6b3ae299c2
7
- data.tar.gz: fae184edea7219d1e97d20e0652dc6dbc4d7c13ea6167c70ebc556f619c077b278cd5e880f5212497f63082a7d4219b8de74183166e1936fed4dead503f4752f
6
+ metadata.gz: 29f5aebac0f5e1d1b83e8126d4d0b4e48a5403517de810828d18b551b2305863b2708d067589a001779000b98060b67c3383f078a1d903bc960865c248665cd0
7
+ data.tar.gz: cd1a76c69ca018bf9b51a6c2bcf88a9fb70f74ffe393370a0b36b6c9ff579b075f158249ebbb84d4278c89ddcb102094e331bf2c785f052a360741dfc258045a
@@ -1,7 +1,9 @@
1
1
  module BundlePackageCheck
2
+ PATH_SECTION = /^PATH\n( .*\n)+/
3
+
2
4
  class << self
3
- def errors(all: false, ignore_extra: false)
4
- expected = expected_from_lock(all)
5
+ def errors(all: false, ignore_extra: false, ignore_path: false)
6
+ expected = expected_from_lock(all, ignore_path)
5
7
  actual = Dir["vendor/cache/*"].sort
6
8
 
7
9
  errors = []
@@ -12,13 +14,23 @@ module BundlePackageCheck
12
14
 
13
15
  private
14
16
 
15
- def expected_from_lock(all)
17
+ def path_gems(lock)
18
+ if section = lock[PATH_SECTION]
19
+ section.scan(/^ (\S+)/).flatten
20
+ else
21
+ []
22
+ end
23
+ end
24
+
25
+ def expected_from_lock(all, ignore_path)
16
26
  lock = File.read("Gemfile.lock")
27
+ path_gems = path_gems(lock)
17
28
  expected = lock.scan(/(?:revision: (\S+)(?:\n .*)*\n specs:\n|^) (\S+) \((\S+)\)/)
18
29
  expected.reject! { |revision, _, _| revision } unless all
30
+ expected.reject! { |_, name, _| path_gems.include?(name) } if ignore_path
19
31
  expected.map! do |revision, name, version|
20
- identifier = revision ? revision[0...12] : "#{version}.gem"
21
- "vendor/cache/#{name}-#{identifier}"
32
+ identifier = (revision ? "-#{revision[0...12]}" : (path_gems.include?(name) ? "" : "-#{version}.gem"))
33
+ "vendor/cache/#{name}#{identifier}"
22
34
  end.sort!
23
35
  end
24
36
  end
@@ -1,3 +1,3 @@
1
1
  module BundlePackageCheck
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundle_package_check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-09 00:00:00.000000000 Z
11
+ date: 2015-08-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: michael@grosser.it