popper 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/popper.rb +2 -2
- data/lib/popper/cli.rb +1 -0
- data/lib/popper/pop.rb +17 -13
- data/lib/popper/version.rb +1 -1
- metadata +1 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95a2425b9e515ca0ee9d1aa86f438fce874368d6
|
4
|
+
data.tar.gz: ab1d06fb1f4b9cb9991cf0d016ff288dc2f7698e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbb98e0eb5f33a12c170d33caed4854482c08d83efa2a419bfcaea68c9eb5e2f4665c42d12f0c3b46e6f010a36b08a9f6d33058b777b5812e7c758e9bf44f3a0
|
7
|
+
data.tar.gz: edb360136ee5069d57bdec446914002865436f8c1b42a4c2a0ef76f9f5c8078250d7f75499b916cc206f7794789f268efc187f1bac9479ad9cd50826d8dacc6c
|
data/lib/popper.rb
CHANGED
@@ -8,9 +8,9 @@ require "popper/init"
|
|
8
8
|
require "popper/sync"
|
9
9
|
|
10
10
|
module Popper
|
11
|
-
def self.init_logger(options)
|
11
|
+
def self.init_logger(options, stdout=nil)
|
12
12
|
log_path = options[:log] || File.join(Dir.home, "popper", "popper.log")
|
13
|
-
log_path = STDOUT if ENV["POPPER_TEST"]
|
13
|
+
log_path = STDOUT if ENV["POPPER_TEST"] || stdout
|
14
14
|
@_logger = Logger.new(log_path)
|
15
15
|
end
|
16
16
|
|
data/lib/popper/cli.rb
CHANGED
data/lib/popper/pop.rb
CHANGED
@@ -17,11 +17,11 @@ module Popper
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.pop(account)
|
20
|
-
|
20
|
+
current_uidls = []
|
21
|
+
error_uidls = []
|
21
22
|
Popper.log.info "start popper #{account.name}"
|
22
|
-
|
23
23
|
connection(account) do |pop|
|
24
|
-
pop.mails.reject {|m| last_uidl(account.name).include?(m.uidl) }.each do |m|
|
24
|
+
pop.mails.reject {|m| current_uidls << m.uidl; last_uidl(account.name).include?(m.uidl) }.each do |m|
|
25
25
|
begin
|
26
26
|
mail = EncodeMail.new(m.mail)
|
27
27
|
Popper.log.info "check mail:#{mail.date.to_s} #{mail.subject}"
|
@@ -29,14 +29,14 @@ module Popper
|
|
29
29
|
Popper.log.info "do action:#{mail.subject}"
|
30
30
|
Popper::Action::Git.run(account.action_by_rule(rule), mail) if account.action_by_rule(rule)
|
31
31
|
end
|
32
|
-
|
33
|
-
|
32
|
+
rescue => e
|
33
|
+
error_uidls << m.uidl
|
34
34
|
Popper.log.warn e
|
35
35
|
end
|
36
36
|
end
|
37
37
|
Popper.log.info "success popper #{account.name}"
|
38
38
|
end
|
39
|
-
|
39
|
+
current_uidls - error_uidls
|
40
40
|
end
|
41
41
|
|
42
42
|
def self.connection(account, &block)
|
@@ -75,14 +75,18 @@ module Popper
|
|
75
75
|
|
76
76
|
def self.prepop
|
77
77
|
Popper.configure.accounts.each do |account|
|
78
|
-
|
78
|
+
Popper.log.info "start prepop #{account.name}"
|
79
79
|
connection(account) do |pop|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
80
|
+
begin
|
81
|
+
uidls = pop.mails.map(&:uidl)
|
82
|
+
last_uidl(
|
83
|
+
account.name,
|
84
|
+
uidls
|
85
|
+
)
|
86
|
+
Popper.log.info "success prepop #{account.name} mail count:#{uidls.count}"
|
87
|
+
rescue => e
|
88
|
+
Popper.log.warn e
|
89
|
+
end
|
86
90
|
end
|
87
91
|
end
|
88
92
|
end
|
data/lib/popper/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: popper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pyama86
|
@@ -138,9 +138,6 @@ files:
|
|
138
138
|
- Rakefile
|
139
139
|
- bin/console
|
140
140
|
- bin/setup
|
141
|
-
- coverage/.last_run.json
|
142
|
-
- coverage/.resultset.json
|
143
|
-
- coverage/.resultset.json.lock
|
144
141
|
- exe/popper
|
145
142
|
- lib/popper.rb
|
146
143
|
- lib/popper/action.rb
|