engine_migration_initializer 0.0.1 → 0.0.2
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 +4 -4
- data/lib/engine_migration_initializer.rb +14 -12
- data/lib/engine_migration_initializer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5f8d2dc7c2519e3a9b7073158398d7c856de1b5
|
4
|
+
data.tar.gz: 37959cbb65283efb4b8b0344dc5df3962b120c40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c10a379f2b2637b91c07fd7eaa6f5cc524c39a51cd60ef73754c824de64e29abdc91828f3881269351bf86990449017cd0edccc8df314f38996bfd44db09c37
|
7
|
+
data.tar.gz: 9270e619b67cd89a4a4fa9c18026e9730b99ed187c7fd70d6765ed4c07cb6c3fcf9b4848ebaba6a64a99293b2728205037b2b2a114b6cbbfd2a191612536fefb
|
@@ -3,21 +3,23 @@ require "engine_migration_initializer/version"
|
|
3
3
|
# `extend` your engine's engine.rb with this module to
|
4
4
|
# have your host app load your engine's migrations
|
5
5
|
module EngineMigrationInitializer
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
app.config.paths["db/migrate"] += config.paths["db/migrate"].expanded
|
11
|
-
end
|
12
|
-
else # Tested w/ Rails 4
|
13
|
-
begin
|
6
|
+
def self.extended(base)
|
7
|
+
base.initializer :append_migrations do |app|
|
8
|
+
case Rails::VERSION::MAJOR
|
9
|
+
when 3
|
14
10
|
unless app.root.to_s.match root.to_s
|
15
|
-
config.paths["db/migrate"].expanded
|
16
|
-
|
11
|
+
app.config.paths["db/migrate"] += config.paths["db/migrate"].expanded
|
12
|
+
end
|
13
|
+
else # Tested w/ Rails 4
|
14
|
+
begin
|
15
|
+
unless app.root.to_s.match root.to_s
|
16
|
+
config.paths["db/migrate"].expanded.each do |expanded_path|
|
17
|
+
app.config.paths["db/migrate"] << expanded_path
|
18
|
+
end
|
17
19
|
end
|
20
|
+
rescue => e
|
21
|
+
raise "EngineMigrationInitializer did not know how to append_migrations for Rails v#{Rails::VERSION::MAJOR}\nError was: #{e.class} #{e.message}"
|
18
22
|
end
|
19
|
-
rescue => e
|
20
|
-
raise "EngineMigrationInitializer did not know how to append_migrations for Rails v#{Rails::VERSION::MAJOR}\nError was: #{e.class} #{e.message}"
|
21
23
|
end
|
22
24
|
end
|
23
25
|
end
|