slimer 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: 38fee3e5afd6079dc26e2171429653fa54f6857715116e35a3bee6c0b6e7798f
4
- data.tar.gz: 9e7ebe14c81b8a8381e7dc61ca6eb1d17ca7f1e3af4ec1d9691dd22d7f4468c8
3
+ metadata.gz: bb242d0246280b6e9982d3f57b5f16ccc24f88e36c7afb3927d16d905ea3a152
4
+ data.tar.gz: 56caf96cd658d77281d9edde27aec2116173b9e9fa1a9053b1689aa64b8d0b1d
5
5
  SHA512:
6
- metadata.gz: a036d1c0928d989a294e1f6e39a1cc4c06872eb4c50d433f5cb99f047f821f7d8007fd5c98fbde4688d994fc388d0b6478e948b500c492af082653abb9e54e66
7
- data.tar.gz: ebeb265bbdc69edd14b0b520c0f000e8dda6b20203fcdf1ba3173a76e458c28171e2b1d6fe1c8b8dea2401f91c61aa29b0f6ebcb7e04028ce24e246edfaca7ac
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
- [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/codenamev/slimer/raw/main/examples/heroku)
14
+ [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/codenamev/slimer/tree/main/examples/heroku)
15
15
 
16
16
  ## Installation
17
17
 
@@ -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
- puts "Enter a name for this API key: "
9
- new_name = $stdin.gets.chomp
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."
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Slimer
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
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.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-20 00:00:00.000000000 Z
11
+ date: 2021-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel