imapget 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -1
- data/bin/imapget +27 -23
- data/lib/imapget/version.rb +1 -1
- metadata +2 -2
data/README
CHANGED
data/bin/imapget
CHANGED
@@ -36,8 +36,7 @@ $: << File.join(File.dirname(__FILE__), '..', 'lib')
|
|
36
36
|
|
37
37
|
require 'imapget'
|
38
38
|
|
39
|
-
USAGE = "Usage: #{$0} [-h|--help] [options]
|
40
|
-
abort USAGE if ARGV.empty?
|
39
|
+
USAGE = "Usage: #{$0} [-h|--help] [options] [profile]..."
|
41
40
|
|
42
41
|
options = {
|
43
42
|
:config => 'config.yaml',
|
@@ -52,8 +51,6 @@ OptionParser.new { |opts|
|
|
52
51
|
opts.separator 'Options:'
|
53
52
|
|
54
53
|
opts.on('-c', '--config YAML', "Config file [Default: #{options[:config]}#{' (currently not present)' unless File.readable?(options[:config])}]") { |f|
|
55
|
-
abort "Can't find config file: #{f}." unless File.readable?(f)
|
56
|
-
|
57
54
|
options[:config] = f
|
58
55
|
}
|
59
56
|
|
@@ -81,29 +78,36 @@ OptionParser.new { |opts|
|
|
81
78
|
}
|
82
79
|
}.parse!
|
83
80
|
|
84
|
-
|
85
|
-
abort "Profile missing\n#{USAGE}" unless profile
|
81
|
+
abort "Config file not found: #{options[:config]}\n#{USAGE}" unless File.readable?(options[:config])
|
86
82
|
|
87
|
-
global_config
|
83
|
+
global_config = YAML.load_file(options[:config])
|
84
|
+
default_config = global_config.reject { |k, _| k.is_a?(String) }
|
88
85
|
|
89
|
-
|
90
|
-
abort "Profile not found: #{profile}" unless config
|
86
|
+
profiles = ARGV.empty? ? global_config.keys.select { |k| k.is_a?(String) }.sort : ARGV
|
91
87
|
|
92
|
-
|
93
|
-
config
|
88
|
+
profiles.each { |profile|
|
89
|
+
unless config = global_config[profile]
|
90
|
+
warn "Profile not found: #{profile}"
|
91
|
+
next
|
92
|
+
end
|
94
93
|
|
95
|
-
|
96
|
-
abort "No host for profile #{profile}" unless host
|
94
|
+
config.update(default_config) { |key, old, new| old }
|
97
95
|
|
98
|
-
config[:
|
99
|
-
|
96
|
+
unless host = config[:host]
|
97
|
+
warn "No host for profile #{profile}"
|
98
|
+
next
|
99
|
+
end
|
100
100
|
|
101
|
-
|
101
|
+
config[:user] ||= ask("User for #{profile} on #{host}: ")
|
102
|
+
config[:password] ||= ask("Password for #{config[:user]}@#{host}: ") { |q| q.echo = false }
|
102
103
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
104
|
+
imapget = IMAPGet.new(config)
|
105
|
+
|
106
|
+
if options[:check]
|
107
|
+
imapget.each { |mailbox|
|
108
|
+
puts mailbox.name
|
109
|
+
}
|
110
|
+
else
|
111
|
+
imapget.get(options[:directory] || File.join(config[:base_dir] || '.', profile))
|
112
|
+
end
|
113
|
+
}
|
data/lib/imapget/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imapget
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Wille
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-05-
|
12
|
+
date: 2009-05-25 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|