19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/servitude/base.rb', line 19
def boot( host_namespace: nil,
app_id: ( host_namespace.name.split( '::' ).join( '-' ).downcase rescue nil ),
app_name: ( host_namespace.name.split( '::' ).join( ' ' ) rescue nil ),
author: nil,
company: nil, attribution: ( "v#{host_namespace::VERSION} Copyright © #{Time.now.year} #{author || company}" rescue nil ),
use_config: false,
default_config_path: nil,
server_class: ( host_namespace::Server rescue "#{host_namespace.name}::Server" ),
version_copyright: nil ) unless host_namespace
raise ArgumentError, 'host_namespace keyword is required'
end
unless app_id
raise ArgumentError, 'app_id keyword is required'
end
unless app_name
raise ArgumentError, 'app_name keyword is required'
end
unless author || company
raise ArgumentError, 'author keyword is required'
end
unless attribution || version_copyright
raise ArgumentError, 'attribution keyword is required'
end
if company
Util.deprecate "#{Base.name}.boot company: #{company.inspect}",
"#{Base.name}.boot author: #{company.inspect}"
author = company
end
unless server_class
raise ArgumentError, 'server_class keyword is required'
end
if version_copyright
Util.deprecate "#{Base.name}.boot version_copyright: #{version_copyright.inspect}",
"#{Base.name}.boot attribution: #{version_copyright.inspect}"
attribution = version_copyright
end
const_set :APP_ID, app_id
const_set :APP_NAME, app_name
const_set :AUTHOR, author
const_set :COMPANY, author const_set :ATTRIBUTION, attribution
const_set :DEFAULT_CONFIG_PATH, default_config_path
const_set :USE_CONFIG, use_config
const_set :VERSION_COPYRIGHT, attribution
Servitude.const_set :APP_ID, app_id
Servitude.const_set :APP_NAME, app_name
Servitude.const_set :AUTHOR, author
Servitude.const_set :COMPANY, author Servitude.const_set :ATTRIBUTION, attribution
Servitude.const_set :DEFAULT_CONFIG_PATH, default_config_path
Servitude.const_set :SERVER_CLASS, server_class
Servitude.const_set :USE_CONFIG, use_config
Servitude.const_set :VERSION_COPYRIGHT, attribution
Servitude::boot_called = true
end
|