seed_dump 0.3.3 → 0.3.4
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.
- data/CHANGELOG.rdoc +9 -0
- data/VERSION +1 -1
- data/lib/seed_dump/perform.rb +21 -3
- data/seed_dump.gemspec +1 -1
- metadata +1 -1
data/CHANGELOG.rdoc
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
== Seed Dump
|
2
2
|
|
3
|
+
== 0.3.4 / 2011-07-14
|
4
|
+
|
5
|
+
* Skip models that aren't Derived from ActiveRecord [iconoclast]
|
6
|
+
* override the AR version of attribute_for_inspect to NOT truncate strings [sc0ttman]
|
7
|
+
|
8
|
+
== 0.3.3 / 2011-07-14
|
9
|
+
|
10
|
+
* solve sorting issue
|
11
|
+
|
3
12
|
== 0.3.2 / 2011-04-22
|
4
13
|
|
5
14
|
* fix broken APPEND option
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.4
|
data/lib/seed_dump/perform.rb
CHANGED
@@ -32,7 +32,7 @@ module SeedDump
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def dumpAttribute(a_s,r,k,v)
|
35
|
-
v =
|
35
|
+
v = attribute_for_inspect(r,k)
|
36
36
|
if k == 'id' && @opts['with_id']
|
37
37
|
@id_set_string = "{ |c| c.#{k} = #{v} }.save"
|
38
38
|
else
|
@@ -66,8 +66,13 @@ module SeedDump
|
|
66
66
|
def dumpModels
|
67
67
|
@seed_rb = ""
|
68
68
|
@models.sort.each do |model|
|
69
|
-
|
70
|
-
|
69
|
+
m = model.constantize
|
70
|
+
if m.ancestors.include?(ActiveRecord::Base)
|
71
|
+
puts "Adding #{model} seeds." if @verbose
|
72
|
+
@seed_rb << dumpModel(m) << "\n\n"
|
73
|
+
else
|
74
|
+
puts "Skipping non-ActiveRecord model #{model}..." if @verbose
|
75
|
+
end
|
71
76
|
end
|
72
77
|
end
|
73
78
|
|
@@ -78,6 +83,19 @@ module SeedDump
|
|
78
83
|
}
|
79
84
|
end
|
80
85
|
|
86
|
+
#override the rails version of this function to NOT truncate strings
|
87
|
+
def attribute_for_inspect(r,k)
|
88
|
+
value = r.attributes[k]
|
89
|
+
|
90
|
+
if value.is_a?(String) && value.length > 50
|
91
|
+
"#{value}".inspect
|
92
|
+
elsif value.is_a?(Date) || value.is_a?(Time)
|
93
|
+
%("#{value.to_s(:db)}")
|
94
|
+
else
|
95
|
+
value.inspect
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
81
99
|
def run(env)
|
82
100
|
|
83
101
|
setup env
|
data/seed_dump.gemspec
CHANGED