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/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/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/error_unwrappable.rb,
lib/miteru/concerns/database_connectable.rb

Defined Under Namespace

Modules: CLI, Commands, Concerns, HTTP, 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.2.0"

Class Method Summary collapse

Class Method Details

.cacheObject



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

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

.cache?Boolean

Returns:

  • (Boolean)


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

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

.configMiteru::Config

Returns:



81
82
83
# File 'lib/miteru.rb', line 81

def config
  @config ||= Config.new
end

.development?Boolean

Returns:

  • (Boolean)


95
96
97
# File 'lib/miteru.rb', line 95

def development?
  env == "development"
end

.envString

Returns:

  • (String)


88
89
90
# File 'lib/miteru.rb', line 88

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

.feedsArray<Miteru::Feeds::Base>

Returns:



65
66
67
# File 'lib/miteru.rb', line 65

def feeds
  []
end

.initialize_sentryObject



118
119
120
121
122
123
124
125
126
# File 'lib/miteru.rb', line 118

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)


53
54
55
56
57
58
59
# File 'lib/miteru.rb', line 53

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:



73
74
75
# File 'lib/miteru.rb', line 73

def notifiers
  []
end

.sentry?Boolean

Returns:

  • (Boolean)


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

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

.sidekiq?Boolean

Returns:

  • (Boolean)


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

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