mite-backup 0.2.0 → 0.4.0
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/README.md +8 -5
- data/bin/mite-backup +15 -6
- data/lib/mite-backup/version.rb +1 -1
- data/lib/mite-backup.rb +9 -4
- data/mite-backup.gemspec +3 -3
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82dc410490760d47c7e783794c7af737c9343e84a98920bfab76144c80f18e70
|
4
|
+
data.tar.gz: 6d75fcd54eba20894b26276c58d413c6ca6936318e43e8a83cc09333567cf653
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8307b404dcf3723854192b588a60af8fd41301e81a0775654a1d5414a04bc8a42be757885aa05607c15376349f9d5cb85b840f7f7296af095b5017a146549454
|
7
|
+
data.tar.gz: ea5ea690a83a0015f70260cf7a49e3a0d101a2b8c16b9d2debb96e272727f500ccc7acde7a9f87b9075c97e874016b57101fc30732d77633f93d7f6fbdc5c8e6
|
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
-
|
1
|
+
mite-backup
|
2
|
+
===========
|
2
3
|
|
3
|
-
|
4
|
+
[](http://badge.fury.io/rb/mite-backup)
|
5
|
+
|
6
|
+
Simple command-line tool for downloading a backup in XML of your [mite](http://mite.de/en).account.
|
4
7
|
|
5
8
|
## Installation
|
6
9
|
|
@@ -16,10 +19,10 @@ This will output the backup file in XML to the prompt. You propably want to pipe
|
|
16
19
|
|
17
20
|
For further instructions run
|
18
21
|
|
19
|
-
mite-backup
|
22
|
+
mite-backup --help
|
20
23
|
|
21
24
|
## BlaBla
|
22
25
|
|
23
|
-
Copyright (c) 2011-
|
26
|
+
Copyright (c) 2011-2023 [mite GmbH](https://mite.de/en/)
|
24
27
|
|
25
|
-
Beyond that, the implementation is licensed under the MIT License.
|
28
|
+
Beyond that, the implementation is licensed under the MIT License.
|
data/bin/mite-backup
CHANGED
@@ -5,7 +5,9 @@ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
|
|
5
5
|
require 'mite-backup'
|
6
6
|
require 'optparse'
|
7
7
|
|
8
|
-
@options = {
|
8
|
+
@options = {
|
9
|
+
"wait_for" => MiteBackup::DEFAULT_WAIT_FOR
|
10
|
+
}
|
9
11
|
|
10
12
|
parser = OptionParser.new do |opts|
|
11
13
|
opts.banner = "Usage: mite-backup COMMAND [options]"
|
@@ -13,18 +15,25 @@ parser = OptionParser.new do |opts|
|
|
13
15
|
opts.separator ""
|
14
16
|
opts.separator "Options:"
|
15
17
|
|
16
|
-
opts.on("-a", "--account
|
18
|
+
opts.on("-a", "--account ACCOUNT-SUBDOMAIN", "your mite account subdomain (without .mite.de)") do |account|
|
17
19
|
@options["account"] = account
|
18
20
|
end
|
19
21
|
|
20
|
-
opts.on("-e", "--email
|
22
|
+
opts.on("-e", "--email EMAIL", "mite.user email") do |email|
|
21
23
|
@options["email"] = email
|
22
24
|
end
|
23
25
|
|
24
|
-
opts.on("-p", "--password
|
26
|
+
opts.on("-p", "--password PASSWORD", "mite.user password") do |password|
|
25
27
|
@options["password"] = password
|
26
28
|
end
|
27
29
|
|
30
|
+
opts.on(
|
31
|
+
"-w", "--wait-for SECONDS", Integer,
|
32
|
+
"Number of seconds to wait for backup to be ready. Defaults to 240 seconds."
|
33
|
+
) do |seconds|
|
34
|
+
@options["wait_for"] = seconds
|
35
|
+
end
|
36
|
+
|
28
37
|
opts.on("-c", "--clear", "Removes all config values from config file.") do
|
29
38
|
@options["clear_config"] = true
|
30
39
|
end
|
@@ -37,7 +46,7 @@ parser = OptionParser.new do |opts|
|
|
37
46
|
opts.separator ""
|
38
47
|
opts.separator "Commands:"
|
39
48
|
opts.separator " get Download backupfile and ouput xml to STDOUT (Default command)"
|
40
|
-
opts.separator " setup
|
49
|
+
opts.separator " setup Write given options to config file ~/.mite-backup.yml, so you don't need to repeat them on every get command."
|
41
50
|
opts.separator ""
|
42
51
|
end
|
43
52
|
|
@@ -53,4 +62,4 @@ else
|
|
53
62
|
puts ""
|
54
63
|
puts parser.help
|
55
64
|
exit(1)
|
56
|
-
end
|
65
|
+
end
|
data/lib/mite-backup/version.rb
CHANGED
data/lib/mite-backup.rb
CHANGED
@@ -6,7 +6,7 @@ require 'zlib'
|
|
6
6
|
require 'yaml'
|
7
7
|
|
8
8
|
class MiteBackup
|
9
|
-
|
9
|
+
DEFAULT_WAIT_FOR = 240 # seconds
|
10
10
|
SLEEP_BEFORE_EACH_CHECK = 5 # seconds
|
11
11
|
CONFIG_FILE = File.expand_path('~/.mite-backup.yml')
|
12
12
|
USER_AGENT = "mite-backup/#{MiteBackup::VERSION}"
|
@@ -17,6 +17,9 @@ class MiteBackup
|
|
17
17
|
@account = correct_account(options["account"] || config["account"])
|
18
18
|
@email = options["email"] || config["email"]
|
19
19
|
@password = options["password"] || config["password"]
|
20
|
+
@max_checks = options["wait_for"] != DEFAULT_WAIT_FOR ?
|
21
|
+
options["wait_for"] / SLEEP_BEFORE_EACH_CHECK :
|
22
|
+
config["wait_for"] || DEFAULT_WAIT_FOR
|
20
23
|
end
|
21
24
|
|
22
25
|
def run
|
@@ -30,6 +33,8 @@ class MiteBackup
|
|
30
33
|
(config["account"] = @account) || config.delete("account")
|
31
34
|
(config["email"] = @email) || config.delete("email")
|
32
35
|
(config["password"] = @password) || config.delete("password")
|
36
|
+
(config["wait_for"] = @options["wait_for"]) || config.delete("wait_for")
|
37
|
+
config.delete("wait_for") if config["wait_for"] == DEFAULT_WAIT_FOR
|
33
38
|
|
34
39
|
if config.size == 0
|
35
40
|
self.class.clear_config
|
@@ -59,7 +64,7 @@ class MiteBackup
|
|
59
64
|
end
|
60
65
|
|
61
66
|
def check
|
62
|
-
|
67
|
+
@max_checks.times do |i|
|
63
68
|
sleep(SLEEP_BEFORE_EACH_CHECK)
|
64
69
|
@ready = parse_json(perform_request(Net::HTTP::Get.new("/account/backup/#{@id}.json")))["ready"]
|
65
70
|
break if @ready
|
@@ -77,7 +82,7 @@ class MiteBackup
|
|
77
82
|
end
|
78
83
|
puts gz.read
|
79
84
|
else
|
80
|
-
failed "Backup was not ready for download after #{
|
85
|
+
failed "Backup was not ready for download after #{@options["wait_for"]} seconds. Contact the mite.support."
|
81
86
|
end
|
82
87
|
end
|
83
88
|
|
@@ -107,7 +112,7 @@ class MiteBackup
|
|
107
112
|
end
|
108
113
|
|
109
114
|
def domain
|
110
|
-
"https://#{@account}.mite.
|
115
|
+
"https://#{@account}.mite.de/"
|
111
116
|
end
|
112
117
|
|
113
118
|
def failed(reason)
|
data/mite-backup.gemspec
CHANGED
@@ -5,9 +5,9 @@ require "mite-backup/version"
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "mite-backup"
|
7
7
|
s.version = MiteBackup::VERSION
|
8
|
-
s.authors = ["
|
9
|
-
s.email = [
|
10
|
-
s.homepage = "http://mite.
|
8
|
+
s.authors = ["mite GmbH"]
|
9
|
+
s.email = []
|
10
|
+
s.homepage = "http://mite.de/en"
|
11
11
|
s.summary = %q{Download a backup of your mite.account from the command-line.}
|
12
12
|
s.description = %q{Download a backup of your mite.account from the command-line.}
|
13
13
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mite-backup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- mite GmbH
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -25,8 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
description: Download a backup of your mite.account from the command-line.
|
28
|
-
email:
|
29
|
-
- sebastian@yo.lk
|
28
|
+
email: []
|
30
29
|
executables:
|
31
30
|
- mite-backup
|
32
31
|
extensions: []
|
@@ -41,7 +40,7 @@ files:
|
|
41
40
|
- lib/mite-backup.rb
|
42
41
|
- lib/mite-backup/version.rb
|
43
42
|
- mite-backup.gemspec
|
44
|
-
homepage: http://mite.
|
43
|
+
homepage: http://mite.de/en
|
45
44
|
licenses: []
|
46
45
|
metadata: {}
|
47
46
|
post_install_message:
|
@@ -59,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
59
58
|
- !ruby/object:Gem::Version
|
60
59
|
version: '0'
|
61
60
|
requirements: []
|
62
|
-
rubygems_version: 3.
|
61
|
+
rubygems_version: 3.3.7
|
63
62
|
signing_key:
|
64
63
|
specification_version: 4
|
65
64
|
summary: Download a backup of your mite.account from the command-line.
|