spandx-rubygems 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -2
- data/Gemfile.lock +1 -1
- data/lib/spandx/rubygems.rb +0 -1
- data/lib/spandx/rubygems/backups.rb +9 -2
- data/lib/spandx/rubygems/version.rb +1 -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: ae06c0d35787d817ec8fc08917c15d0501c45f4ecb21569e73cdd7afb854bc3a
|
4
|
+
data.tar.gz: 31939fddb4eea4d955bed8f7e5b14238efc90074fc63c74fc24545fb8f6f4d7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 219e6b6267b2a1259acf4889370100d45263990717101a12302f01de44b5d33464e726493f9be0222a5f6373e3dea9b2d83f93dc060cbd84021bb6f19e853b94
|
7
|
+
data.tar.gz: 502f6eac9f88dc9c829ab8378f6ccea725d9ff911ea89ed58372ecafddf766d9e7e70989a719047b0bbe0c8baf868c0821e19ea3298ad6c83870704b6087d9bf
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Version 0.1.
|
1
|
+
Version 0.1.2
|
2
2
|
|
3
3
|
# Changelog
|
4
4
|
|
@@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
9
9
|
|
10
10
|
## [Unreleased]
|
11
11
|
|
12
|
+
## [0.1.2] - 2020-02-13
|
13
|
+
### Changed
|
14
|
+
- Lazy load `pg` connection
|
15
|
+
|
12
16
|
## [0.1.1] - 2020-02-13
|
13
17
|
### Changed
|
14
18
|
- Make `pg` gem a development dependency
|
@@ -18,5 +22,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
18
22
|
- Provide API for retrieving license info for a specific gem and version.
|
19
23
|
- Add CLI to process rubygems.org db dumps into a human readable index and machine readable index.
|
20
24
|
|
21
|
-
[Unreleased]: https://github.com/mokhan/spandx/compare/v0.1.
|
25
|
+
[Unreleased]: https://github.com/mokhan/spandx/compare/v0.1.2...HEAD
|
26
|
+
[0.1.2]: https://github.com/mokhan/spandx/compare/v0.1.1...v0.1.2
|
22
27
|
[0.1.1]: https://github.com/mokhan/spandx/compare/v0.1.0...v0.1.1
|
data/Gemfile.lock
CHANGED
data/lib/spandx/rubygems.rb
CHANGED
@@ -8,7 +8,6 @@ module Spandx
|
|
8
8
|
def initialize(base_url: 'https://s3-us-west-2.amazonaws.com/rubygems-dumps/')
|
9
9
|
@base_url = base_url
|
10
10
|
@http = Net::Hippie::Client.new
|
11
|
-
@db_connection = PG.connect(host: File.expand_path('tmp/sockets'), dbname: 'postgres')
|
12
11
|
end
|
13
12
|
|
14
13
|
def each
|
@@ -16,7 +15,7 @@ module Spandx
|
|
16
15
|
to_xml(response.body).search('//Contents/Key').reverse.each do |node|
|
17
16
|
next unless valid?(node.text)
|
18
17
|
|
19
|
-
yield Backup.new(URI.join(base_url, node.text),
|
18
|
+
yield Backup.new(URI.join(base_url, node.text), db_connection)
|
20
19
|
end
|
21
20
|
end
|
22
21
|
|
@@ -30,6 +29,14 @@ module Spandx
|
|
30
29
|
text.end_with?('public_postgresql.tar') &&
|
31
30
|
text.start_with?('production')
|
32
31
|
end
|
32
|
+
|
33
|
+
def db_connection
|
34
|
+
@db_connection ||=
|
35
|
+
begin
|
36
|
+
require 'pg'
|
37
|
+
PG.connect(host: File.expand_path('tmp/sockets'), dbname: 'postgres')
|
38
|
+
end
|
39
|
+
end
|
33
40
|
end
|
34
41
|
end
|
35
42
|
end
|