slimer 0.1.1 → 0.1.2
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/README.md +1 -1
- data/lib/slimer/database.rb +5 -0
- data/lib/slimer/tasks/api_keys.rake +7 -2
- data/lib/slimer/version.rb +1 -1
- 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: bb242d0246280b6e9982d3f57b5f16ccc24f88e36c7afb3927d16d905ea3a152
|
4
|
+
data.tar.gz: 56caf96cd658d77281d9edde27aec2116173b9e9fa1a9053b1689aa64b8d0b1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3be666971333221c91a0de02cf3f7290eb7ae87965dd5f7285eb041667ceec24609c5616b1bb5419639b8ccb50a091ef32a63a25188ca54976f49e9a6891b922
|
7
|
+
data.tar.gz: 20bd170d2533baee9687dab4c8a54c2103f286cafba16403d8b96a632f3bb8064381c1c75c6b97f148d49970eda0a1448162d6d5d13019b08688e11d4725821c
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@ A minimalist consumer with an endless appetite.
|
|
11
11
|
|
12
12
|
## Run for free on Heroku
|
13
13
|
|
14
|
-
[](https://heroku.com/deploy?template=https://github.com/codenamev/slimer/
|
14
|
+
[](https://heroku.com/deploy?template=https://github.com/codenamev/slimer/tree/main/examples/heroku)
|
15
15
|
|
16
16
|
## Installation
|
17
17
|
|
data/lib/slimer/database.rb
CHANGED
@@ -10,6 +10,7 @@ module Slimer
|
|
10
10
|
class Database
|
11
11
|
attr_reader :url
|
12
12
|
|
13
|
+
MAX_CONNECTION_RETRIES = 10
|
13
14
|
REQUIRED_TABLES = %i[api_keys substances].freeze
|
14
15
|
|
15
16
|
def initialize(url)
|
@@ -29,7 +30,11 @@ module Slimer
|
|
29
30
|
end
|
30
31
|
|
31
32
|
def connection
|
33
|
+
retry_count = 1
|
32
34
|
@connection ||= Sequel.connect(url)
|
35
|
+
rescue Sequel::DatabaseConnectionError
|
36
|
+
Slimer.logger.warn "Waiting for database to become available... #{retry_count}"
|
37
|
+
sleep 1 and retry if retry_count >= MAX_CONNECTION_RETRIES
|
33
38
|
end
|
34
39
|
alias connect connection
|
35
40
|
|
@@ -5,8 +5,13 @@ namespace :slimer do
|
|
5
5
|
desc "Generate a Slimer API key"
|
6
6
|
task :generate do
|
7
7
|
name = loop do
|
8
|
-
|
9
|
-
|
8
|
+
new_name = ARGV[1].to_s
|
9
|
+
|
10
|
+
if new_name.empty?
|
11
|
+
puts "Enter a name for this API key: "
|
12
|
+
new_name = $stdin.gets.chomp
|
13
|
+
end
|
14
|
+
|
10
15
|
break new_name unless new_name.to_s.empty?
|
11
16
|
|
12
17
|
puts "You must enter a name for this API key."
|
data/lib/slimer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slimer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Valentino Stoll
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sequel
|