lock_jar 0.14.6 → 0.14.7

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: bb1062ded1e751410d49d6b1b81666008048d662
4
- data.tar.gz: 1b3ed787d557da58076dba1d60f5a4d0ecee3b64
3
+ metadata.gz: 220e0aaec961060a13debcd2eb8cea370c13726e
4
+ data.tar.gz: baf281d3e8e0645851de8ca201da2b9c6af3f26b
5
5
  SHA512:
6
- metadata.gz: 6041663c5fcdc7673e30286f3cdc624b25075592ff5c6befa30c998b5b6188dc442c14d3dd96ce5490a69c80a70d9fc229706b588d301d1533ba48d2f3ce8435
7
- data.tar.gz: c247a4d5d5bac9fe488223c5b6943957f04f0186ea79d13f7f5291b235e47c315edc5b128a2ef6faf4bb8c549101518019e62ffa4c243a3c49024a0807d96a7e
6
+ metadata.gz: 721a81227f8ef359b7cc95be9199089f3496983a318b07b5902be6c95589b9e8870bff8af2f17bfdb600c30f74692b33154d36d1a30485b27f77966b06bb5b6f
7
+ data.tar.gz: d7db27578bad5442f9804ceaa7fe36a8c9301645821a0c0a49787f33bdf2c3d0d6146faef1275e44bbdbba913e862d9dc9fd7368b05488e1545ce0544534026d
@@ -26,24 +26,45 @@ module LockJar
26
26
 
27
27
  # rubocop:disable Metrics/PerceivedComplexity
28
28
  def self.read(path)
29
- lockfile = Lockfile.new
30
-
31
- lock_data = YAML.load_file(path)
32
-
33
- lockfile.version = lock_data['version'] || LockJar::VERSION
34
- lockfile.merged = lock_data['merged']
35
- lockfile.local_repository = lock_data['local_repository']
36
- lockfile.merged = lock_data['merged'] || []
37
- lockfile.maps = lock_data['maps'] || []
38
- lockfile.excludes = lock_data['excludes'] || []
39
- lockfile.groups = lock_data['groups'] || lock_data['scopes'] || {}
40
- lockfile.remote_repositories =
41
- Set.new(Array(lock_data['remote_repositories'] || lock_data['repositories']))
42
- lockfile.gems = lock_data['gems'] || []
43
- lockfile
29
+ lock_data = fs_or_classpath(path)
30
+
31
+ fail "lockfile #{path} not found" if lock_data.nil?
32
+
33
+ Lockfile.new.tap do |lockfile|
34
+ lockfile.version = lock_data['version'] || LockJar::VERSION
35
+ lockfile.merged = lock_data['merged']
36
+ lockfile.local_repository = lock_data['local_repository']
37
+ lockfile.merged = lock_data['merged'] || []
38
+ lockfile.maps = lock_data['maps'] || []
39
+ lockfile.excludes = lock_data['excludes'] || []
40
+ lockfile.groups = lock_data['groups'] || lock_data['scopes'] || {}
41
+ lockfile.remote_repositories =
42
+ Set.new(Array(lock_data['remote_repositories'] || lock_data['repositories']))
43
+ lockfile.gems = lock_data['gems'] || []
44
+ end
44
45
  end
45
46
  # rubocop:enable Metrics/PerceivedComplexity
46
47
 
48
+ def self.fs_or_classpath(path)
49
+ if File.exist? path
50
+ YAML.load_file(path)
51
+
52
+ # Lookup of Jarfile.lock in the classpath
53
+ elsif Naether.platform == 'java' || path.start_with?('classpath:')
54
+ stream = java.lang.Object.java_class.resource_as_stream("/#{path.gsub('classpath:', '')}")
55
+ if stream
56
+ reader = java.io.BufferedReader.new(java.io.InputStreamReader.new(stream))
57
+ lines = ''
58
+ while (line = reader.read_line)
59
+ lines << line << "\n"
60
+ end
61
+ reader.close
62
+
63
+ YAML.load(lines)
64
+ end
65
+ end
66
+ end
67
+
47
68
  def initialize
48
69
  @groups = { 'default' => {} }
49
70
  @maps = []
@@ -1,4 +1,4 @@
1
1
  # the version
2
2
  module LockJar
3
- VERSION = '0.14.6'.freeze
3
+ VERSION = '0.14.7'.freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lock_jar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.6
4
+ version: 0.14.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Guymon