news2kindle 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/Gemfile.lock +1 -1
- data/exe/news2kindle +29 -12
- data/lib/news2kindle/task.rb +0 -11
- data/lib/news2kindle/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 251e39c5b4825a1c4b5f48c00830792afaf6afc0
|
4
|
+
data.tar.gz: 8342bbff08e27c297951a54e7bf940235cdc1e4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42893d4d3dc64b2c1fd98b75a2f542ca7b1244f0d98950d426f64bd03b92da14911e70b3245f3ca85bd06f911a0a581d0ae18df5cf5064362e9e07cd317eb86e
|
7
|
+
data.tar.gz: 1ca795a9dac2540557d69789d1c503855d06afbd9b4130159566887fbed25b891ef570ea33bece0e8f16c8c759fd9a516e43794edc5ecbb18eff88b2c5452165
|
data/Gemfile.lock
CHANGED
data/exe/news2kindle
CHANGED
@@ -10,24 +10,15 @@ require 'news2kindle'
|
|
10
10
|
require 'optparse'
|
11
11
|
require 'open-uri'
|
12
12
|
require 'yaml'
|
13
|
+
require 'mail'
|
13
14
|
|
14
15
|
module News2Kindle
|
15
|
-
|
16
16
|
class CLI
|
17
17
|
def run
|
18
18
|
conf, tasks = parse_options
|
19
19
|
News2Kindle.logger.level = Logger::DEBUG if conf[:verbose]
|
20
|
-
|
21
|
-
|
22
|
-
unless conf[:mongodb_uri] =~ %r|^mongodb://|
|
23
|
-
conf[:mongodb_uri] = Pit::get('news2kindle', require: {
|
24
|
-
mongodb_uri: 'MongoDB URI for Dupulicate Check starts with "mongodb://".'
|
25
|
-
})[:mongodb_uri]
|
26
|
-
end
|
27
|
-
if conf[:mongodb_uri]
|
28
|
-
DupChecker.setup({clients:{default:{uri:conf[:mongodb_uri]}}})
|
29
|
-
end
|
30
|
-
end
|
20
|
+
setup_mail(conf)
|
21
|
+
setup_dupcheck(conf)
|
31
22
|
|
32
23
|
tasks.each do |name|
|
33
24
|
task = conf[:tasks][name]
|
@@ -101,6 +92,32 @@ module News2Kindle
|
|
101
92
|
end
|
102
93
|
[conf, args]
|
103
94
|
end
|
95
|
+
|
96
|
+
def setup_mail(conf)
|
97
|
+
settings = conf[:email]
|
98
|
+
if settings[:user_name] or settings[:password]
|
99
|
+
account = Pit::get('news2kindle', require: {
|
100
|
+
mail_user_name: 'your e-mail id',
|
101
|
+
mail_password: 'your e-mail password'
|
102
|
+
})
|
103
|
+
settings[:user_name] = account[:mail_user_name]
|
104
|
+
settings[:password] = account[:mail_password]
|
105
|
+
end
|
106
|
+
Mail.defaults{delivery_method :smtp, settings}
|
107
|
+
end
|
108
|
+
|
109
|
+
def setup_dupcheck(conf)
|
110
|
+
if conf[:mongodb_uri]
|
111
|
+
unless conf[:mongodb_uri] =~ %r|^mongodb://|
|
112
|
+
conf[:mongodb_uri] = Pit::get('news2kindle', require: {
|
113
|
+
mongodb_uri: 'MongoDB URI for Dupulicate Check starts with "mongodb://".'
|
114
|
+
})[:mongodb_uri]
|
115
|
+
end
|
116
|
+
if conf[:mongodb_uri]
|
117
|
+
DupChecker.setup({clients:{default:{uri:conf[:mongodb_uri]}}})
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
104
121
|
end
|
105
122
|
end
|
106
123
|
|
data/lib/news2kindle/task.rb
CHANGED
@@ -5,7 +5,6 @@
|
|
5
5
|
#
|
6
6
|
require 'pit'
|
7
7
|
require 'kindlegen'
|
8
|
-
require 'mail'
|
9
8
|
require 'dropbox_api'
|
10
9
|
|
11
10
|
class DropboxApi::Client
|
@@ -53,16 +52,6 @@ module News2Kindle
|
|
53
52
|
def deliver_via_mail(to_address, from_address, mobi, opts)
|
54
53
|
return if to_address.empty?
|
55
54
|
|
56
|
-
settings = opts[:email]
|
57
|
-
if settings[:user_name] or settings[:password]
|
58
|
-
account = Pit::get('news2kindle', require: {
|
59
|
-
mail_user_name: 'your e-mail id',
|
60
|
-
mail_password: 'your e-mail password'
|
61
|
-
})
|
62
|
-
settings[:user_name] = account[:mail_user_name]
|
63
|
-
settings[:password] = account[:mail_password]
|
64
|
-
end
|
65
|
-
Mail.defaults{delivery_method :smtp, settings}
|
66
55
|
Mail.deliver do
|
67
56
|
from from_address
|
68
57
|
to to_address
|
data/lib/news2kindle/version.rb
CHANGED