imap-backup 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +23 -13
- data/bin/imap-backup +2 -2
- data/lib/imap/backup/configuration/setup.rb +2 -2
- data/lib/imap/backup/version.rb +1 -1
- data/spec/unit/configuration/setup_spec.rb +8 -7
- metadata +3 -3
data/README.md
CHANGED
@@ -14,20 +14,17 @@
|
|
14
14
|
|
15
15
|
# Installation
|
16
16
|
|
17
|
-
gem install 'imap-backup'
|
17
|
+
$ gem install 'imap-backup'
|
18
18
|
|
19
|
-
#
|
19
|
+
# Setup
|
20
20
|
|
21
|
-
|
21
|
+
Run:
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
$ touch config.json
|
29
|
-
$ chmod 0600 config.json
|
30
|
-
```
|
23
|
+
$ imap-backup setup
|
24
|
+
|
25
|
+
The setup system is a menu-driven command line application.
|
26
|
+
|
27
|
+
It creates ~/.imap-backup directory and configuration file. E.g.:
|
31
28
|
|
32
29
|
```
|
33
30
|
{
|
@@ -47,9 +44,22 @@ $ chmod 0600 config.json
|
|
47
44
|
}
|
48
45
|
```
|
49
46
|
|
50
|
-
|
47
|
+
# Security
|
48
|
+
|
49
|
+
Note that email usernames and passwords are held in plain text
|
50
|
+
in the configuration file.
|
51
|
+
|
52
|
+
The directory ~/.imap-backup, the configuration file and all backup
|
53
|
+
directories have their access permissions set to only allow access
|
54
|
+
by your user.
|
55
|
+
|
56
|
+
# Run Backup
|
57
|
+
|
58
|
+
Manually, from the command line:
|
59
|
+
|
60
|
+
$ imap-backup
|
51
61
|
|
52
|
-
|
62
|
+
Altertatively, add it to your crontab.
|
53
63
|
|
54
64
|
# Other Usage
|
55
65
|
|
data/bin/imap-backup
CHANGED
@@ -54,7 +54,7 @@ end
|
|
54
54
|
begin
|
55
55
|
configuration = Imap::Backup::Configuration::List.new(options[:accounts])
|
56
56
|
rescue Imap::Backup::ConfigurationNotFound
|
57
|
-
Imap::Backup::Configuration::Setup.new
|
57
|
+
Imap::Backup::Configuration::Setup.new.run
|
58
58
|
exit
|
59
59
|
end
|
60
60
|
|
@@ -69,7 +69,7 @@ when 'folders'
|
|
69
69
|
connection.folders.each { |f| puts "\t" + f.name }
|
70
70
|
end
|
71
71
|
when 'setup'
|
72
|
-
Imap::Backup::Configuration::Setup.new
|
72
|
+
Imap::Backup::Configuration::Setup.new.run
|
73
73
|
when 'status'
|
74
74
|
configuration.each_connection do |connection|
|
75
75
|
puts connection.username
|
@@ -22,7 +22,7 @@ module Imap
|
|
22
22
|
menu.header = 'Choose an action'
|
23
23
|
@config.data[:accounts].each do |account|
|
24
24
|
menu.choice("#{account[:username]}") do
|
25
|
-
|
25
|
+
edit_account account[:username]
|
26
26
|
end
|
27
27
|
end
|
28
28
|
menu.choice('add account') do
|
@@ -58,7 +58,7 @@ module Imap
|
|
58
58
|
if account.nil?
|
59
59
|
account = add_account(username)
|
60
60
|
end
|
61
|
-
Account.new
|
61
|
+
Account.new(@config, account).run
|
62
62
|
end
|
63
63
|
|
64
64
|
end
|
data/lib/imap/backup/version.rb
CHANGED
@@ -23,11 +23,9 @@ describe Imap::Backup::Configuration::Setup do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def prepare_store
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
@data = {:accounts => accounts}
|
30
|
-
@store = stub('Imap::Backup::Configuration::Store', :data => @data, :path => '/base/path')
|
26
|
+
@account1 = { :username => 'account@example.com' }
|
27
|
+
@data = { :accounts => [ @account1 ] }
|
28
|
+
@store = stub('Imap::Backup::Configuration::Store', :data => @data, :path => '/base/path')
|
31
29
|
Imap::Backup::Configuration::Store.stub!(:new).with(false).and_return(@store)
|
32
30
|
end
|
33
31
|
|
@@ -64,7 +62,7 @@ describe Imap::Backup::Configuration::Setup do
|
|
64
62
|
end
|
65
63
|
|
66
64
|
@account = stub('Imap::Backup::Configuration::Account')
|
67
|
-
Imap::Backup::Configuration::Account.should_receive(:new).with(@store,
|
65
|
+
Imap::Backup::Configuration::Account.should_receive(:new).with(@store, @account1).and_return(@account)
|
68
66
|
@account.should_receive(:run).with()
|
69
67
|
|
70
68
|
subject.run
|
@@ -82,8 +80,11 @@ describe Imap::Backup::Configuration::Setup do
|
|
82
80
|
end
|
83
81
|
end
|
84
82
|
|
83
|
+
blank_account = {:username=>"new@example.com", :password=>"", :local_path=>"/base/path/new_example.com", :folders=>[]}
|
85
84
|
Imap::Backup::Configuration::Asker.should_receive(:email).with().and_return('new@example.com')
|
86
|
-
Imap::Backup::Configuration::Account
|
85
|
+
@account = stub('Imap::Backup::Configuration::Account')
|
86
|
+
Imap::Backup::Configuration::Account.should_receive(:new).with(@store, blank_account).and_return(@account)
|
87
|
+
@account.should_receive(:run).once
|
87
88
|
|
88
89
|
subject.run
|
89
90
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imap-backup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -165,7 +165,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
165
165
|
version: '0'
|
166
166
|
segments:
|
167
167
|
- 0
|
168
|
-
hash:
|
168
|
+
hash: 475594614106241971
|
169
169
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
170
|
none: false
|
171
171
|
requirements:
|
@@ -174,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
174
|
version: '0'
|
175
175
|
segments:
|
176
176
|
- 0
|
177
|
-
hash:
|
177
|
+
hash: 475594614106241971
|
178
178
|
requirements: []
|
179
179
|
rubyforge_project:
|
180
180
|
rubygems_version: 1.8.23
|