heroku_pull 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/heroku_pull.rb +6 -6
- data/lib/heroku_pull/version.rb +1 -1
- data/test/cases/heroku_pull_test.rb +7 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc858f94a8c8bd150340f030dec967a1a3ef5805
|
4
|
+
data.tar.gz: afde3220e8f47862a130f60b2b1d869874d4f871
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69c85a6f120965f87f33e92a9949b333f55b645fc33154a4173dfa8ae8725c4b3cde817030c1b94c15492ade94809def9bf56845f326085b008b708fed0d1528
|
7
|
+
data.tar.gz: 27f8c653528cf404084bb3ec8e25d2797519630eb9cca784d20c34661f9b778d2f9ea2a92c5ff1b9eeefa99cbb806acaf84f466551eb80398342b313850c0ede
|
data/lib/heroku_pull.rb
CHANGED
@@ -10,25 +10,25 @@ module HerokuPull
|
|
10
10
|
cmd = "heroku pgbackups:capture --expire"
|
11
11
|
puts "Capture the database..."
|
12
12
|
puts cmd
|
13
|
-
|
13
|
+
system cmd_with_app_name(cmd)
|
14
14
|
end
|
15
15
|
|
16
16
|
def download
|
17
|
-
cmd = "wget -O #{filename}
|
17
|
+
cmd = "wget -O #{filename} `#{cmd_with_app_name("heroku pgbackups:url")}`"
|
18
18
|
puts "Download backup file..."
|
19
19
|
puts cmd
|
20
|
-
|
20
|
+
system cmd
|
21
21
|
end
|
22
22
|
|
23
23
|
def restore
|
24
24
|
cmd = "pg_restore --verbose --clean --no-acl --no-owner -h localhost -d #{database} #{filename}"
|
25
25
|
puts "Restore local database..."
|
26
26
|
puts cmd
|
27
|
-
|
27
|
+
system cmd
|
28
28
|
end
|
29
29
|
|
30
|
-
def
|
31
|
-
|
30
|
+
def cmd_with_app_name(cmd)
|
31
|
+
(HerokuPull.app_name ? "#{cmd} --app #{HerokuPull.app_name}" : cmd)
|
32
32
|
end
|
33
33
|
|
34
34
|
def filename
|
data/lib/heroku_pull/version.rb
CHANGED
@@ -13,14 +13,14 @@ class HerokuPullTest < Test::Unit::TestCase
|
|
13
13
|
|
14
14
|
def test_capture
|
15
15
|
expected_cmd = "heroku pgbackups:capture --expire"
|
16
|
-
mock(HerokuPull).
|
16
|
+
mock(HerokuPull).system expected_cmd
|
17
17
|
|
18
18
|
HerokuPull.capture
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_download
|
22
22
|
expected_cmd = "wget -O ./tmp/heroku_pull.sql `heroku pgbackups:url`"
|
23
|
-
mock(HerokuPull).
|
23
|
+
mock(HerokuPull).system expected_cmd
|
24
24
|
|
25
25
|
HerokuPull.download
|
26
26
|
end
|
@@ -28,24 +28,21 @@ class HerokuPullTest < Test::Unit::TestCase
|
|
28
28
|
def test_restore
|
29
29
|
stub(HerokuPull).database { "test_db" }
|
30
30
|
expected_cmd = "pg_restore --verbose --clean --no-acl --no-owner -h localhost -d test_db ./tmp/heroku_pull.sql"
|
31
|
-
mock(HerokuPull).
|
31
|
+
mock(HerokuPull).system expected_cmd
|
32
32
|
|
33
33
|
HerokuPull.restore
|
34
34
|
end
|
35
35
|
|
36
|
-
def
|
36
|
+
def test_cmd_with_app_name_set
|
37
37
|
HerokuPull.app_name = "APP_NAME"
|
38
38
|
expected_cmd = "COMMAND --app APP_NAME"
|
39
|
-
mock(HerokuPull).system expected_cmd
|
40
39
|
|
41
|
-
HerokuPull.
|
40
|
+
assert_equal expected_cmd, HerokuPull.cmd_with_app_name("COMMAND")
|
42
41
|
end
|
43
42
|
|
44
|
-
def
|
43
|
+
def test_cmd_with_app_name_not_set
|
45
44
|
expected_cmd = "COMMAND"
|
46
|
-
|
47
|
-
|
48
|
-
HerokuPull.system_with_app_name expected_cmd
|
45
|
+
assert_equal expected_cmd, HerokuPull.cmd_with_app_name(expected_cmd)
|
49
46
|
end
|
50
47
|
|
51
48
|
def test_filename
|