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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bef910170618e59aa65b8490d4506ad5e618cab524490647b81037e0c16f2d52
4
- data.tar.gz: 660b3c2a313dac4260f280aa0c365af352dff564da678e2a4a281a70cdac9f76
3
+ metadata.gz: ae06c0d35787d817ec8fc08917c15d0501c45f4ecb21569e73cdd7afb854bc3a
4
+ data.tar.gz: 31939fddb4eea4d955bed8f7e5b14238efc90074fc63c74fc24545fb8f6f4d7f
5
5
  SHA512:
6
- metadata.gz: acba62cbb3eaae1a175718e8762a6372a4fddcecdd00999df7aa138c736036c70e8545e9f080ebc0dd3e525d57c58315bb4ad2058c688787a6dc8ec042bcf4e9
7
- data.tar.gz: 6f00e3f6f4d39c3ae822886a27397a0afcecaecbc00cc4e1803cc4b489bc1bbf1d60364c6a630931ebce34c871c0def0f4907e94d5d1bfc3cde0b2661ad3b842
6
+ metadata.gz: 219e6b6267b2a1259acf4889370100d45263990717101a12302f01de44b5d33464e726493f9be0222a5f6373e3dea9b2d83f93dc060cbd84021bb6f19e853b94
7
+ data.tar.gz: 502f6eac9f88dc9c829ab8378f6ccea725d9ff911ea89ed58372ecafddf766d9e7e70989a719047b0bbe0c8baf868c0821e19ea3298ad6c83870704b6087d9bf
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- Version 0.1.0
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.1...HEAD
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- spandx-rubygems (0.1.1)
4
+ spandx-rubygems (0.1.2)
5
5
  msgpack (~> 1.3)
6
6
  net-hippie (~> 0.3)
7
7
  nokogiri (~> 1.10)
@@ -4,7 +4,6 @@ require 'digest'
4
4
  require 'msgpack'
5
5
  require 'net/hippie'
6
6
  require 'nokogiri'
7
- require 'pg'
8
7
  require 'yaml'
9
8
  require 'zlib'
10
9
 
@@ -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), @db_connection)
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Spandx
4
4
  module Rubygems
5
- VERSION = '0.1.1'
5
+ VERSION = '0.1.2'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spandx-rubygems
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - mo khan