dibber 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dibber/seeder.rb +13 -2
- data/lib/dibber/version.rb +3 -1
- metadata +2 -2
data/lib/dibber/seeder.rb
CHANGED
@@ -23,7 +23,7 @@ module Dibber
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def self.report
|
26
|
-
process_log.report
|
26
|
+
process_log.report + error_report
|
27
27
|
end
|
28
28
|
|
29
29
|
def self.monitor(klass)
|
@@ -61,7 +61,9 @@ module Dibber
|
|
61
61
|
object = klass.send(retrieval_method, name)
|
62
62
|
if overwrite or object.new_record?
|
63
63
|
object.send("#{attribute_method}=", attributes)
|
64
|
-
object.save
|
64
|
+
unless object.save
|
65
|
+
self.class.errors << object.errors
|
66
|
+
end
|
65
67
|
end
|
66
68
|
end
|
67
69
|
end
|
@@ -74,6 +76,15 @@ module Dibber
|
|
74
76
|
@objects ||= self.class.objects_from(file)
|
75
77
|
end
|
76
78
|
|
79
|
+
def self.errors
|
80
|
+
@errors ||= []
|
81
|
+
end
|
82
|
+
|
83
|
+
def self.error_report
|
84
|
+
return [] if errors.empty?
|
85
|
+
["#{errors.length} errors detected:", errors.collect(&:inspect)].flatten
|
86
|
+
end
|
87
|
+
|
77
88
|
private
|
78
89
|
def self.raise_no_seeds_path_error
|
79
90
|
raise "You must set the path to your seed files via Seeder.seeds_path = 'path/to/seed/files'"
|
data/lib/dibber/version.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
module Dibber
|
2
|
-
VERSION = "0.3.
|
2
|
+
VERSION = "0.3.1"
|
3
3
|
end
|
4
4
|
|
5
5
|
# History
|
6
6
|
# =======
|
7
|
+
# 0.3.1 Adds error messages when object save fails
|
8
|
+
#
|
7
9
|
# 0.3.0 Adds seed method
|
8
10
|
# Allows seeding to be carried out via Dibber::Seeder.seed(:thing).
|
9
11
|
# Also tidies up examples
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dibber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-09-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: active_support
|