napa 0.1.15 → 0.1.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e4f80b689c9f468319a5344e2659ee3da3dc0160
4
- data.tar.gz: fae65a84303bb8594fedc3304e8738adc2bf8930
3
+ metadata.gz: 0656c5cfb68fbe78e50bcdaf0801223aa080b5d8
4
+ data.tar.gz: d41e0ac597f0377b8a8503eb511ed0e4b9b15d52
5
5
  SHA512:
6
- metadata.gz: 6e7c700701738067b6f95a8cca9d10e21dab86f1fbbf339750207e0fc911d95e46b714914110d9b20eddb18033e334e1f6625a981379d8017e5f81a7eccc30cc
7
- data.tar.gz: b161248d7731dfd51f173403c2825e9a0d02683ca13264ffc2345db4d114eb7f511623e5d89918399598c40f726532d4b3c17dcecdf7eece9dd3c67cb1b91eb8
6
+ metadata.gz: 0f836563f066fd8be7e31f45b6005a2dee477072a1d52100eba1f834fb680565b6bcc411b523411677c94c32a6f31cf54644cac927ec6eab2e3c181893a08180
7
+ data.tar.gz: 8f31591367c3f71de85d7a4837f296774f3ed38a2f3df58652d5e0d3c03d515222e2929ad6237e47703f45d5ea4747fedd26c3f4266231079ab361a641fdb059
data/lib/napa/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Napa
2
- VERSION = '0.1.15'
2
+ VERSION = '0.1.16'
3
3
 
4
4
  class Version
5
5
  class << self
data/lib/tasks/db.rake CHANGED
@@ -7,7 +7,6 @@ unless defined?(Rails)
7
7
  end
8
8
 
9
9
  namespace :db do
10
-
11
10
  desc "Migrate the database through scripts in db/migrate. Target specific version with VERSION=x"
12
11
  task :migrate => :environment do
13
12
  ActiveRecord::Migrator.migrate('db/migrate', ENV["VERSION"] ? ENV["VERSION"].to_i : nil )
@@ -16,14 +15,18 @@ unless defined?(Rails)
16
15
 
17
16
  desc "Create the database"
18
17
  task :create => :environment do
19
- establish_connection
20
- ActiveRecord::Base.connection.create_database(db_conf.fetch('database'))
18
+ db = YAML.load(ERB.new(File.read('./config/database.yml')).result)[Napa.env]
19
+ adapter = db.merge({'database'=> 'mysql'})
20
+ ActiveRecord::Base.establish_connection(adapter)
21
+ ActiveRecord::Base.connection.create_database(db.fetch('database'))
21
22
  end
22
23
 
23
24
  desc "Delete the database"
24
25
  task :drop => :environment do
25
- establish_connection
26
- ActiveRecord::Base.connection.drop_database(db_conf.fetch('database'))
26
+ db = YAML.load(ERB.new(File.read('./config/database.yml')).result)[Napa.env]
27
+ adapter = db.merge({'database'=> 'mysql'})
28
+ ActiveRecord::Base.establish_connection(adapter)
29
+ ActiveRecord::Base.connection.drop_database(db.fetch('database'))
27
30
  end
28
31
 
29
32
  desc "Create the test database"
@@ -83,19 +86,4 @@ unless defined?(Rails)
83
86
  end
84
87
  end
85
88
  end
86
-
87
- def db_conf
88
- config = YAML.load(ERB.new(File.read('config/database.yml')).result)[Napa.env]
89
- end
90
-
91
- def establish_connection
92
- ActiveRecord::Base.configurations = db_conf
93
- if db_conf['adapter'] == 'em_postgresql' || db_conf['adapter'] == 'postgresql'
94
- # drop and create need to be performed with a connection to the 'postgres' (system) database
95
- ActiveRecord::Base.establish_connection db_conf.merge('database' => 'postgres',
96
- 'schema_search_path' => 'public')
97
- else
98
- ActiveRecord::Base.establish_connection(db_conf)
99
- end
100
- end
101
89
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: napa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darby Frey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-07 00:00:00.000000000 Z
11
+ date: 2014-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake