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 =
"3.0.0"

Class Method Summary collapse

Class Method Details

.cacheObject



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

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

.cache?Boolean

Returns:

  • (Boolean)


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

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

.configMiteru::Config

Returns:



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

def config
  @config ||= Config.new
end

.development?Boolean

Returns:

  • (Boolean)


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

def development?
  env == "development"
end

.envString

Returns:

  • (String)


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

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

.feedsArray<Miteru::Feeds::Base>

Returns:



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

def feeds
  []
end

.initialize_sentryObject



114
115
116
117
118
119
120
121
122
# File 'lib/miteru.rb', line 114

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)


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

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:



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

def notifiers
  []
end

.sentry?Boolean

Returns:

  • (Boolean)


110
111
112
# File 'lib/miteru.rb', line 110

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