fixturease 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/Rakefile +1 -1
  2. data/bin/fixturease.rb +5 -3
  3. metadata +2 -2
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ desc 'Default: run unit tests.'
7
7
  task :default => :spec
8
8
 
9
9
 
10
- PKG_VERSION="0.2.6"
10
+ PKG_VERSION="0.2.7"
11
11
  PKG_FILES=["bin/fixturease.rb","Rakefile","spec/database.yml","spec/fixturease_spec.rb"]
12
12
 
13
13
  spec = Gem::Specification.new do |s|
data/bin/fixturease.rb CHANGED
@@ -16,15 +16,17 @@ else
16
16
  ActiveRecord::Base.connection.rollback_db_transaction
17
17
  ActiveRecord::Base.send :decrement_open_transactions
18
18
  klass = mod.is_a?(Class) ? mod : mod.singularize.camelize.constantize
19
- max_id = klass.find(:first,:order => "id DESC").id
20
- ActiveRecord::Base.connection.execute "ALTER TABLE #{klass.table_name} AUTO_INCREMENT=#{max_id}"
19
+ if klass.count > 0
20
+ max_id = klass.find(:first,:order => "id DESC").id
21
+ ActiveRecord::Base.connection.execute "ALTER TABLE #{klass.table_name} AUTO_INCREMENT=#{max_id}"
22
+ end
21
23
  ActiveRecord::Base.send :increment_open_transactions
22
24
  ActiveRecord::Base.connection.begin_db_transaction
23
25
  else
24
26
  puts "Database adapter #{adapter} is not yet supported. Sorry"
25
27
  end
26
28
  end
27
-
29
+
28
30
  def reset_sequences!
29
31
  Dir[ENV['RAILS_ROOT']+'/'+ENV['FIXTURES_ROOT']+'/*.yml'].each do |fixture_file|
30
32
  reset_sequence! File.basename(fixture_file,".yml")
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: fixturease
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.2.6
7
- date: 2007-01-21 00:00:00 +02:00
6
+ version: 0.2.7
7
+ date: 2007-01-30 00:00:00 +02:00
8
8
  summary: Easy fixture creation tool
9
9
  require_paths:
10
10
  - lib