Module: Rodbot

Extended by:
Dry::Credentials, Forwardable
Includes:
Constants
Defined in:
lib/rodbot.rb,
lib/rodbot/db.rb,
lib/rodbot/cli.rb,
lib/rodbot/env.rb,
lib/rodbot/log.rb,
lib/rodbot/rack.rb,
lib/rodbot/async.rb,
lib/rodbot/error.rb,
lib/rodbot/relay.rb,
lib/rodbot/config.rb,
lib/rodbot/db/hash.rb,
lib/rodbot/memoize.rb,
lib/rodbot/message.rb,
lib/rodbot/plugins.rb,
lib/rodbot/version.rb,
lib/rodbot/db/redis.rb,
lib/rodbot/services.rb,
lib/rodbot/constants.rb,
lib/rodbot/generator.rb,
lib/rodbot/simulator.rb,
lib/rodbot/dispatcher.rb,
lib/rodbot/serializer.rb,
lib/rodbot/cli/command.rb,
lib/rodbot/refinements.rb,
lib/rodbot/cli/commands.rb,
lib/rodbot/services/app.rb,
lib/rodbot/services/relay.rb,
lib/rodbot/plugins/hal/app.rb,
lib/rodbot/plugins/otp/app.rb,
lib/rodbot/cli/commands/new.rb,
lib/rodbot/cli/commands/stop.rb,
lib/rodbot/services/schedule.rb,
lib/rodbot/cli/commands/start.rb,
lib/rodbot/cli/commands/deploy.rb,
lib/rodbot/plugins/slack/relay.rb,
lib/rodbot/cli/commands/console.rb,
lib/rodbot/cli/commands/version.rb,
lib/rodbot/plugins/matrix/relay.rb,
lib/rodbot/cli/commands/simulator.rb,
lib/rodbot/cli/commands/credentials.rb,
lib/rodbot/plugins/github_webhook/app.rb,
lib/rodbot/plugins/gitlab_webhook/app.rb,
lib/rodbot/plugins/word_of_the_day/schedule.rb

Overview

Rodbot foundation

Once the Rodbot gem has been required, use boot to spin up the foundation:

Rodbot.boot                          # current directory is root directory
Rodbot.boot(root: '/path/to/root')   # explicit root directory

This gives you access to the following shortcuts (in order of loading):

Defined Under Namespace

Modules: Async, Constants, Memoize, Rack, Refinements Classes: CLI, Config, Db, Dispatcher, Env, Error, Generator, Log, Message, Plugins, Relay, Serializer, Services, Simulator

Constant Summary collapse

GeneratorError =
Class.new(Error)
PluginError =
Class.new(Error)
ServiceError =
Class.new(Error)
RelayError =
Class.new(Error)
VERSION =
"0.4.4"

Constants included from Constants

Constants::HOSTINGS, Constants::SERVICES

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.envObject (readonly)

Returns the value of attribute env.



39
40
41
# File 'lib/rodbot.rb', line 39

def env
  @env
end

Class Method Details

.boot(root: nil) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/rodbot.rb', line 47

def boot(root: nil)
  @env = Rodbot::Env.new(root: root)
  credentials do
    env Rodbot.env.current
    dir ENV['RODBOT_CREDENTIALS_DIR'] || Rodbot.env.root.join('config', 'credentials')
  end
  @config = Rodbot::Config.new(Rodbot.env.root.join('config', 'rodbot.rb'))
  ENV['TZ'] = @config.config(:time_zone)
  @plugins = Rodbot::Plugins.new
  @db = (db = @config.config(:db)) && Rodbot::Db.new(db)
  @log = Rodbot::Log.new
end