standalone_activerecord_boot_loader 0.1.0 → 0.2.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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: df4b2b206babe944bedc4374b282b192850edd3488be8a8e3f4c1474a240a1a3
|
|
4
|
+
data.tar.gz: 5575bf0d8a514583e552ae143714f93a384891ac7880e255d7a88341d0f8e32d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 720b7e1078459443e7bf8b68086ba6a56a818d84e07c99390560e27693857fb53fdb2527b8889668ff3d426603fd2102f5371651d5567504462df243da3bcca4
|
|
7
|
+
data.tar.gz: 6129f0fa6078c85c3dbf92e4db0e4f8bcb03fb6bfb32650f91d60cdf08bec89dfc7bd411706b31fad69877f0c821d0a98a7ce74a989da1bc8367c517b7a29b43
|
|
@@ -38,17 +38,10 @@ module StandaloneActiverecordBootLoader
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
def create_database
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
# ActiveRecord 6系以降
|
|
44
|
-
if defined?(ActiveRecord::DatabaseConfigurations::HashConfig)
|
|
45
|
-
conn_spec = ActiveRecord::DatabaseConfigurations::HashConfig.new(@env, 'primary', conn_spec)
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
tasks = ActiveRecord::Tasks::MySQLDatabaseTasks.new(conn_spec)
|
|
41
|
+
tasks = ActiveRecord::Tasks::MySQLDatabaseTasks.new(build_database_config)
|
|
49
42
|
begin
|
|
50
43
|
tasks.create
|
|
51
|
-
rescue => e
|
|
44
|
+
rescue StandardError => e
|
|
52
45
|
# ActiveRecord 5系
|
|
53
46
|
if defined?(ActiveRecord::Tasks::DatabaseAlreadyExists)
|
|
54
47
|
return if e.instance_of?(ActiveRecord::Tasks::DatabaseAlreadyExists)
|
|
@@ -70,5 +63,16 @@ module StandaloneActiverecordBootLoader
|
|
|
70
63
|
def database_config
|
|
71
64
|
@database_config ||= YAML::load(ERB.new(File.read(database_yml_path)).result)
|
|
72
65
|
end
|
|
66
|
+
|
|
67
|
+
def build_database_config
|
|
68
|
+
unless defined?(ActiveRecord::DatabaseConfigurations::HashConfig)
|
|
69
|
+
return database_config[@env]
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
config = ActiveRecord::DatabaseConfigurations::HashConfig.new(@env, 'primary', database_config[@env])
|
|
73
|
+
return database_config[@env] unless config.respond_to?(:merge)
|
|
74
|
+
|
|
75
|
+
config
|
|
76
|
+
end
|
|
73
77
|
end
|
|
74
78
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: standalone_activerecord_boot_loader
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Takahiro Ooishi
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-
|
|
11
|
+
date: 2022-09-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: zeitwerk
|
|
@@ -60,7 +60,7 @@ licenses: []
|
|
|
60
60
|
metadata:
|
|
61
61
|
homepage_uri: https://github.com/taka0125/standalone_activerecord_boot_loader
|
|
62
62
|
source_code_uri: https://github.com/taka0125/standalone_activerecord_boot_loader
|
|
63
|
-
post_install_message:
|
|
63
|
+
post_install_message:
|
|
64
64
|
rdoc_options: []
|
|
65
65
|
require_paths:
|
|
66
66
|
- lib
|
|
@@ -75,8 +75,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
75
75
|
- !ruby/object:Gem::Version
|
|
76
76
|
version: '0'
|
|
77
77
|
requirements: []
|
|
78
|
-
rubygems_version: 3.
|
|
79
|
-
signing_key:
|
|
78
|
+
rubygems_version: 3.3.7
|
|
79
|
+
signing_key:
|
|
80
80
|
specification_version: 4
|
|
81
81
|
summary: ActiveRecordを単体で動かす時に使う起動処理
|
|
82
82
|
test_files: []
|