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 +4 -4
- data/lib/napa/version.rb +1 -1
- data/lib/tasks/db.rake +8 -20
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0656c5cfb68fbe78e50bcdaf0801223aa080b5d8
|
4
|
+
data.tar.gz: d41e0ac597f0377b8a8503eb511ed0e4b9b15d52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f836563f066fd8be7e31f45b6005a2dee477072a1d52100eba1f834fb680565b6bcc411b523411677c94c32a6f31cf54644cac927ec6eab2e3c181893a08180
|
7
|
+
data.tar.gz: 8f31591367c3f71de85d7a4837f296774f3ed38a2f3df58652d5e0d3c03d515222e2929ad6237e47703f45d5ea4747fedd26c3f4266231079ab361a641fdb059
|
data/lib/napa/version.rb
CHANGED
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
|
-
|
20
|
-
|
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
|
-
|
26
|
-
|
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.
|
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-
|
11
|
+
date: 2014-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|