mite-backup 0.1.2 → 0.1.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 +7 -0
- data/.gitignore +1 -1
- data/README.md +3 -3
- data/bin/mite-backup +1 -1
- data/lib/mite-backup.rb +11 -4
- data/lib/mite-backup/version.rb +1 -1
- metadata +10 -14
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 51ae4b7cf0a33dcb1f0c054badbba8d6b9c5e836
|
4
|
+
data.tar.gz: 165093a4502857912ec4a8c920f88b7a682c3b05
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7129348644c3bf8c9bcb9b9fa880760db7fce998cc267719be212d6cc57efecc352b6577894df3c4dc6688483a785ffce6132669c8732b10cab66af8cd9f9ace
|
7
|
+
data.tar.gz: 5b981815c4eaef38317979fb33ac9c0a7d8560d8516eb0df7f1ffa8a635ed06ed24adf39ce05a4645694498c236d40e315802060f45890aec169f25230d281c1
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -8,11 +8,11 @@ Simple command-line tool for downloading a backup in XML of your [mite](http://m
|
|
8
8
|
|
9
9
|
## Usage
|
10
10
|
|
11
|
-
mite-backup -a [ACCOUNT] -e [EMAIL] -p [PASSWORD]
|
11
|
+
mite-backup -a [ACCOUNT-SUBDOMAIN] -e [EMAIL] -p [PASSWORD]
|
12
12
|
|
13
13
|
This will output the backup file in XML to the prompt. You propably want to pipe it into an file:
|
14
14
|
|
15
|
-
mite-backup -a [ACCOUNT] -e [EMAIL] -p [PASSWORD] > my_backup_file.xml
|
15
|
+
mite-backup -a [ACCOUNT-SUBDOMAIN] -e [EMAIL] -p [PASSWORD] > my_backup_file.xml
|
16
16
|
|
17
17
|
For further instructions run
|
18
18
|
|
@@ -20,6 +20,6 @@ For further instructions run
|
|
20
20
|
|
21
21
|
## BlaBla
|
22
22
|
|
23
|
-
Copyright (c) 2011 [Yolk](http://yo.lk/) Sebastian Munz & Julia Soergel GbR
|
23
|
+
Copyright (c) 2011-2012 [Yolk](http://yo.lk/) Sebastian Munz & Julia Soergel GbR
|
24
24
|
|
25
25
|
Beyond that, the implementation is licensed under the MIT License.
|
data/bin/mite-backup
CHANGED
@@ -13,7 +13,7 @@ parser = OptionParser.new do |opts|
|
|
13
13
|
opts.separator ""
|
14
14
|
opts.separator "Options:"
|
15
15
|
|
16
|
-
opts.on("-a", "--account [ACCOUNT]", "your mite account
|
16
|
+
opts.on("-a", "--account [ACCOUNT-SUBDOMAIN]", "your mite account subdomain (without .mite.yo.lk)") do |account|
|
17
17
|
@options["account"] = account
|
18
18
|
end
|
19
19
|
|
data/lib/mite-backup.rb
CHANGED
@@ -47,13 +47,15 @@ class MiteBackup
|
|
47
47
|
private
|
48
48
|
|
49
49
|
def runnable?
|
50
|
-
failed "Please provide your account
|
50
|
+
failed "Please provide your account subdomain with --account [ACCOUNT-SUBDOMAIN]." unless @account
|
51
51
|
failed "Please provide your mite.users email with --email [EMAIL]." unless @email
|
52
52
|
failed "Please provide your mite.users password with --password [PASSWORD]." unless @password
|
53
53
|
end
|
54
54
|
|
55
55
|
def create
|
56
|
-
@id = parse_json(perform_request(Net::HTTP::Post.new("/account/backup.json"))
|
56
|
+
@id = parse_json(perform_request(Net::HTTP::Post.new("/account/backup.json")){ |code|
|
57
|
+
"Could not find any account located at #{domain}" if code == "404"
|
58
|
+
})["id"]
|
57
59
|
end
|
58
60
|
|
59
61
|
def check
|
@@ -86,7 +88,8 @@ class MiteBackup
|
|
86
88
|
if response.code == "401"
|
87
89
|
failed "Could not authenticate with email #{@email.inspect} and provided password. The user needs to be an admin or the owner of the mite.account!"
|
88
90
|
elsif !["200", "201"].include?(response.code)
|
89
|
-
|
91
|
+
message = block_given? && yield(response.code)
|
92
|
+
failed(message || "mite responded with irregular code #{response.code}")
|
90
93
|
end
|
91
94
|
response.body
|
92
95
|
end
|
@@ -97,12 +100,16 @@ class MiteBackup
|
|
97
100
|
|
98
101
|
def mite
|
99
102
|
@mite ||= begin
|
100
|
-
mite = Net::HTTP.new(URI.parse(
|
103
|
+
mite = Net::HTTP.new(URI.parse(domain).host, 443)
|
101
104
|
mite.use_ssl = true
|
102
105
|
mite
|
103
106
|
end
|
104
107
|
end
|
105
108
|
|
109
|
+
def domain
|
110
|
+
"https://#{@account}.mite.yo.lk/"
|
111
|
+
end
|
112
|
+
|
106
113
|
def failed(reason)
|
107
114
|
$stderr.puts "Failed: #{reason}"
|
108
115
|
exit(1)
|
data/lib/mite-backup/version.rb
CHANGED
metadata
CHANGED
@@ -1,30 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mite-backup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Sebastian
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-05-07 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: multi_json
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
description: Download a backup of your mite.account from the command-line.
|
@@ -35,7 +32,7 @@ executables:
|
|
35
32
|
extensions: []
|
36
33
|
extra_rdoc_files: []
|
37
34
|
files:
|
38
|
-
- .gitignore
|
35
|
+
- ".gitignore"
|
39
36
|
- Gemfile
|
40
37
|
- MIT-LICENSE
|
41
38
|
- README.md
|
@@ -46,26 +43,25 @@ files:
|
|
46
43
|
- mite-backup.gemspec
|
47
44
|
homepage: http://mite.yo.lk/en
|
48
45
|
licenses: []
|
46
|
+
metadata: {}
|
49
47
|
post_install_message:
|
50
48
|
rdoc_options: []
|
51
49
|
require_paths:
|
52
50
|
- lib
|
53
51
|
required_ruby_version: !ruby/object:Gem::Requirement
|
54
|
-
none: false
|
55
52
|
requirements:
|
56
|
-
- -
|
53
|
+
- - ">="
|
57
54
|
- !ruby/object:Gem::Version
|
58
55
|
version: '0'
|
59
56
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
-
none: false
|
61
57
|
requirements:
|
62
|
-
- -
|
58
|
+
- - ">="
|
63
59
|
- !ruby/object:Gem::Version
|
64
60
|
version: '0'
|
65
61
|
requirements: []
|
66
62
|
rubyforge_project: mite-backup
|
67
|
-
rubygems_version:
|
63
|
+
rubygems_version: 2.2.2
|
68
64
|
signing_key:
|
69
|
-
specification_version:
|
65
|
+
specification_version: 4
|
70
66
|
summary: Download a backup of your mite.account from the command-line.
|
71
67
|
test_files: []
|