merb_activerecord 1.0.0 → 1.0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -17,7 +17,7 @@ GEM_EMAIL = "canadaduane@gmail.com"
17
17
 
18
18
  GEM_NAME = "merb_activerecord"
19
19
  PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
20
- GEM_VERSION = ("1.0.0") + PKG_BUILD
20
+ GEM_VERSION = ("1.0.0.1") + PKG_BUILD
21
21
 
22
22
  RELEASE_NAME = "REL #{GEM_VERSION}"
23
23
 
@@ -53,14 +53,21 @@ namespace :db do
53
53
  end
54
54
 
55
55
  def drop_database(config)
56
- case config[:adapter]
57
- when 'mysql'
58
- ActiveRecord::Base.connection.drop_database config[:database]
59
- when /^sqlite/
60
- FileUtils.rm(File.join(Merb.root, config[:database]))
61
- when 'postgresql'
62
- ActiveRecord::Base.clear_active_connections!
63
- `dropdb "#{config[:database]}"`
56
+ begin
57
+ ActiveRecord::Base.establish_connection(config)
58
+ ActiveRecord::Base.connection
59
+ rescue
60
+ puts "could not connect to #{config[:database]}, database not dropped"
61
+ else
62
+ case config[:adapter]
63
+ when 'mysql'
64
+ ActiveRecord::Base.connection.drop_database config[:database]
65
+ when /^sqlite/
66
+ FileUtils.rm(File.join(Merb.root, config[:database]))
67
+ when 'postgresql'
68
+ ActiveRecord::Base.clear_active_connections!
69
+ `dropdb "#{config[:database]}"`
70
+ end
64
71
  end
65
72
  end
66
73
 
@@ -27,10 +27,10 @@ if defined?(Merb::Plugins)
27
27
 
28
28
  def self.run
29
29
  Merb.logger.debug "Disconnecting database connection before forking."
30
- ::ActiveRecord::Base.connection.disconnect!
30
+ ::ActiveRecord::Base.clear_active_connections!
31
31
  end
32
-
33
- end
32
+ end
33
+
34
34
 
35
35
  generators = File.join(File.dirname(__FILE__), 'generators')
36
36
  Merb.add_generators generators / :migration
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merb_activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Duane Johnson