multi_ar 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/multi_ar/rake/migration_generator.rb +1 -1
- data/lib/multi_ar/rake/tasks.rb +15 -5
- data/lib/multi_ar/version.rb +1 -1
- data/lib/multi_ar.rb +6 -7
- data.tar.gz.sig +0 -0
- metadata +20 -20
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34e048d2d4906e2af853ade40a158107495f140e
|
4
|
+
data.tar.gz: 44a38ed6cd16746d8e70565d61e22524fe2fcc9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8c98f946f3546b27e0eed21f396760df13e90f53a74fd8ac66e222a245b4762240c58126049a947e23febe7d1e650ea5fa9f97ee7dcc8687eaff62486c297ce
|
7
|
+
data.tar.gz: b4e6afd293a028585492fefa6637b8771042533e22c8d8f232637edc86934b1b3e532fd5d3594ebe50a591955a71019c2a0db12bed9428cce1016e6f5d2cbfe4
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -10,7 +10,7 @@ module ActiveRecordMigrations
|
|
10
10
|
source_root ::ActiveRecord::Generators::MigrationGenerator.source_root
|
11
11
|
|
12
12
|
def db_migrate_path
|
13
|
-
dir = ::ActiveRecord::Tasks::DatabaseTasks.
|
13
|
+
dir = ::ActiveRecord::Tasks::DatabaseTasks.migrations_paths.first
|
14
14
|
db_dir = ::ActiveRecord::Tasks::DatabaseTasks.sub_db_dir
|
15
15
|
"#{dir}/#{db_dir}"
|
16
16
|
end
|
data/lib/multi_ar/rake/tasks.rb
CHANGED
@@ -5,11 +5,18 @@ require "active_record/tasks/database_tasks"
|
|
5
5
|
# In case there is no Rails available, let’s do simple class
|
6
6
|
begin
|
7
7
|
require "rails"
|
8
|
+
require "rails/application"
|
9
|
+
|
10
|
+
Class.new(Rails::Application) unless Rails.application
|
8
11
|
rescue LoadError
|
9
12
|
class Rails
|
10
13
|
def self.root
|
11
14
|
nil # TODO, we want MultiAR::root like thing somewhere
|
12
15
|
end
|
16
|
+
|
17
|
+
#def self.paths
|
18
|
+
# { "db/migrate" => "/dev/null" }
|
19
|
+
#end
|
13
20
|
end
|
14
21
|
end
|
15
22
|
|
@@ -93,11 +100,14 @@ module Rake
|
|
93
100
|
multiple_databases_task "migrate", "db" do |database_name|
|
94
101
|
establish_connection database_name
|
95
102
|
|
96
|
-
MultiAR::MultiAR.migration_dirs
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
103
|
+
context = ActiveRecord::MigrationContext.new MultiAR::MultiAR.migration_dirs
|
104
|
+
context.migrate
|
105
|
+
|
106
|
+
#MultiAR::MultiAR.migration_dirs.each do |dir|
|
107
|
+
# path = "#{dir}/#{database_name}/"
|
108
|
+
# # The database should be present only on one migration dir, so this will fail if there is more than one migration dir
|
109
|
+
# ActiveRecord::Migrator.migrate path if Dir.exist? path
|
110
|
+
#end
|
101
111
|
end
|
102
112
|
|
103
113
|
multiple_databases_task "create", "db" do |database_name|
|
data/lib/multi_ar/version.rb
CHANGED
data/lib/multi_ar.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
|
2
|
-
|
3
2
|
require_relative "multi_ar/rake/ext"
|
4
3
|
require_relative "multi_ar/rake/tasks"
|
5
4
|
|
@@ -19,7 +18,7 @@ module MultiAR
|
|
19
18
|
|
20
19
|
# @api private
|
21
20
|
# This will always be overridden, when MultiAR is initialized. Don’t try to do any funny logic with this.
|
22
|
-
|
21
|
+
#@@migration_dirs = []
|
23
22
|
|
24
23
|
class << self
|
25
24
|
# Instance of MultiAR::MultiAR, automatically assigned by MultiAR::MultiAR#new.
|
@@ -48,13 +47,13 @@ module MultiAR
|
|
48
47
|
@databases = databases
|
49
48
|
@db_config = db_config
|
50
49
|
@environment = environment
|
51
|
-
|
50
|
+
#@@migration_dirs = migration_dirs unless migration_dirs.empty? # This takes care of that it will only be overridden if there is any given values, making default configs work
|
51
|
+
ActiveRecord::Tasks::DatabaseTasks.migrations_paths = migration_dirs
|
52
52
|
|
53
53
|
Database.initialize db_config: db_config
|
54
54
|
|
55
|
-
ActiveRecord::Tasks::DatabaseTasks.class_eval { attr_accessor :sub_db_dir
|
55
|
+
ActiveRecord::Tasks::DatabaseTasks.class_eval { attr_accessor :sub_db_dir }
|
56
56
|
ActiveRecord::Tasks::DatabaseTasks.sub_db_dir = databases.first # TODO: I don’t think this is how it should work
|
57
|
-
ActiveRecord::Tasks::DatabaseTasks.migration_dir = migration_dirs.first # TODO: I don’t think this is how it should work
|
58
57
|
|
59
58
|
@rake = ::Rake::Application.new
|
60
59
|
::Rake.application = @rake
|
@@ -73,7 +72,7 @@ module MultiAR
|
|
73
72
|
# Array of paths to directories where migrations resides.
|
74
73
|
# @see add_migration_dir
|
75
74
|
def self.migration_dirs
|
76
|
-
|
75
|
+
ActiveRecord::Tasks::DatabaseTasks.migrations_paths
|
77
76
|
end
|
78
77
|
|
79
78
|
# Outputs contents if verbose flag has been passed.
|
@@ -93,7 +92,7 @@ module MultiAR
|
|
93
92
|
# @note often you want to add full path to this dir, `__dir__` is useful for this.
|
94
93
|
def self.add_migration_dir path
|
95
94
|
raise "Migration dir #{path} does not exist." unless Dir.exist? path
|
96
|
-
|
95
|
+
ActiveRecord::Tasks::DatabaseTasks.migrations_paths << path
|
97
96
|
end
|
98
97
|
|
99
98
|
# @todo this shows rake in start of the command, we want to show multi_ar instead.
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multi_ar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samu Voutilainen
|
@@ -11,25 +11,25 @@ cert_chain:
|
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIDWDCCAkCgAwIBAgIBATANBgkqhkiG9w0BAQUFADA5MQ0wCwYDVQQDDARzbWFy
|
14
|
-
|
15
|
-
|
14
|
+
MRQwEgYKCZImiZPyLGQBGRYEc21hcjESMBAGCgmSJomT8ixkARkWAmZpMB4XDTE4
|
15
|
+
MDYwNDExMDgzN1oXDTE5MDYwNDExMDgzN1owOTENMAsGA1UEAwwEc21hcjEUMBIG
|
16
16
|
CgmSJomT8ixkARkWBHNtYXIxEjAQBgoJkiaJk/IsZAEZFgJmaTCCASIwDQYJKoZI
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
17
|
+
hvcNAQEBBQADggEPADCCAQoCggEBAKLH8cbuqfv8z6SCy6cJzNAlYcufsEec4k3u
|
18
|
+
kFh083Ccrecp9O+0whVcarpfGgVa8OghGOZCmHKonJmuOhzMYjBRhnJlnnwP/HJg
|
19
|
+
K8azbHhRRsXbNoVXzCC0mz8V0i11L5I7SFwVs68TyI0g4BT2AGoG0jfx10n++W44
|
20
|
+
HqGT7rPaDm3rQN4jn0h1/TMOWM13TylSJmoePfXBC8hxIK6Na0DGotIqeh8EWo27
|
21
|
+
gOKdwYbNyiZrQHB1/lem/NqBwxor6bteD9uz2wx6vv73v/PcV1O3RWK8LwYFFOgd
|
22
|
+
v8anG7G0dnVjyJjqFk3zl/FF0oLwnC1rwqGaCECYnMBtE4TnFd8CAwEAAaNrMGkw
|
23
|
+
CQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFBGivTVHvheyzT0vtiwl
|
24
|
+
cE1wzDxDMBcGA1UdEQQQMA6BDHNtYXJAc21hci5maTAXBgNVHRIEEDAOgQxzbWFy
|
25
|
+
QHNtYXIuZmkwDQYJKoZIhvcNAQEFBQADggEBAILOxHMA9DBO9N4cYuRqjMjzkuQ/
|
26
|
+
88OHAft/sFrVq90yXU3Y7Y5lmD5TDs6DCinIx58q7v8G4J5FIJMZg7rpBTnFvJdZ
|
27
|
+
Z5PAxyENC2PurC8tii6eT67Bosvd0FQ0AnX8wX6e4GQMD02Ie36fnMRZQilW4ARY
|
28
|
+
2rEQcarZGXALJikV0TOmw91t3gOHsFD4PTk8B66R2D06KKhwD7Fq4iI19RhPf/Lx
|
29
|
+
w7Q+3AEK9ifd9ywHO2Ott0JdJEadxhU4N0cI6bQg+uJiSYmdBK0vEJN4lhNg1w37
|
30
|
+
C6hgCMQL3/D3kq732F4KGypqykYwx1wRDGHLxDTBHY26sy/TXfHcj4zPuKA=
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date:
|
32
|
+
date: 2018-06-04 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: trollop
|
@@ -158,7 +158,7 @@ dependencies:
|
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '3.4'
|
160
160
|
description: |-
|
161
|
-
Core library for multi database support in any Ruby project for ActiveRecord
|
161
|
+
Core library for multi database support in any Ruby project for ActiveRecord.
|
162
162
|
Migrations are supported by optional gem multi_ar_migrations.
|
163
163
|
email: smar@smar.fi
|
164
164
|
executables:
|
@@ -195,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
195
195
|
version: '0'
|
196
196
|
requirements: []
|
197
197
|
rubyforge_project:
|
198
|
-
rubygems_version: 2.
|
198
|
+
rubygems_version: 2.6.14
|
199
199
|
signing_key:
|
200
200
|
specification_version: 4
|
201
201
|
summary: Multi database feature set for ActiveRecord
|
metadata.gz.sig
CHANGED
Binary file
|