glib-web 0.4.11 → 0.4.12
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65d643ab1cf84d5f4dabe58840e51d4b1d13a5cf
|
4
|
+
data.tar.gz: 2f01ef5b09d5727aa64994b1d5ba96623ec86ecf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0413434aeaafd7a0cafd4f550370f9247455cb35eef898afe0fa826b3aae538fbcc0a6496093ad26984bac90f8a4de523f7c5a6355d086b2295ca8ccd8af7d05
|
7
|
+
data.tar.gz: 874e956236407a17bfb7d5731387f0c91c67d7234f1a6d64604938b51f7969e650490d0eed6c95d5b1e6e2db36766c52a4e7a5d92ec25eca908b8c446dcd280e
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module Glib
|
2
2
|
module ActiveStorage
|
3
3
|
class Attachment < ::ActiveStorage::Attachment
|
4
|
-
if
|
4
|
+
if Glib::DynamicText::Config.database_url.present?
|
5
5
|
connects_to database: { writing: :dynamic_text, reading: :dynamic_text }
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
9
|
-
end
|
9
|
+
end
|
@@ -2,10 +2,8 @@ module Glib
|
|
2
2
|
class DynamicTextRecord < ActiveRecord::Base
|
3
3
|
self.abstract_class = true
|
4
4
|
|
5
|
-
|
6
|
-
# TODO: Remove this check once we don't support Rails 5 anymore
|
7
|
-
if respond_to? :connects_to
|
5
|
+
if Glib::DynamicText::Config.database_url.present?
|
8
6
|
connects_to database: { writing: :dynamic_text, reading: :dynamic_text }
|
9
7
|
end
|
10
8
|
end
|
11
|
-
end
|
9
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Glib
|
2
|
+
module DynamicText
|
3
|
+
class Config
|
4
|
+
@@redis = nil
|
5
|
+
@@database_url = ENV['DT_DATABASE_URL']
|
6
|
+
|
7
|
+
def self.redis
|
8
|
+
if @@redis.nil?
|
9
|
+
redis_url = ENV.fetch('DT_REDIS_URL', 'redis://localhost:6379')
|
10
|
+
@@redis = Redis.new(url: redis_url)
|
11
|
+
end
|
12
|
+
@@redis
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.database_url
|
16
|
+
@@database_url
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require_relative './dynamic_text/config'
|
data/lib/glib-web.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glib-web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
@@ -171,6 +171,8 @@ files:
|
|
171
171
|
- lib/generators/templates/database.yml
|
172
172
|
- lib/generators/templates/dynamic_text.rb
|
173
173
|
- lib/glib-web.rb
|
174
|
+
- lib/glib/dynamic_text.rb
|
175
|
+
- lib/glib/dynamic_text/config.rb
|
174
176
|
- lib/glib/engine.rb
|
175
177
|
- lib/glib/json_crawler.rb
|
176
178
|
- lib/glib/json_crawler/action_crawler.rb
|