erp_base_erp_svcs 3.1.4 → 3.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/erp_base_erp_svcs/version.rb +1 -1
- data/lib/tasks/compass_backup.rake +8 -3
- metadata +2 -4
- data/spec/dummy/log/spec.log +0 -9255
@@ -2,12 +2,17 @@ require "active_record"
|
|
2
2
|
|
3
3
|
namespace :compass_ae do
|
4
4
|
namespace :backup do
|
5
|
-
|
5
|
+
|
6
6
|
PG_BACKUP_DIR = '/backup/postgres'
|
7
7
|
SU_POSTGRES = true # set this to false on OS X and true on debian
|
8
8
|
TIMESTAMP_FORMAT = "%Y-%m-%d_%Hh%Mm%Ss" # keep a single underscore or the purge_old task will break
|
9
9
|
@purge_dumps_older_than = 2.weeks.ago
|
10
|
-
|
10
|
+
|
11
|
+
db_config = Rails.configuration.database_configuration[Rails.env]
|
12
|
+
host = db_config['host'].blank? ? 'localhost' : db_config['host']
|
13
|
+
username = db_config['username'].blank? ? 'postgres' : db_config['username']
|
14
|
+
pgpw = ENV['PGPASSWORD'].nil? ? '' : "PGPASSWORD=#{ENV['PGPASSWORD']}"
|
15
|
+
|
11
16
|
desc 'backup all postgres databases'
|
12
17
|
task :postgres => :environment do
|
13
18
|
create_directory(PG_BACKUP_DIR)
|
@@ -18,7 +23,7 @@ namespace :compass_ae do
|
|
18
23
|
databases.each do |db|
|
19
24
|
unless db == "template0"
|
20
25
|
puts "Dumping #{db} to #{PG_BACKUP_DIR}"
|
21
|
-
cmd = "pg_dump #{db} > #{PG_BACKUP_DIR}/#{db}_#{Time.now.strftime(TIMESTAMP_FORMAT)}.pgsql"
|
26
|
+
cmd = "#{pgpw} pg_dump -U #{username} -h #{host} #{db} > #{PG_BACKUP_DIR}/#{db}_#{Time.now.strftime(TIMESTAMP_FORMAT)}.pgsql"
|
22
27
|
cmd = "sudo su postgres -c \"#{cmd}\"" if SU_POSTGRES
|
23
28
|
execute_command(cmd)
|
24
29
|
else
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: erp_base_erp_svcs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: attr_encrypted
|
@@ -334,7 +334,6 @@ files:
|
|
334
334
|
- spec/dummy/db/migrate/20130422154232_add_long_lat_to_address.erp_base_erp_svcs.rb
|
335
335
|
- spec/dummy/db/schema.rb
|
336
336
|
- spec/dummy/db/spec.sqlite3
|
337
|
-
- spec/dummy/log/spec.log
|
338
337
|
- spec/dummy/public/404.html
|
339
338
|
- spec/dummy/public/422.html
|
340
339
|
- spec/dummy/public/500.html
|
@@ -431,7 +430,6 @@ test_files:
|
|
431
430
|
- spec/dummy/db/migrate/20130422154232_add_long_lat_to_address.erp_base_erp_svcs.rb
|
432
431
|
- spec/dummy/db/schema.rb
|
433
432
|
- spec/dummy/db/spec.sqlite3
|
434
|
-
- spec/dummy/log/spec.log
|
435
433
|
- spec/dummy/public/404.html
|
436
434
|
- spec/dummy/public/422.html
|
437
435
|
- spec/dummy/public/500.html
|