Module: Rage
- Defined in:
- lib/rage-rb.rb,
lib/rage/cli.rb,
lib/rage/version.rb
Defined Under Namespace
Modules: Cable, Errors, Ext, Router
Classes: Application, CLI, CLICodeGenerator, CLINewAppGenerator, CodeLoader, Configuration, Cookies, Cors, Env, FiberScheduler, FiberWrapper, JSONFormatter, Logger, OriginValidator, ParamsParser, Reloader, Request, Response, Session, SidekiqSession, Tasks, TextFormatter, UploadedFile
Constant Summary
collapse
- VERSION =
"1.10.1"
Class Method Summary
collapse
Class Method Details
.__router ⇒ Object
25
26
27
|
# File 'lib/rage-rb.rb', line 25
def self.__router
@__router ||= Rage::Router::Backend.new
end
|
.application ⇒ Object
9
10
11
|
# File 'lib/rage-rb.rb', line 9
def self.application
with_middlewares(Application.new(__router), config.middleware.middlewares)
end
|
.cable ⇒ Object
17
18
19
|
# File 'lib/rage-rb.rb', line 17
def self.cable
Rage::Cable
end
|
.code_loader ⇒ Object
58
59
60
|
# File 'lib/rage-rb.rb', line 58
def self.code_loader
@code_loader ||= Rage::CodeLoader.new
end
|
.config ⇒ Object
29
30
31
|
# File 'lib/rage-rb.rb', line 29
def self.config
@config ||= Rage::Configuration.new
end
|
33
34
35
36
|
# File 'lib/rage-rb.rb', line 33
def self.configure(&)
config.instance_eval(&)
config.__finalize
end
|
.env ⇒ Object
38
39
40
|
# File 'lib/rage-rb.rb', line 38
def self.env
@__env ||= Rage::Env.new(ENV["RAGE_ENV"] || ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development")
end
|
.groups ⇒ Object
42
43
44
|
# File 'lib/rage-rb.rb', line 42
def self.groups
[:default, Rage.env.to_sym]
end
|
.load_middlewares(_) ⇒ Object
54
55
56
|
# File 'lib/rage-rb.rb', line 54
def self.load_middlewares(_)
puts "`Rage.load_middlewares` is deprecated and has been merged into `Rage.application`. Please remove this call."
end
|
.load_tasks ⇒ Object
85
86
87
|
# File 'lib/rage-rb.rb', line 85
def self.load_tasks
Rage::Tasks.init
end
|
.logger ⇒ Object
50
51
52
|
# File 'lib/rage-rb.rb', line 50
def self.logger
@logger ||= config.logger
end
|
.multi_application ⇒ Object
13
14
15
|
# File 'lib/rage-rb.rb', line 13
def self.multi_application
Rage::Router::Util::Cascade.new(application, Rails.application)
end
|
.patch_active_record_connection_pool ⇒ Object
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/rage-rb.rb', line 62
def self.patch_active_record_connection_pool
patch = proc do
is_connected = ActiveRecord::Base.connection_pool rescue false
if is_connected
Iodine.on_state(:pre_start) { puts "INFO: Patching ActiveRecord::ConnectionPool" }
Iodine.on_state(:on_start) do
ActiveRecord::Base.connection_handler.connection_pool_list(:all).each do |pool|
pool.extend(Rage::Ext::ActiveRecord::ConnectionPool)
pool.__init_rage_extension
end
end
else
puts "WARNING: DB connection is not established - can't patch ActiveRecord::ConnectionPool"
end
end
if Rage.config.internal.rails_mode
Rails.configuration.after_initialize(&patch)
else
patch.call
end
end
|
.root ⇒ Object
46
47
48
|
# File 'lib/rage-rb.rb', line 46
def self.root
@root ||= Pathname.new(".").expand_path
end
|
.routes ⇒ Object
21
22
23
|
# File 'lib/rage-rb.rb', line 21
def self.routes
Rage::Router::DSL.new(__router)
end
|