herdst_worker 0.1.7 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/herdst_worker_console +24 -0
- data/lib/herdst_worker/adapters/database.rb +7 -13
- data/lib/herdst_worker/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6754dcab06ceedfa472bae8e9f36308d5b72865ed9d49c9b50119c923ad7f33a
|
4
|
+
data.tar.gz: 52d94cf004fb6e482d19b0f1ad254dc1c19a6069fc97e27c758414e38e496b41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 923627aabe68609ac0378cbf90ff33ef96d583902100d8537a6fbfb5cf8dd5c850f888c22d3e2f4a30a0e744c4ceea64cd73d62c7b41b31738c0517f5a53bc2e
|
7
|
+
data.tar.gz: 42b2742887f6a3db02a715acecee2203b8c787dd4be04bd57320b21fe28d60a1a684b13f7d599da5fde55473f5841679a6e3d55f1e1d8a743cd2a6d6338f8575
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
args = ARGV
|
4
|
+
.flat_map { |s| s.scan(/--?([^=\s]+)(?:=(\S+))?/) }
|
5
|
+
.select { |i| i[1] != "" }
|
6
|
+
|
7
|
+
arg_pair = Hash[ args ]
|
8
|
+
application_name = arg_pair["name"]
|
9
|
+
application_file = arg_pair["application"] || "application.rb"
|
10
|
+
application_path = "#{Dir.pwd}/#{application_file}"
|
11
|
+
application_env = arg_pair["env"] || "development"
|
12
|
+
|
13
|
+
raise "Please specify a name for the application E.g. --name=[name]" unless application_name
|
14
|
+
|
15
|
+
require "irb"
|
16
|
+
require "irb/completion"
|
17
|
+
require_relative "../lib/herdst_worker"
|
18
|
+
|
19
|
+
application_instance = HerdstWorker::Application.new(application_env, application_name, false)
|
20
|
+
|
21
|
+
require_relative application_path
|
22
|
+
|
23
|
+
ARGV.clear
|
24
|
+
IRB.start
|
@@ -5,24 +5,18 @@ module HerdstWorker
|
|
5
5
|
|
6
6
|
def self.setup(app)
|
7
7
|
begin
|
8
|
-
db_config = app.config_for(:database)
|
9
|
-
|
10
8
|
if app.config.is_dev?
|
11
9
|
ActiveRecord::Base.logger = app.logger.activerecord
|
12
10
|
end
|
11
|
+
|
12
|
+
db_config = app.config_for(:database)
|
13
|
+
db_config.each do |k, v|
|
14
|
+
db_config[k] = ActiveRecord::DatabaseConfigurations::HashConfig.new(app.config.env, k, v)
|
15
|
+
end
|
13
16
|
|
17
|
+
ActiveRecord::Base.configurations = db_config.values
|
14
18
|
ActiveRecord::Base.default_timezone = :utc
|
15
|
-
ActiveRecord::Base.establish_connection(
|
16
|
-
adapter: db_config[:adapter],
|
17
|
-
encoding: db_config[:encoding],
|
18
|
-
charset: db_config[:charset],
|
19
|
-
collation: db_config[:collation],
|
20
|
-
pool: db_config[:pool],
|
21
|
-
host: db_config[:host],
|
22
|
-
username: db_config[:username],
|
23
|
-
password: db_config[:password],
|
24
|
-
database: db_config[:database]
|
25
|
-
)
|
19
|
+
ActiveRecord::Base.establish_connection(db_config[:primary])
|
26
20
|
ActiveRecord::Base.connection.enable_query_cache!
|
27
21
|
rescue Exception => ex
|
28
22
|
app.logger.error ex.message
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: herdst_worker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Herd.St
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04-
|
11
|
+
date: 2022-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -225,11 +225,13 @@ email:
|
|
225
225
|
- devops@herd.st
|
226
226
|
executables:
|
227
227
|
- herdst_worker
|
228
|
+
- herdst_worker_console
|
228
229
|
extensions: []
|
229
230
|
extra_rdoc_files: []
|
230
231
|
files:
|
231
232
|
- Rakefile
|
232
233
|
- bin/herdst_worker
|
234
|
+
- bin/herdst_worker_console
|
233
235
|
- lib/herdst_worker.rb
|
234
236
|
- lib/herdst_worker/adapters/database.rb
|
235
237
|
- lib/herdst_worker/adapters/facade.rb
|