dibber 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dibber/seeder.rb +1 -1
- data/lib/dibber/version.rb +6 -2
- data/test/dibber/thing.rb +5 -1
- metadata +2 -2
data/lib/dibber/seeder.rb
CHANGED
@@ -51,7 +51,7 @@ module Dibber
|
|
51
51
|
check_objects_exist
|
52
52
|
objects.each do |name, attributes|
|
53
53
|
object = klass.send(retrieval_method, name)
|
54
|
-
if overwrite or
|
54
|
+
if overwrite or object.new_record?
|
55
55
|
object.send("#{attribute_method}=", attributes)
|
56
56
|
object.save
|
57
57
|
end
|
data/lib/dibber/version.rb
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
module Dibber
|
2
|
-
VERSION = "0.2.
|
2
|
+
VERSION = "0.2.1"
|
3
3
|
end
|
4
4
|
|
5
5
|
# History
|
6
6
|
# =======
|
7
|
+
#
|
8
|
+
# 0.2.1 Fixes bug in overwrite code
|
9
|
+
# System was not correctly identifying when an object was a new record
|
10
|
+
#
|
7
11
|
# 0.2.0 Stops overwriting existing entries unless explicitly directed to
|
8
|
-
#
|
12
|
+
# Now need to specify :overwrite => true when creating a new Seeder if
|
9
13
|
# existing entries are to be overwritten.
|
10
14
|
#
|
11
15
|
# 0.1.1 Working version
|
data/test/dibber/thing.rb
CHANGED
@@ -8,10 +8,14 @@ class Thing
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def save
|
11
|
-
self.class.saved << self
|
11
|
+
self.class.saved << self if new_record?
|
12
12
|
true
|
13
13
|
end
|
14
14
|
|
15
|
+
def new_record?
|
16
|
+
!self.class.saved.include? self
|
17
|
+
end
|
18
|
+
|
15
19
|
def self.find_or_initialize_by_name(name)
|
16
20
|
existing = members.select{|m| m.name == name.to_s}
|
17
21
|
if existing.empty?
|
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.2.
|
4
|
+
version: 0.2.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-04-
|
12
|
+
date: 2013-04-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: active_support
|