cbaoth 0.0.4 → 0.0.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e213eb79094532cb8e7b156be7e2ec60f7518a6b
4
- data.tar.gz: 800e042e8de8f3df4db0a70ba6ca1fa09fee3360
3
+ metadata.gz: 832ebc9abaff77a7c407f7e69fe99e8f107f02e2
4
+ data.tar.gz: 25c0cee227502d23c4d94bbf3a74df4d5a8c2d1e
5
5
  SHA512:
6
- metadata.gz: 16a86a35720cbb978c2cf4d738cb4fc31361dd489cb421a924e5454011b2c4f2fa7c7d4ba9dc69040b9ed4828c3c5ea7a75f95abd7a213658fc93aa0eeabd7c5
7
- data.tar.gz: 6001b8f9e0778408a2e026d0b503b7cccf5f5e9b9ec117a7088c84de96ac8b178b714c9972c28f92cbf58c2f9a622e5a9c3a4c21810f1f723bf6c7190a04dd33
6
+ metadata.gz: 2c61f8e2d343243f7c3e78a43703575299c115e6f34d3569fd4dd6db93a17303e1e9819dfc890ce6aa2e8ee4ad774469fe09697eedd45d243d6d62147f7b5a26
7
+ data.tar.gz: 3fe271d34076eadee2bf0c4097e333ca05be8d0cb5fb6222c7dd1f439b118f85e4514346285498216bac9e9935b13467586b298dc201f20e9b7fec301c9a04ef
@@ -14,25 +14,29 @@ namespace :db do
14
14
 
15
15
  task :drop => :environment do
16
16
  puts "----- Drop DB -----"
17
- ActiveRecord::Base.connection.drop_database CONFIG["production"]["database"]
17
+ ActiveRecord::Base.establish_connection CONFIG["production"]
18
+ ActiveRecord::Base.connection.tables.each do |table|
19
+ ActiveRecord::Base.connection.execute("DROP TABLE IF EXISTS #{table}")
20
+ puts "Dropped #{table}"
21
+ end
18
22
  end
19
23
 
20
24
  task :create do
21
25
  puts "----- Create DB -----"
22
26
  config = YAML::load(File.open('config/database.yml'))
23
- config['production']['database'] = 'postgres'
24
- ActiveRecord::Base.establish_connection config['production']
25
- ActiveRecord::Base.connection.create_database CONFIG["production"]["database"]
27
+ base = config['production'].dup
28
+ base['database'] = 'postgres'
29
+ db = ActiveRecord::Base.establish_connection base
30
+ db.connection.create_database CONFIG["production"]["database"]
31
+ db.disconnect! if db.connected?
26
32
 
27
- ActiveRecord::Base.establish_connection CONFIG["production"]["database"]
33
+ ActiveRecord::Base.establish_connection CONFIG["production"]
28
34
  end
29
35
 
30
36
  task :reset => :environment do
31
37
  puts "----- Reset DB -----"
32
38
  Rake::Task["db:drop"].invoke
33
- Rake::Task["db:create"].invoke
34
39
  Rake::Task["db:migrate"].invoke
35
- Rake::Task["db:seed"].invoke
36
40
  end
37
41
 
38
42
  desc "Truncate all existing data"
@@ -60,7 +64,7 @@ namespace :db do
60
64
  ActiveRecord::Base.establish_connection config['test']
61
65
  ActiveRecord::Base.connection.create_database CONFIG["test"]["database"]
62
66
 
63
- ActiveRecord::Base.establish_connection CONFIG["test"]["database"]
67
+ ActiveRecord::Base.establish_connection CONFIG["test"]
64
68
  end
65
69
  end
66
70
 
@@ -1,3 +1,3 @@
1
1
  module Cbaoth
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cbaoth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Curtis Ovard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-27 00:00:00.000000000 Z
11
+ date: 2013-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler