nuva 0.3.1 → 0.4.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 +4 -4
- data/.devcontainer/devcontainer.json +20 -16
- data/Changelog.md +7 -0
- data/lib/nuva/version.rb +1 -1
- data/lib/nuva.rb +21 -26
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afbabc0a255bd36f3b3b9d4a9df5b0ea139651c620a4884f6366f7d4d70cd221
|
4
|
+
data.tar.gz: 8a58a082d0d3a11815cbfb47aa985c2114d42e5e0c0e198eb8642bbb57224a64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5dfadcffe9da8ffded45109e4fb803f35ec416279660480550981541ac63e87044382d36464a71a32663ac977b295afe35b1a86a728570012eac28052b80015c
|
7
|
+
data.tar.gz: 934776897a3fd617bdfbd9012b3ae0e539eb918d7ab85ac2453157b06478dda9ea919f779f386e2501affa473e46df32ed4000a1431bb427119bca966eb8cfb6
|
@@ -1,25 +1,29 @@
|
|
1
1
|
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
2
2
|
// README at: https://github.com/devcontainers/templates/tree/main/src/ruby
|
3
3
|
{
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
"name": "nuva-ruby",
|
5
|
+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
6
|
+
"image": "mcr.microsoft.com/devcontainers/ruby:1-3.3-bullseye",
|
7
|
+
"features": {
|
8
|
+
"ghcr.io/devcontainers/features/common-utils:2": {}
|
9
|
+
},
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
"containerEnv": {
|
12
|
+
"APP_ENV": "development"
|
13
|
+
}
|
13
14
|
|
14
|
-
|
15
|
-
|
15
|
+
// Features to add to the dev container. More info: https://containers.dev/features.
|
16
|
+
// "features": {},
|
16
17
|
|
17
|
-
|
18
|
-
|
18
|
+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
19
|
+
// "forwardPorts": [],
|
19
20
|
|
20
|
-
|
21
|
-
|
21
|
+
// Use 'postCreateCommand' to run commands after the container is created.
|
22
|
+
// "postCreateCommand": "ruby --version",
|
22
23
|
|
23
|
-
|
24
|
-
|
24
|
+
// Configure tool-specific properties.
|
25
|
+
// "customizations": {},
|
26
|
+
|
27
|
+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
28
|
+
// "remoteUser": "root"
|
25
29
|
}
|
data/Changelog.md
CHANGED
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## [0.4.0] - 2025-01-21
|
9
|
+
|
10
|
+
### Added
|
11
|
+
|
12
|
+
- Add method `Nuva.fetch_latest_version_hash`
|
13
|
+
- Support fetching specific nuva version with `Nuva.load`
|
14
|
+
|
8
15
|
## [0.3.1] - 2025-01-17
|
9
16
|
|
10
17
|
### Changed
|
data/lib/nuva/version.rb
CHANGED
data/lib/nuva.rb
CHANGED
@@ -55,39 +55,34 @@ module Nuva
|
|
55
55
|
@db.version
|
56
56
|
end
|
57
57
|
|
58
|
-
def
|
59
|
-
|
60
|
-
|
58
|
+
def inspect
|
59
|
+
"#<Nuva::Nuva version=#{version.major}.#{version.minor}.#{version.patch} diseaseCount=#{repositories.diseases.all.count} vaccineCount=#{repositories.vaccines.all.count} valenceCount=#{repositories.valences.all.count}>"
|
60
|
+
end
|
61
|
+
|
62
|
+
LATEST_VERSION_URI =
|
63
|
+
URI("https://cdnnuva.mesvaccins.net/versions/last.json")
|
61
64
|
|
65
|
+
def self.load(lang: "en", hash: nil)
|
62
66
|
::Net::HTTP.start(
|
63
|
-
|
64
|
-
|
65
|
-
use_ssl:
|
67
|
+
LATEST_VERSION_URI.host,
|
68
|
+
LATEST_VERSION_URI.port,
|
69
|
+
use_ssl: LATEST_VERSION_URI.scheme == "https"
|
66
70
|
) do |http|
|
67
|
-
# Fetch version manifest
|
68
|
-
|
69
|
-
|
70
|
-
res = http.request req
|
71
|
-
res.value
|
72
|
-
|
73
|
-
manifest = JSON.parse(res.body)
|
74
|
-
|
75
|
-
dump_hash = manifest["dump_hash"]
|
71
|
+
# Fetch version manifest if necessary
|
72
|
+
hash ||= fetch_latest_version_hash(http:)
|
76
73
|
|
77
|
-
|
78
|
-
dump_uri =
|
79
|
-
|
80
|
-
|
81
|
-
req = ::Net::HTTP::Get.new dump_uri
|
82
|
-
|
83
|
-
res = http.request req
|
84
|
-
res.value
|
85
|
-
|
86
|
-
# The return value of the block is returned by the start method
|
87
|
-
::Nuva::Nuva.new(::Nuva::NuvaDatabase.decode(res.body))
|
74
|
+
dump_uri = LATEST_VERSION_URI.dup
|
75
|
+
dump_uri.path = "/proto/#{hash}_en.db"
|
76
|
+
response = http.get(dump_uri)
|
77
|
+
::Nuva::Nuva.new(::Nuva::NuvaDatabase.decode(response.body))
|
88
78
|
end
|
89
79
|
end
|
90
80
|
|
81
|
+
def self.fetch_latest_version_hash(http: Net::HTTP)
|
82
|
+
response = http.get(LATEST_VERSION_URI)
|
83
|
+
JSON.parse(response.body)["dump_hash"]
|
84
|
+
end
|
85
|
+
|
91
86
|
def self.load_from_file(path)
|
92
87
|
Nuva.new(NuvaDatabase.decode(File.read(path)))
|
93
88
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nuva
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Syadem
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-protobuf
|