Module: Shatter
- Defined in:
- lib/shatter/service/base.rb,
lib/shatter.rb,
lib/shatter/util.rb,
lib/shatter/config.rb,
lib/shatter/version.rb,
lib/shatter/web/server.rb,
lib/shatter/web/application.rb,
lib/shatter/service/function.rb,
lib/shatter/service/discovery.rb,
lib/shatter/service/response_pool.rb,
lib/shatter/service/service_definition.rb
Overview
Defined Under Namespace
Modules: Service, Util, Web
Classes: Config, Error
Constant Summary
collapse
- RELOAD_RW_LOCK =
Concurrent::ReadWriteLock.new
- VERSION =
"0.1.1"
Class Method Summary
collapse
Class Method Details
.config(&block) ⇒ Object
31
32
33
34
35
|
# File 'lib/shatter.rb', line 31
def self.config(&block)
block.call(Config) and return if block_given?
Config
end
|
.link_definitions ⇒ Object
.load ⇒ Object
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/shatter.rb', line 50
def self.load
@loader = Zeitwerk::Loader.new
@loader.tag = File.basename(__FILE__, ".rb")
@loader.inflector = Zeitwerk::GemInflector.new(__FILE__)
Config.autoload_paths.each do |path|
@loader.push_dir(File.expand_path(path, root))
end
@loader.enable_reloading
@loader.setup link_definitions
end
|
.load_environment ⇒ Object
41
42
43
|
# File 'lib/shatter.rb', line 41
def self.load_environment
require "#{Shatter.root}/config/environment.rb"
end
|
.loader ⇒ Object
37
38
39
|
# File 'lib/shatter.rb', line 37
def self.loader
@loader
end
|
.logger ⇒ Object
27
28
29
|
# File 'lib/shatter.rb', line 27
def self.logger
Util::Logger.instance
end
|
.reload ⇒ Object
45
46
47
48
|
# File 'lib/shatter.rb', line 45
def self.reload
@loader.reload
link_definitions
end
|
.root ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/shatter.rb', line 15
def self.root
current = Dir.pwd
root_dir = nil
while current.size >= 1 && root_dir.nil?
root_dir = current if Dir.children(current).include?("Gemfile")
current = File.expand_path("..", current) if root_dir.nil?
Dir.new(current)
end
root_dir
end
|