poring_backup 0.0.5 → 0.0.6

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: 971e64b7209abc93ed7876fb3dad510b489aa000
4
- data.tar.gz: a71168224779945e3c4ff3044c7b3f867f02141f
3
+ metadata.gz: 55877323d31c82a29489546836f6dff31b06932d
4
+ data.tar.gz: 17be911e99d7c6a7f0dc707c4304476a9aa21d8e
5
5
  SHA512:
6
- metadata.gz: 3b0ec4a5e295061091c2b7f97d48c552dbbb8c026fb619d3c6409b07534871aeedffaa49c988de21c670299d9c5477605538e68fe2686f23320a17491205621f
7
- data.tar.gz: 3bf12ddbe1d23b477117383f77d9e2a0bc774b9afd0c18ae530b945e30aa13b55706e334fad882bc07f5f9e09aebf0b4a0d0d7468a21d49f206accca69647b53
6
+ metadata.gz: 412ec66eb4d6b615699c9de77b14e10d913eb831aeeec886f3f01fa4955b14de0bad727810655f38c5a59640be7cc11f025f624748f87e3c47f456c885638be7
7
+ data.tar.gz: db33e0ea6814c61f70a13a5bb22bb656b85fb078a9e2969c2f0fec7f8f016c8c74a2412cbe7c7d635a456ec6d6ca2b4a32705065a07587df5ebd71ebf2ad9a97
@@ -50,11 +50,13 @@ module PoringBackup
50
50
  @username = name
51
51
  end
52
52
 
53
- def password password
53
+ def password password=nil
54
54
  @password = password
55
55
  end
56
56
 
57
57
  def db_dump
58
+ "sudo " +
59
+ "#{password_option}" +
58
60
  "pg_dump #{connection_options} #{general_options} #{db_name}"
59
61
  end
60
62
 
@@ -68,11 +70,13 @@ module PoringBackup
68
70
  options << "--host=#{@host || 'localhost'}"
69
71
  options << " --port=#{@port}" if @port
70
72
  options << " --username=#{@username}" if @username
71
- # options << " --no-password"
72
- # options << " --password"
73
73
  options
74
74
  end
75
75
 
76
+ def password_option
77
+ "PGPASSWORD=#{ Shellwords.escape(@password) } " if @password
78
+ end
79
+
76
80
  def general_options
77
81
  options = ''
78
82
  options << "--file=#{tmp_file_path}"
@@ -1,3 +1,3 @@
1
1
  module PoringBackup
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -14,12 +14,12 @@ PoringBackup.config 'PiYa Server' do
14
14
  database :PostgreSQL do
15
15
  database 'onebox_core_development'
16
16
  username 'Mac'
17
- # password 'password'
17
+ # password
18
18
  end
19
19
 
20
20
  store_with :S3 do
21
- access_key_id 'AKIAJOO6YDGD6K7MDIVA'
22
- secret_access_key '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'
21
+ access_key_id 'AKIAJKKDUOBX5Z2J5RBQ'
22
+ secret_access_key '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'
23
23
  bucket 'oneboxcore-dev'
24
24
  region 'ap-southeast-1'
25
25
  path 'backups'
@@ -154,3 +154,23 @@ DEBUG PoringBackup::Log : clear tmp directory
154
154
  INFO PoringBackup::Log : --------- Notifier --------
155
155
  INFO PoringBackup::Log : Slack notify : success
156
156
  INFO PoringBackup::Log : PoringBackup Done
157
+ INFO PoringBackup::Log : PoringBackup Start...
158
+ INFO PoringBackup::Log : --------- Backup ----------
159
+ INFO PoringBackup::Log : PostgreSQL backup processing
160
+ INFO PoringBackup::Log : success
161
+ INFO PoringBackup::Log : finished
162
+ INFO PoringBackup::Log : ---------- Store ----------
163
+ INFO PoringBackup::Log : S3 processing
164
+ INFO PoringBackup::Log : PoringBackup Start...
165
+ INFO PoringBackup::Log : --------- Backup ----------
166
+ INFO PoringBackup::Log : PostgreSQL backup processing
167
+ INFO PoringBackup::Log : success
168
+ INFO PoringBackup::Log : finished
169
+ INFO PoringBackup::Log : ---------- Store ----------
170
+ INFO PoringBackup::Log : S3 processing
171
+ INFO PoringBackup::Log : uploaded: backups/db_backups/2015.07.13.11.14.29/onebox_core_development.pgsql
172
+ INFO PoringBackup::Log : finished
173
+ DEBUG PoringBackup::Log : clear tmp directory
174
+ INFO PoringBackup::Log : --------- Notifier --------
175
+ INFO PoringBackup::Log : Slack notify : success
176
+ INFO PoringBackup::Log : PoringBackup Done
@@ -56,3 +56,9 @@ DEBUG PoringBackup::Log : clear tmp directory
56
56
  INFO PoringBackup::Log : Slack notify : success
57
57
  WARN PoringBackup::Log : Slack notify : failed : Invalid channel specified
58
58
  DEBUG PoringBackup::Log : clear tmp directory
59
+ INFO PoringBackup::Log : Slack notify : success
60
+ WARN PoringBackup::Log : Slack notify : failed : Invalid channel specified
61
+ DEBUG PoringBackup::Log : clear tmp directory
62
+ INFO PoringBackup::Log : Slack notify : success
63
+ WARN PoringBackup::Log : Slack notify : failed : Invalid channel specified
64
+ DEBUG PoringBackup::Log : clear tmp directory
@@ -2427,3 +2427,188 @@
2427
2427
   (0.1ms) ROLLBACK
2428
2428
   (0.1ms) BEGIN
2429
2429
   (0.1ms) ROLLBACK
2430
+ ActiveRecord::SchemaMigration Load (27.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
2431
+  (121.3ms) DROP DATABASE IF EXISTS "poring_backup_test"
2432
+  (362.8ms) CREATE DATABASE "poring_backup_test" ENCODING = 'unicode' TEMPLATE = "template0"
2433
+ SQL (2.4ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"
2434
+  (4.9ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL)
2435
+  (1.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
2436
+  (0.4ms) SELECT version FROM "schema_migrations"
2437
+  (0.4ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
2438
+ ActiveRecord::SchemaMigration Load (0.5ms) SELECT "schema_migrations".* FROM "schema_migrations"
2439
+  (0.3ms) BEGIN
2440
+  (0.3ms) ROLLBACK
2441
+  (0.2ms) BEGIN
2442
+  (0.3ms) ROLLBACK
2443
+  (0.1ms) BEGIN
2444
+  (0.2ms) ROLLBACK
2445
+  (0.1ms) BEGIN
2446
+  (0.2ms) ROLLBACK
2447
+  (0.1ms) BEGIN
2448
+  (0.2ms) ROLLBACK
2449
+  (0.1ms) BEGIN
2450
+  (0.2ms) ROLLBACK
2451
+  (0.1ms) BEGIN
2452
+  (0.2ms) ROLLBACK
2453
+  (0.1ms) BEGIN
2454
+  (0.2ms) ROLLBACK
2455
+  (0.1ms) BEGIN
2456
+  (0.2ms) ROLLBACK
2457
+  (0.1ms) BEGIN
2458
+  (0.1ms) ROLLBACK
2459
+  (0.1ms) BEGIN
2460
+  (0.1ms) ROLLBACK
2461
+  (0.1ms) BEGIN
2462
+  (0.1ms) ROLLBACK
2463
+  (0.1ms) BEGIN
2464
+  (0.1ms) ROLLBACK
2465
+  (0.1ms) BEGIN
2466
+  (0.1ms) ROLLBACK
2467
+  (0.1ms) BEGIN
2468
+  (0.1ms) ROLLBACK
2469
+  (0.1ms) BEGIN
2470
+  (0.1ms) ROLLBACK
2471
+  (0.1ms) BEGIN
2472
+  (0.1ms) ROLLBACK
2473
+  (0.1ms) BEGIN
2474
+  (0.1ms) ROLLBACK
2475
+  (0.1ms) BEGIN
2476
+  (0.1ms) ROLLBACK
2477
+  (0.1ms) BEGIN
2478
+  (0.1ms) ROLLBACK
2479
+  (0.1ms) BEGIN
2480
+  (0.1ms) ROLLBACK
2481
+  (0.1ms) BEGIN
2482
+  (0.1ms) ROLLBACK
2483
+  (0.1ms) BEGIN
2484
+  (0.1ms) ROLLBACK
2485
+  (0.1ms) BEGIN
2486
+  (0.2ms) ROLLBACK
2487
+  (0.1ms) BEGIN
2488
+  (0.2ms) ROLLBACK
2489
+  (0.1ms) BEGIN
2490
+  (0.1ms) ROLLBACK
2491
+  (0.1ms) BEGIN
2492
+  (0.1ms) ROLLBACK
2493
+  (0.2ms) BEGIN
2494
+  (0.2ms) ROLLBACK
2495
+  (0.1ms) BEGIN
2496
+  (0.1ms) ROLLBACK
2497
+  (0.1ms) BEGIN
2498
+  (0.2ms) ROLLBACK
2499
+  (0.1ms) BEGIN
2500
+  (0.1ms) ROLLBACK
2501
+  (0.1ms) BEGIN
2502
+  (0.1ms) ROLLBACK
2503
+  (0.1ms) BEGIN
2504
+  (0.1ms) ROLLBACK
2505
+  (0.1ms) BEGIN
2506
+  (0.2ms) ROLLBACK
2507
+  (0.1ms) BEGIN
2508
+  (0.1ms) ROLLBACK
2509
+  (0.1ms) BEGIN
2510
+  (0.1ms) ROLLBACK
2511
+  (0.1ms) BEGIN
2512
+  (0.1ms) ROLLBACK
2513
+  (0.1ms) BEGIN
2514
+  (0.1ms) ROLLBACK
2515
+  (0.1ms) BEGIN
2516
+  (0.1ms) ROLLBACK
2517
+ ActiveRecord::SchemaMigration Load (0.6ms) SELECT "schema_migrations".* FROM "schema_migrations"
2518
+  (115.6ms) DROP DATABASE IF EXISTS "poring_backup_test"
2519
+  (364.5ms) CREATE DATABASE "poring_backup_test" ENCODING = 'unicode' TEMPLATE = "template0"
2520
+ SQL (0.3ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"
2521
+  (3.8ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL)
2522
+  (1.5ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
2523
+  (0.3ms) SELECT version FROM "schema_migrations"
2524
+  (0.4ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
2525
+ ActiveRecord::SchemaMigration Load (0.5ms) SELECT "schema_migrations".* FROM "schema_migrations"
2526
+ ActiveRecord::SchemaMigration Load (0.5ms) SELECT "schema_migrations".* FROM "schema_migrations"
2527
+  (112.6ms) DROP DATABASE IF EXISTS "poring_backup_test"
2528
+  (317.8ms) CREATE DATABASE "poring_backup_test" ENCODING = 'unicode' TEMPLATE = "template0"
2529
+ SQL (0.5ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"
2530
+  (3.8ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL)
2531
+  (1.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
2532
+  (0.3ms) SELECT version FROM "schema_migrations"
2533
+  (0.5ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
2534
+ ActiveRecord::SchemaMigration Load (0.4ms) SELECT "schema_migrations".* FROM "schema_migrations"
2535
+  (0.3ms) BEGIN
2536
+  (0.3ms) ROLLBACK
2537
+  (0.2ms) BEGIN
2538
+  (0.2ms) ROLLBACK
2539
+  (0.1ms) BEGIN
2540
+  (0.2ms) ROLLBACK
2541
+  (0.1ms) BEGIN
2542
+  (0.2ms) ROLLBACK
2543
+  (0.1ms) BEGIN
2544
+  (0.2ms) ROLLBACK
2545
+  (0.1ms) BEGIN
2546
+  (0.2ms) ROLLBACK
2547
+  (0.1ms) BEGIN
2548
+  (0.2ms) ROLLBACK
2549
+  (0.1ms) BEGIN
2550
+  (0.2ms) ROLLBACK
2551
+  (0.1ms) BEGIN
2552
+  (0.2ms) ROLLBACK
2553
+  (0.1ms) BEGIN
2554
+  (0.1ms) ROLLBACK
2555
+  (0.1ms) BEGIN
2556
+  (0.1ms) ROLLBACK
2557
+  (0.1ms) BEGIN
2558
+  (0.1ms) ROLLBACK
2559
+  (0.1ms) BEGIN
2560
+  (0.1ms) ROLLBACK
2561
+  (0.1ms) BEGIN
2562
+  (0.1ms) ROLLBACK
2563
+  (0.1ms) BEGIN
2564
+  (0.1ms) ROLLBACK
2565
+  (0.1ms) BEGIN
2566
+  (0.2ms) ROLLBACK
2567
+  (0.1ms) BEGIN
2568
+  (0.1ms) ROLLBACK
2569
+  (0.1ms) BEGIN
2570
+  (0.1ms) ROLLBACK
2571
+  (0.1ms) BEGIN
2572
+  (0.1ms) ROLLBACK
2573
+  (0.1ms) BEGIN
2574
+  (0.1ms) ROLLBACK
2575
+  (0.1ms) BEGIN
2576
+  (0.1ms) ROLLBACK
2577
+  (0.1ms) BEGIN
2578
+  (0.1ms) ROLLBACK
2579
+  (0.1ms) BEGIN
2580
+  (0.1ms) ROLLBACK
2581
+  (0.1ms) BEGIN
2582
+  (0.1ms) ROLLBACK
2583
+  (0.1ms) BEGIN
2584
+  (0.3ms) ROLLBACK
2585
+  (0.1ms) BEGIN
2586
+  (0.1ms) ROLLBACK
2587
+  (0.1ms) BEGIN
2588
+  (0.1ms) ROLLBACK
2589
+  (0.1ms) BEGIN
2590
+  (0.1ms) ROLLBACK
2591
+  (0.1ms) BEGIN
2592
+  (0.1ms) ROLLBACK
2593
+  (0.1ms) BEGIN
2594
+  (0.1ms) ROLLBACK
2595
+  (0.1ms) BEGIN
2596
+  (0.2ms) ROLLBACK
2597
+  (0.1ms) BEGIN
2598
+  (0.1ms) ROLLBACK
2599
+  (0.1ms) BEGIN
2600
+  (0.1ms) ROLLBACK
2601
+  (0.1ms) BEGIN
2602
+  (0.1ms) ROLLBACK
2603
+  (0.1ms) BEGIN
2604
+  (0.2ms) ROLLBACK
2605
+  (0.1ms) BEGIN
2606
+  (0.1ms) ROLLBACK
2607
+  (0.1ms) BEGIN
2608
+  (0.1ms) ROLLBACK
2609
+  (0.1ms) BEGIN
2610
+  (0.1ms) ROLLBACK
2611
+  (0.1ms) BEGIN
2612
+  (0.1ms) ROLLBACK
2613
+  (0.1ms) BEGIN
2614
+  (0.1ms) ROLLBACK
@@ -33,7 +33,9 @@ module PoringBackup
33
33
  context "#db_dump gets command for db dump" do
34
34
  it "full command" do
35
35
  dump_cmd = pg.db_dump
36
- expect_cmd = 'pg_dump'
36
+ expect_cmd = 'sudo'
37
+ expect_cmd << ' PGPASSWORD=new_password_name'
38
+ expect_cmd << ' pg_dump'
37
39
  expect_cmd << " --host=new_host_name"
38
40
  expect_cmd << " --port=new_port_name"
39
41
  expect_cmd << " --username=new_username_name"
@@ -58,6 +60,11 @@ module PoringBackup
58
60
  dump_cmd = pg.db_dump
59
61
  expect(dump_cmd).not_to match /--username/
60
62
  end
63
+ it "password" do
64
+ pg.password(nil)
65
+ dump_cmd = pg.db_dump
66
+ expect(dump_cmd).not_to match /PGPASSWORD=/
67
+ end
61
68
  end
62
69
  end
63
70
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poring_backup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - PiYa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-27 00:00:00.000000000 Z
11
+ date: 2015-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails