dokku-installer-cli 0.0.7 → 0.0.8
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/bin/dokku +56 -1
- data/lib/dokku_installer/version.rb +1 -1
- 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: 77c55952348afc6f97cb4262a61b8bbd4fecf15a
|
4
|
+
data.tar.gz: ee588ed6b3ac1cdaf963bd09e9eaad6e94d420e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00df6dfbdfc530434c4214f0ff72c97e49be3c9b1b6c73ba7f91674ee68147b10dfb6f29ab5868cdcdc4b05175474b1ce4a30f738b7ec9539d56a5f5d8a1ba4a
|
7
|
+
data.tar.gz: 1c94715ce03a72ac17941da93095753e5db128cbd6cf96a00d92ca3444dd4d835297b6528f205079de1cf9209dea565e86f349fc2534df6a6204019aa11f565e
|
data/bin/dokku
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
require "shellwords"
|
3
4
|
require "thor"
|
4
5
|
|
5
6
|
module DokkuInstaller
|
@@ -51,6 +52,60 @@ module DokkuInstaller
|
|
51
52
|
exec("open http://#{app_name}.#{domain}")
|
52
53
|
end
|
53
54
|
|
55
|
+
desc "postgres:backups", "List available PostgreSQL backups"
|
56
|
+
def postgres_backups
|
57
|
+
command = "ssh -t dokku@#{domain} postgres:backups #{app_name}"
|
58
|
+
puts "Running #{command}..."
|
59
|
+
backups = `#{command}`
|
60
|
+
backups.split("\n").reverse.each_with_index do |line, index|
|
61
|
+
number = "#{index + 1}"
|
62
|
+
if number.length < 2
|
63
|
+
number = " #{number}"
|
64
|
+
end
|
65
|
+
puts "#{number}. #{line}"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
desc "postgres:backups:create", "Create a new PostgreSQL backup"
|
70
|
+
def postgres_backups_create
|
71
|
+
run_command "postgres:backups:create #{app_name}"
|
72
|
+
end
|
73
|
+
|
74
|
+
desc "postgres:backups:disable", "Disable daily PostgreSQL backups"
|
75
|
+
def postgres_backups_disable
|
76
|
+
run_command "postgres:backups:disable #{app_name}"
|
77
|
+
end
|
78
|
+
|
79
|
+
desc "postgres:backups:download <number>", "Download the numbered PostgreSQL backup"
|
80
|
+
def postgres_backups_download(*args)
|
81
|
+
# Make sure the number is valid
|
82
|
+
number = args.first ? args.first : 1
|
83
|
+
number = number.to_s.gsub(/\D/, "").to_i
|
84
|
+
if number < 1
|
85
|
+
puts "Invalid backup number"
|
86
|
+
return
|
87
|
+
end
|
88
|
+
|
89
|
+
# Get the file name for the numbered backup
|
90
|
+
puts "Getting list of backups..."
|
91
|
+
command = "ssh -t dokku@#{domain} postgres:backups #{app_name}"
|
92
|
+
backups = `#{command}`
|
93
|
+
index = number - 1
|
94
|
+
backup = backups.split("\n").reverse[index].strip
|
95
|
+
if backup
|
96
|
+
command = "postgres:backups:download #{app_name} #{backup} > #{backup}"
|
97
|
+
puts "Saving to local file: #{backup}"
|
98
|
+
run_command(command)
|
99
|
+
else
|
100
|
+
puts "Invalid backup number"
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
desc "postgres:backups:enable", "Enable daily PostgreSQL backups"
|
105
|
+
def postgres_backups_enable
|
106
|
+
run_command "postgres:backups:enable #{app_name}"
|
107
|
+
end
|
108
|
+
|
54
109
|
desc "restart", "Restart the application"
|
55
110
|
def restart(*args)
|
56
111
|
run_command "restart #{app_name}"
|
@@ -105,7 +160,7 @@ module DokkuInstaller
|
|
105
160
|
end
|
106
161
|
|
107
162
|
def method_missing(method, *args, &block)
|
108
|
-
if method.to_s.split(":").length
|
163
|
+
if method.to_s.split(":").length >= 2
|
109
164
|
self.send(method.to_s.gsub(":", "_"), *args)
|
110
165
|
elsif method == :run
|
111
166
|
self.walk(*args)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dokku-installer-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Pattison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|