wcc-base 0.1.3 → 0.2.0

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: 2f48f0ff8ea10a3745e77358d4d9bc3c9579646e
4
- data.tar.gz: 52e37c4701d4c6ff8d610a80133acc422998c069
3
+ metadata.gz: 25e00dba3489248a44d4207066b5fa01991e3fa6
4
+ data.tar.gz: f103d41dfe6881cc08b817327b431a55f3f95a04
5
5
  SHA512:
6
- metadata.gz: 672d6882f793c86e6a3b40164ea5812a886d12b1c81d6b3acbb544e4912cbb87658ebf113de988931cfb93a31ffc5185fa47efad551b022dbdf332bd0dabe9e4
7
- data.tar.gz: 8b9f83aa1bbdd455850446ac9b13585b0f712006ee5e064207bb5f4a3ad6f7d5af52715e1dc688267d085f5cafabea43c59f4200ec7621452cfeaa2a940383c1
6
+ metadata.gz: b629f11aee75a8c05f5791fd5ef300d947a492a63ee8cdfff22601257e36cc379d0baf7c25c93ecdb4dfa227fa4d5f1398bb6ea731f539e6adb988dfe978b905
7
+ data.tar.gz: ef9bc249289288925605192504840dd259c46537abf608a8018b3d39c503c16be69b6874f5a9b09a64407b2cf44d351b79f5dd289e59c9df3e77dc8816e9be9c
@@ -32,14 +32,27 @@ namespace :db do
32
32
  task :restore, :file do |t, args|
33
33
  raise "file argument required" unless File.exists?(args[:file])
34
34
  db_config = WCC::RakeHelpers.db_config
35
- command = [
36
- "cat #{args[:file]} |",
37
- WCC::RakeHelpers.db_cmd_with_password_string(["psql"], db_config['password']),
38
- db_config['username'] ? "--username=#{db_config['username']}" : nil,
39
- db_config['host'] ? "--host=#{db_config['host']}" : nil,
40
- db_config['database'],
41
- ].compact.join(" ")
42
- `#{command}`
35
+ case File.extname(args[:file])
36
+ when ".sql"
37
+ command = [
38
+ "cat #{args[:file]} |",
39
+ WCC::RakeHelpers.db_cmd_with_password_string(["psql"], db_config['password']),
40
+ db_config['username'] ? "--username=#{db_config['username']}" : nil,
41
+ db_config['host'] ? "--host=#{db_config['host']}" : nil,
42
+ db_config['database'],
43
+ ].compact.join(" ")
44
+ `#{command}`
45
+ when ".dump"
46
+ command = [
47
+ "pg_restore",
48
+ "--verbose", "--clean", "--no-acl", "--no-owner",
49
+ db_config['username'] ? ["-U", db_config['username']] : nil,
50
+ db_config['host'] ? ["-h", db_config['host']] : nil,
51
+ "-d", db_config['database'],
52
+ args[:file]
53
+ ].flatten.compact
54
+ system(*command)
55
+ end
43
56
  Rake::Task['db:after_restore'].invoke(args[:file])
44
57
  end
45
58
 
data/lib/wcc/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module WCC
2
- VERSION = "0.1.3"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wcc-base
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Watermark Community Church
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-14 00:00:00.000000000 Z
11
+ date: 2017-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler