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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2a6cc33636d29944af26a86bf4d22d4fe25fe56a
4
- data.tar.gz: 920265be9e844057fdd2211e78b2dffed3663522
3
+ metadata.gz: cc858f94a8c8bd150340f030dec967a1a3ef5805
4
+ data.tar.gz: afde3220e8f47862a130f60b2b1d869874d4f871
5
5
  SHA512:
6
- metadata.gz: 6eb3b46ca76fc17f3770dadaf52935469b3f729e3e8ae1343d976a63bb64d60b37b80b80bedb70b875f6de6c066c4fc412b6c5b14f81c516f8ca233d4325a35e
7
- data.tar.gz: f6eb9a33c2929e40ea451e7defb6dd2eb1ed8d48f8c61c466e4f5dc8ae2de03fe5cc174b0b4ee718d4a53852c6cea03be8818660d946bb2e8e332cd66ef30dd6
6
+ metadata.gz: 69c85a6f120965f87f33e92a9949b333f55b645fc33154a4173dfa8ae8725c4b3cde817030c1b94c15492ade94809def9bf56845f326085b008b708fed0d1528
7
+ data.tar.gz: 27f8c653528cf404084bb3ec8e25d2797519630eb9cca784d20c34661f9b778d2f9ea2a92c5ff1b9eeefa99cbb806acaf84f466551eb80398342b313850c0ede
@@ -10,25 +10,25 @@ module HerokuPull
10
10
  cmd = "heroku pgbackups:capture --expire"
11
11
  puts "Capture the database..."
12
12
  puts cmd
13
- system_with_app_name cmd
13
+ system cmd_with_app_name(cmd)
14
14
  end
15
15
 
16
16
  def download
17
- cmd = "wget -O #{filename} `heroku pgbackups:url`"
17
+ cmd = "wget -O #{filename} `#{cmd_with_app_name("heroku pgbackups:url")}`"
18
18
  puts "Download backup file..."
19
19
  puts cmd
20
- system_with_app_name cmd
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
- system_with_app_name cmd
27
+ system cmd
28
28
  end
29
29
 
30
- def system_with_app_name(cmd)
31
- system(HerokuPull.app_name ? "#{cmd} --app #{HerokuPull.app_name}" : cmd)
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
@@ -1,5 +1,5 @@
1
1
  module Heroku
2
2
  module Pull
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -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).system_with_app_name expected_cmd
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).system_with_app_name expected_cmd
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).system_with_app_name expected_cmd
31
+ mock(HerokuPull).system expected_cmd
32
32
 
33
33
  HerokuPull.restore
34
34
  end
35
35
 
36
- def test_system_with_app_name_set
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.system_with_app_name "COMMAND"
40
+ assert_equal expected_cmd, HerokuPull.cmd_with_app_name("COMMAND")
42
41
  end
43
42
 
44
- def test_system_with_app_name_not_set
43
+ def test_cmd_with_app_name_not_set
45
44
  expected_cmd = "COMMAND"
46
- mock(HerokuPull).system expected_cmd
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroku_pull
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Padilla