seed_dump 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,5 +1,9 @@
1
1
  == Seed Dump
2
2
 
3
+ == 0.3.1 / 2011-04-22
4
+
5
+ * use different syntax for multiple rows
6
+
3
7
  == 0.3.0 / 2011-04-22
4
8
 
5
9
  * refactor to make testing possible
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -38,22 +38,30 @@ module SeedDump
38
38
  end
39
39
 
40
40
  def self.dumpModel(model)
41
+ @id_set_string = ''
41
42
  create_hash = ""
42
- arr = []
43
+ rows = []
43
44
  arr = model.find(:all, @ar_options) unless @opts['no-data']
44
45
  arr = arr.empty? ? [model.new] : arr
45
46
  arr.each_with_index { |r,i|
46
47
  attr_s = [];
47
48
  r.attributes.each { |k,v| dumpAttribute(attr_s,r,k,v) }
48
- create_hash << "\n#{model}.create" << '( ' << attr_s.join(', ') << ' )' << @id_set_string
49
+ if @id_set_string.empty?
50
+ rows.push "#{@indent}{ " << attr_s.join(', ') << " }"
51
+ else
52
+ create_hash << "\n#{model}.create" << '( ' << attr_s.join(', ') << ' )' << @id_set_string
53
+ end
49
54
  }
50
- create_hash
55
+ if @id_set_string.empty?
56
+ "\n#{model}.create([\n" << rows.join(",\n") << "\n])\n"
57
+ else
58
+ create_hash
59
+ end
51
60
  end
52
61
 
53
62
  def self.dumpModels
54
63
  @seed_rb = ""
55
64
  @models.sort.each do |model|
56
- @id_set_string = ''
57
65
  puts "Adding #{model} seeds." if @verbose
58
66
  @seed_rb << dumpModel(model) << "\n\n"
59
67
  end
data/seed_dump.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{seed_dump}
8
- s.version = "0.3.0"
8
+ s.version = "0.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Rob Halff"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seed_dump
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: