Module: Feed2Email
- Defined in:
- lib/feed2email.rb,
lib/feed2email/cli.rb,
lib/feed2email/feed.rb,
lib/feed2email/entry.rb,
lib/feed2email/config.rb,
lib/feed2email/version.rb,
lib/feed2email/database.rb,
lib/feed2email/loggable.rb,
lib/feed2email/configurable.rb,
lib/feed2email/opml_exporter.rb,
lib/feed2email/opml_importer.rb,
lib/feed2email/migrate/migration.rb,
lib/feed2email/feed_autodiscoverer.rb,
lib/feed2email/redirection_checker.rb,
lib/feed2email/migrate/feeds_import_migration.rb,
lib/feed2email/migrate/convert_feeds_migration.rb,
lib/feed2email/migrate/split_history_migration.rb,
lib/feed2email/migrate/history_import_migration.rb
Defined Under Namespace
Modules: Configurable, Loggable, Migrate
Classes: Cli, Config, Database, Entry, Feed, FeedAutodiscoverer, OPMLExporter, OPMLImporter, RedirectionChecker
Constant Summary
collapse
- VERSION =
'0.11.1'
Class Method Summary
collapse
Class Method Details
.config ⇒ Object
8
9
10
|
# File 'lib/feed2email.rb', line 8
def self.config
@config ||= Config.new(config_path)
end
|
.config_path ⇒ Object
12
13
14
|
# File 'lib/feed2email.rb', line 12
def self.config_path
root.join('config.yml').to_s
end
|
.database_path ⇒ Object
16
17
18
|
# File 'lib/feed2email.rb', line 16
def self.database_path
root.join('feed2email.db').to_s
end
|
.logger ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/feed2email.rb', line 20
def self.logger
return @logger if @logger
if config['log_path'] == true
logdev = $stdout
elsif config['log_path'] logdev = File.expand_path(config['log_path'])
end
@logger = Logger.new(logdev, config['log_shift_age'],
config['log_shift_size'].megabytes)
@logger.level = Logger.const_get(config['log_level'].upcase)
@logger
end
|
.root ⇒ Object
59
60
61
|
# File 'lib/feed2email.rb', line 59
def self.root
@root ||= Pathname.new(ENV['HOME']).join('.feed2email')
end
|
.setup_database ⇒ Object
35
36
37
38
39
40
41
42
|
# File 'lib/feed2email.rb', line 35
def self.setup_database
@db ||= Database.new(
adapter: 'sqlite',
database: database_path,
loggers: [logger],
sql_log_level: :debug
)
end
|
.smtp_connection ⇒ Object
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/feed2email.rb', line 44
def self.smtp_connection
return @smtp if @smtp
@smtp = Net::SMTP.new(config['smtp_host'], config['smtp_port'])
@smtp.enable_starttls if config['smtp_starttls']
@smtp.start('localhost',
config['smtp_user'],
config['smtp_pass'],
config['smtp_auth'].to_sym
)
at_exit { @smtp.finish }
@smtp
end
|