data_seeder 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/data_seeder/seed_file.rb +1 -0
- data/lib/data_seeder/loader.rb +6 -3
- data/lib/data_seeder/version.rb +1 -1
- data/test/dummy/log/test.log +19076 -0
- data/test/dummy/tmp/db.seed.test.txt.20720/countries_txt/countries.cfg +6 -0
- data/test/dummy/tmp/db.seed.test.txt.20720/countries_txt/countries.txt +249 -0
- data/test/dummy/tmp/db.seed.test.txt.20720/states_txt/states.cfg +6 -0
- data/test/dummy/tmp/db.seed.test.txt.20720/states_txt/states.txt +0 -0
- data/test/models/data_seeder_test.rb +6 -2
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b92ca5944c206044ac760c64b7608131aa5c45b8
|
4
|
+
data.tar.gz: 3cbe704d87ecffc3feef1ce522a2d4b330508ddf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7a2df29175105395e24e038194e20a6df9fab7ad0d220742324048bc43bbc5ed53bff5cef33a6d645eeba2b0cb7040389c117979091357415f09a500f94f8b9
|
7
|
+
data.tar.gz: a452884b14ce9485ac9028cd66214ab96c11e5044a04ed7982b93e8ac23307c988375fe65b3c300a3fc0fd63310975356a69e214a9dcc02299ee213fd503c60f
|
@@ -50,6 +50,7 @@ module DataSeeder
|
|
50
50
|
DataSeeder.config.logger.warn "Warning: No loader for #{path}"
|
51
51
|
return true
|
52
52
|
end
|
53
|
+
# This is deprecated. Use instance method instead so seeds can be manually loaded
|
53
54
|
if loader_klass.respond_to?(:default_config)
|
54
55
|
config = loader_klass.default_config.merge(config)
|
55
56
|
end
|
data/lib/data_seeder/loader.rb
CHANGED
@@ -6,16 +6,19 @@ module DataSeeder
|
|
6
6
|
|
7
7
|
def initialize(config)
|
8
8
|
@seeder_config = DataSeeder.config
|
9
|
-
@config = config
|
9
|
+
@config = default_config.merge(config)
|
10
10
|
@key_attribute = config[:key_attribute] || :id
|
11
11
|
@klass = config[:klass]
|
12
12
|
@path = config[:path]
|
13
13
|
@path_minus_ext = config[:path_minus_ext]
|
14
|
-
# Default purge to true if unspecified
|
15
|
-
@config[:purge] = true unless config.has_key?(:purge)
|
16
14
|
@old_ids = Set.new
|
17
15
|
end
|
18
16
|
|
17
|
+
# Override with config defaults
|
18
|
+
def default_config
|
19
|
+
{ purge: true }
|
20
|
+
end
|
21
|
+
|
19
22
|
def logger
|
20
23
|
@seeder_config.logger
|
21
24
|
end
|
data/lib/data_seeder/version.rb
CHANGED