Module: Miteru

Extended by:
MemoWise
Defined in:
lib/miteru.rb,
lib/miteru/kit.rb,
lib/miteru/http.rb,
lib/miteru/cache.rb,
lib/miteru/mixin.rb,
lib/miteru/config.rb,
lib/miteru/errors.rb,
lib/miteru/record.rb,
lib/miteru/crawler.rb,
lib/miteru/helpers.rb,
lib/miteru/service.rb,
lib/miteru/version.rb,
lib/miteru/website.rb,
lib/miteru/cli/base.rb,
lib/miteru/database.rb,
lib/miteru/downloader.rb,
lib/miteru/feeds/base.rb,
lib/miteru/cli/database.rb,
lib/miteru/commands/web.rb,
lib/miteru/orchestrator.rb,
lib/miteru/sidekiq/jobs.rb,
lib/miteru/commands/main.rb,
lib/miteru/feeds/urlscan.rb,
lib/miteru/feeds/ayashige.rb,
lib/miteru/notifiers/base.rb,
lib/miteru/cli/application.rb,
lib/miteru/feeds/tweetfeed.rb,
lib/miteru/notifiers/slack.rb,
lib/miteru/web/application.rb,
lib/miteru/commands/sidekiq.rb,
lib/miteru/commands/database.rb,
lib/miteru/feeds/urlscan_pro.rb,
lib/miteru/notifiers/urlscan.rb,
lib/miteru/feeds/phishing_database.rb,
lib/miteru/concerns/url_truncatable.rb,
lib/miteru/concerns/error_unwrappable.rb,
lib/miteru/concerns/database_connectable.rb

Defined Under Namespace

Modules: CLI, Commands, Concerns, HTTP, Helpers, Jobs, Mixins, Notifiers, Web Classes: Cache, Config, Crawler, Database, DownloadError, Downloader, Error, Feeds, FileSizeError, Kit, Orchestrator, Record, Service, StatusError, UniquenessError, Website

Constant Summary collapse

VERSION =
"2.4.0"

Class Method Summary collapse

Class Method Details

.cacheObject



107
108
109
# File 'lib/miteru.rb', line 107

def cache
  @cache ||= Cache.new(Miteru.config.cache_redis_url)
end

.cache?Boolean

Returns:

  • (Boolean)


103
104
105
# File 'lib/miteru.rb', line 103

def cache?
  !Miteru.config.cache_redis_url.nil?
end

.configMiteru::Config

Returns:



85
86
87
# File 'lib/miteru.rb', line 85

def config
  @config ||= Config.new
end

.development?Boolean

Returns:

  • (Boolean)


99
100
101
# File 'lib/miteru.rb', line 99

def development?
  env == "development"
end

.envString

Returns:

  • (String)


92
93
94
# File 'lib/miteru.rb', line 92

def env
  ENV["APP_ENV"] || ENV["RACK_ENV"]
end

.feedsArray<Miteru::Feeds::Base>

Returns:



69
70
71
# File 'lib/miteru.rb', line 69

def feeds
  []
end

.initialize_sentryObject



122
123
124
125
126
127
128
129
130
# File 'lib/miteru.rb', line 122

def initialize_sentry
  return if Sentry.initialized?

  Sentry.init do |config|
    config.dsn = Miteru.config.sentry_dsn
    config.traces_sample_rate = Miteru.config.sentry_trace_sample_rate
    config.breadcrumbs_logger = %i[sentry_logger http_logger]
  end
end

.loggerSematicLogger

Returns:

  • (SematicLogger)


57
58
59
60
61
62
63
# File 'lib/miteru.rb', line 57

def logger
  SemanticLogger.sync! unless sidekiq?

  SemanticLogger.default_level = :info
  SemanticLogger.add_appender(io: $stderr, formatter: :color)
  SemanticLogger["Miteru"]
end

.notifiersArray<Miteru::Notifiers::Base>

Returns:



77
78
79
# File 'lib/miteru.rb', line 77

def notifiers
  []
end

.sentry?Boolean

Returns:

  • (Boolean)


118
119
120
# File 'lib/miteru.rb', line 118

def sentry?
  !Miteru.config.sentry_dsn.nil?
end

.sidekiq?Boolean

Returns:

  • (Boolean)


114
115
116
# File 'lib/miteru.rb', line 114

def sidekiq?
  !Miteru.config.sidekiq_redis_url.nil?
end