Class: Rapid::Launcher

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/ury_rapid/launcher.rb

Overview

An object that builds the dependencies for a Rapid App and runs it

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Launcher

Returns a new instance of Launcher


13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ury_rapid/launcher.rb', line 13

def initialize(config)
  @root_config      = nil
  @root_model_class = nil

  @user_config = {}

  init_default_makers
  run_config(config)

  @auth = make_auth(@user_config)
  @update_channel = make_channel
end

Class Method Details

.launch(*args) ⇒ Object


30
31
32
# File 'lib/ury_rapid/launcher.rb', line 30

def self.launch(*args)
  new(*args).run
end

Instance Method Details

#model(class_name) ⇒ Object

Configures the model.


52
53
54
55
# File 'lib/ury_rapid/launcher.rb', line 52

def model(class_name)
  fail('Multiple `model` blocks in config.') unless @root_model_class.nil?
  @root_model_class = class_name
end

#runObject


26
27
28
# File 'lib/ury_rapid/launcher.rb', line 26

def run
  app.run
end

#services(&block) ⇒ Object

Configures the services set for this instance of Rapid

See Rapid::Services::Root for the DSL accepted by this method.


44
45
46
47
# File 'lib/ury_rapid/launcher.rb', line 44

def services(&block)
  fail('Multiple `services` blocks in config.') unless @root_config.nil?
  @root_config = block
end

#user(name) ⇒ Object

Configures a user and adds them to the user table.


60
61
62
# File 'lib/ury_rapid/launcher.rb', line 60

def user(name)
  @user_config[name] = yield
end