imap-backup 0.0.4 → 0.0.5

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.
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
- # Basic Usage
19
+ # Setup
20
20
 
21
- * Create ~/.imap-backup directory and configuration file
21
+ Run:
22
22
 
23
- ```shell
24
- $ cd
25
- $ mkdir .imap-backup
26
- $ chmod 0700 .imap-backup
27
- $ cd .imap-backup
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
- * Run
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
- imap-backup
62
+ Altertatively, add it to your crontab.
53
63
 
54
64
  # Other Usage
55
65
 
@@ -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(options).run
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(options).run
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
- Account.new(@config, account[:username]).run
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 @config, account[:username]
61
+ Account.new(@config, account).run
62
62
  end
63
63
 
64
64
  end
@@ -2,7 +2,7 @@ module Imap
2
2
  module Backup
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- REVISION = 4
5
+ REVISION = 5
6
6
  VERSION = [ MAJOR, MINOR, REVISION ].map( &:to_s ).join( '.' )
7
7
  end
8
8
  end
@@ -23,11 +23,9 @@ describe Imap::Backup::Configuration::Setup do
23
23
  end
24
24
 
25
25
  def prepare_store
26
- accounts = [
27
- { :username => 'account@example.com' }
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, 'account@example.com').and_return(@account)
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.should_receive(:new).with(@store, 'new@example.com')
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
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: 1194066517873683688
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: 1194066517873683688
177
+ hash: 475594614106241971
178
178
  requirements: []
179
179
  rubyforge_project:
180
180
  rubygems_version: 1.8.23