effective_developer 0.0.2 → 0.0.3
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 +4 -4
- data/lib/effective_developer/version.rb +1 -1
- data/lib/tasks/pg_pull.rake +37 -8
- 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: 26ec6d6142e9588dfc8f9477c26430dbcbec09fc
|
4
|
+
data.tar.gz: e00454d2b278034b558ca451d81bad7076c2b0dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37f824c6c0e3a972be2d59a44ebf22607d375250800f9eb35901b4bcc44be70c176f5d6393afdc517812f90f58ddf988eb38f9fb4e2e047455829f1c216a7eaa
|
7
|
+
data.tar.gz: 6b5dab0909f0c2fd2cc5ede9a8e697e714245e515f78ba6873993ffefb7137cc2afc62d89362263d82a08d0ada9fee45c7ed13793ad4391a7cbbe25511575d76
|
data/lib/tasks/pg_pull.rake
CHANGED
@@ -11,7 +11,7 @@ namespace :pg do
|
|
11
11
|
|
12
12
|
Bundler.with_clean_env do
|
13
13
|
unless system("heroku pg:backups capture --remote #{args.remote}")
|
14
|
-
puts "Error capturing backup"
|
14
|
+
puts "Error capturing heroku backup"
|
15
15
|
exit
|
16
16
|
end
|
17
17
|
|
@@ -33,14 +33,14 @@ namespace :pg do
|
|
33
33
|
desc 'Loads a postgresql .dump file into the development database (latest.dump by default)'
|
34
34
|
task :load, [:file_name] => :environment do |t, args|
|
35
35
|
args.with_defaults(:file_name => 'latest.dump')
|
36
|
-
db = ActiveRecord::Base.configurations
|
36
|
+
db = ActiveRecord::Base.configurations[Rails.env]
|
37
37
|
|
38
|
-
puts "=== Loading #{args.file_name} into local '#{db[
|
38
|
+
puts "=== Loading #{args.file_name} into local '#{db['database']}' database"
|
39
39
|
|
40
40
|
Rake::Task['db:drop'].invoke
|
41
41
|
Rake::Task['db:create'].invoke
|
42
42
|
|
43
|
-
if system("pg_restore --no-acl --no-owner -h localhost -U #{db[
|
43
|
+
if system("pg_restore --no-acl --no-owner -h localhost -U #{db['username']} -d #{db['database']} #{args.file_name}")
|
44
44
|
puts "Loading database completed"
|
45
45
|
else
|
46
46
|
puts "Error loading database"
|
@@ -52,15 +52,44 @@ namespace :pg do
|
|
52
52
|
desc 'Saves the development database to a postgresql .dump file (latest.dump by default)'
|
53
53
|
task :save, [:file_name] => :environment do |t, args|
|
54
54
|
args.with_defaults(:file_name => 'latest.dump')
|
55
|
-
db = ActiveRecord::Base.configurations
|
55
|
+
db = ActiveRecord::Base.configurations[Rails.env]
|
56
56
|
|
57
|
-
puts "=== Saving local '#{db[
|
57
|
+
puts "=== Saving local '#{db['database']}' database to #{args.file_name}"
|
58
58
|
|
59
|
-
if system("pg_dump -Fc --no-acl --no-owner -h localhost -U '#{db[
|
59
|
+
if system("pg_dump -Fc --no-acl --no-owner -h localhost -U '#{db['username']}' '#{db['database']}' > #{args.file_name}")
|
60
60
|
puts "Saving database completed"
|
61
61
|
else
|
62
|
-
puts "Error saving
|
62
|
+
puts "Error saving database"
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
+
desc 'Clones the production (--remote heroku by default) database to staging (--remote staging by default)'
|
67
|
+
task :clone, [:source_remote, :target_remote] => :environment do |t, args|
|
68
|
+
args.with_defaults(:source_remote => 'heroku', :target_remote => 'staging')
|
69
|
+
db = ActiveRecord::Base.configurations[Rails.env]
|
70
|
+
|
71
|
+
puts "=== Cloning remote '#{args.source_remote}' to '#{args.target_remote}'"
|
72
|
+
|
73
|
+
Bundler.with_clean_env do
|
74
|
+
unless system("heroku pg:backups capture --remote #{args.source_remote}")
|
75
|
+
puts "Error capturing heroku backup"
|
76
|
+
exit
|
77
|
+
end
|
78
|
+
|
79
|
+
url = (`heroku pg:backups public-url --remote #{args.source_remote}`).chomp
|
80
|
+
|
81
|
+
unless (url || '').length > 0
|
82
|
+
puts "Error reading public-url from remote #{args.source_remote}"
|
83
|
+
exit
|
84
|
+
end
|
85
|
+
|
86
|
+
unless system("heroku pg:backups restore '#{url}' DATABASE_URL --remote #{args.target_remote}")
|
87
|
+
puts "Error cloning heroku backup"
|
88
|
+
exit
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
puts 'Cloning database complete'
|
93
|
+
end
|
94
|
+
|
66
95
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_developer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|