lorj 0.2.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +46 -0
  4. data/Gemfile +15 -15
  5. data/README.md +22 -17
  6. data/Rakefile +12 -2
  7. data/bin/cloud_test.rb +13 -65
  8. data/example/students_1/process/students.rb +39 -0
  9. data/example/students_1/students.rb +22 -5
  10. data/example/students_2/process/students.rb +48 -0
  11. data/example/students_2/students.rb +39 -16
  12. data/example/students_3/controller/yaml_students.rb +50 -43
  13. data/example/students_3/controller/yaml_students_controller.rb +100 -87
  14. data/example/students_3/process/students.rb +161 -97
  15. data/example/students_3/students.rb +85 -56
  16. data/example/yaml_students/students.rb +40 -40
  17. data/example/yaml_students/yaml_students.rb +103 -90
  18. data/lib/core/core.rb +356 -696
  19. data/lib/core/core_controller.rb +227 -0
  20. data/lib/core/core_internal.rb +339 -0
  21. data/lib/core/core_model.rb +328 -0
  22. data/lib/core/core_object_data.rb +330 -0
  23. data/lib/core/core_object_params.rb +230 -0
  24. data/lib/core/core_process.rb +391 -0
  25. data/lib/core/core_process_setup.rb +353 -0
  26. data/lib/core/core_setup_ask.rb +241 -0
  27. data/lib/core/core_setup_encrypt.rb +146 -0
  28. data/lib/core/core_setup_init.rb +229 -0
  29. data/lib/core/core_setup_list.rb +160 -0
  30. data/lib/core/definition.rb +647 -469
  31. data/lib/core/definition_internal.rb +264 -308
  32. data/lib/core/lorj_basecontroller.rb +95 -0
  33. data/lib/core/lorj_basedefinition.rb +307 -0
  34. data/lib/core/lorj_baseprocess.rb +265 -0
  35. data/lib/core/lorj_data.rb +583 -0
  36. data/lib/core/lorj_keypath.rb +119 -0
  37. data/lib/core_process/cloud/process/common.rb +63 -0
  38. data/lib/core_process/cloud/process/connection.rb +93 -0
  39. data/lib/core_process/cloud/process/external_network.rb +94 -0
  40. data/lib/core_process/cloud/process/flavor.rb +99 -0
  41. data/lib/core_process/cloud/process/images.rb +87 -0
  42. data/lib/core_process/cloud/process/internet_network.rb +34 -0
  43. data/lib/core_process/cloud/process/internet_server.rb +30 -0
  44. data/lib/core_process/cloud/process/keypairs.rb +276 -0
  45. data/lib/core_process/cloud/process/network.rb +108 -0
  46. data/lib/core_process/cloud/process/public_ip.rb +100 -0
  47. data/lib/core_process/cloud/process/router.rb +260 -0
  48. data/lib/core_process/cloud/process/rules.rb +120 -0
  49. data/lib/core_process/cloud/process/security_groups.rb +121 -0
  50. data/lib/core_process/cloud/process/server.rb +127 -0
  51. data/lib/core_process/cloud/process/server_log.rb +35 -0
  52. data/lib/core_process/cloud/process/subnetwork.rb +108 -0
  53. data/lib/core_process/cloud_process.rb +30 -0
  54. data/lib/logging.rb +298 -0
  55. data/lib/lorj/version.rb +18 -1
  56. data/lib/lorj.rb +58 -18
  57. data/lib/lorj_account.rb +556 -0
  58. data/lib/lorj_config.rb +468 -0
  59. data/lib/lorj_defaults.rb +278 -0
  60. data/lib/prc.rb +136 -104
  61. data/lib/prc_base_config.rb +285 -0
  62. data/lib/prc_core_config.rb +878 -0
  63. data/lib/prc_section_config.rb +57 -0
  64. data/lib/providers/hpcloud/compute.rb +81 -93
  65. data/lib/providers/hpcloud/hpcloud.rb +462 -0
  66. data/lib/providers/hpcloud/network.rb +96 -98
  67. data/lib/providers/hpcloud/security_groups.rb +41 -40
  68. data/lib/providers/mock/mock.rb +144 -0
  69. data/lib/providers/openstack/openstack.rb +45 -0
  70. data/lib/providers/templates/compute.rb +21 -23
  71. data/lib/providers/templates/mycloud.rb +72 -0
  72. data/lib/providers/templates/network.rb +11 -12
  73. data/lib/rh.rb +339 -0
  74. data/lorj-spec/defaults.yaml +4 -0
  75. data/lorj.gemspec +6 -0
  76. data/spec/00_lorj_log_spec.rb +53 -0
  77. data/spec/01_hash_rh_spec.rb +243 -0
  78. data/spec/02_prc_base_config_spec.rb +216 -0
  79. data/spec/04_prc_core_config_spec.rb +83 -0
  80. data/spec/11_lorj_config_spec.rb +263 -0
  81. data/spec/12_lorj_account_spec.rb +181 -0
  82. metadata +76 -28
  83. data/Gemfile.lock +0 -37
  84. data/example/students_1/process/Students.rb +0 -20
  85. data/example/students_2/process/Students.rb +0 -27
  86. data/example/students_4/controller/yaml_students.rb +0 -82
  87. data/example/students_4/controller/yaml_students_controller.rb +0 -141
  88. data/example/students_4/process/students.rb +0 -112
  89. data/example/students_4/students.rb +0 -103
  90. data/lib/core/lorj-basecontroller.rb +0 -90
  91. data/lib/core/lorj-basedefinition.rb +0 -1139
  92. data/lib/core/lorj-baseprocess.rb +0 -236
  93. data/lib/core/lorj-data.rb +0 -567
  94. data/lib/core/lorj-keypath.rb +0 -115
  95. data/lib/core_process/CloudProcess.rb +0 -337
  96. data/lib/core_process/global_process.rb +0 -502
  97. data/lib/core_process/network_process.rb +0 -605
  98. data/lib/prc-account.rb +0 -339
  99. data/lib/prc-config.rb +0 -1030
  100. data/lib/prc-logging.rb +0 -261
  101. data/lib/providers/hpcloud/Hpcloud.rb +0 -426
  102. data/lib/providers/mock/Mock.rb +0 -141
  103. data/lib/providers/openstack/Openstack.rb +0 -47
  104. data/lib/providers/templates/core.rb +0 -61
  105. data/spec/forj-account_spec.rb +0 -75
  106. data/spec/forj-config_spec.rb +0 -196
@@ -0,0 +1,108 @@
1
+ # encoding: UTF-8
2
+
3
+ # (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # It requires Core objects to be defined + default ForjProcess functions.
18
+
19
+ # Subnetwork Management
20
+ class CloudProcess
21
+ def forj_get_or_create_subnetwork(sCloudObj, hParams)
22
+ subnet = query_subnet_one(sCloudObj, hParams)
23
+ return nil if subnet.nil?
24
+
25
+ # Create the subnet
26
+ subnet = create_subnet(sCloudObj, hParams)
27
+
28
+ return nil if subnet.nil?
29
+ register(subnet)
30
+ subnet
31
+ end
32
+ end
33
+
34
+ # ************************************ SubNetwork Object model
35
+ # Define framework object on BaseDefinition
36
+ module Lorj
37
+ # Identify subnetwork as part of network.
38
+ class BaseDefinition
39
+ define_obj(:subnetwork,
40
+ :create_e => :forj_get_or_create_subnetwork
41
+ )
42
+
43
+ obj_needs :CloudObject, :network_connection
44
+ obj_needs :CloudObject, :network
45
+ obj_needs :data, :subnetwork_name
46
+
47
+ def_query_attribute :network_id
48
+ end
49
+ end
50
+
51
+ # Subnetwork Management - internal functions
52
+ class CloudProcess
53
+ def create_subnet(sCloudObj, hParams)
54
+ name = hParams[:subnetwork_name]
55
+ PrcLib.state("Creating subnet '%s'", name)
56
+ begin
57
+ subnet = controller_create(sCloudObj)
58
+ PrcLib.info("Subnet '%s' created.", subnet[:name])
59
+ rescue => e
60
+ PrcLib.fatal(1, "Unable to create '%s' subnet.", name, e)
61
+ end
62
+ subnet
63
+ end
64
+
65
+ def delete_subnet
66
+ net_conn_obj = get_cloudObj(:network_connection)
67
+ sub_net_obj = get_cloudObj(:subnetwork)
68
+
69
+ PrcLib.state("Deleting subnet '%s'", sub_net_obj.name)
70
+ begin
71
+ provider_delete_subnetwork(net_conn_obj, sub_net_obj)
72
+ net_conn_obj.subnets.get(sub_net_obj.id).destroy
73
+ rescue => e
74
+ PrcLib.error("%s\n%s", e.message, e.backtrace.join("\n"))
75
+ end
76
+ end
77
+
78
+ def query_subnet_one(_sCloudObj, hParams)
79
+ PrcLib.state('Searching for sub-network attached to '\
80
+ "network '%s'", hParams[:network, :name])
81
+ #######################
82
+ begin
83
+ query = { :network_id => hParams[:network, :id] }
84
+ subnets = controller_query(:subnetwork, query)
85
+ rescue => e
86
+ PrcLib.error("%s\n%s", e.message, e.backtrace.join("\n"))
87
+ end
88
+ return nil if subnets.nil?
89
+
90
+ case subnets.length
91
+ when 0
92
+ PrcLib.info('No subnet found from '\
93
+ "'%s' network", hParams[:network, :name])
94
+ ForjLib::Data.new
95
+ when 1
96
+ PrcLib.info("Found '%s' subnet from "\
97
+ "'%s' network", subnets[0, :name],
98
+ hParams[:network, :name])
99
+ subnets[0]
100
+ else
101
+ PrcLib.warning('Several subnet was found on '\
102
+ "'%s'. Choosing the first one "\
103
+ "= '%s'", hParams[:network, :name],
104
+ subnets[0, :name])
105
+ subnets[0]
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,30 @@
1
+ # encoding: UTF-8
2
+
3
+ # (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # It requires Core objects to be defined + default ForjProcess functions.
18
+
19
+ cloud_path = File.dirname(__FILE__)
20
+
21
+ # Define model
22
+
23
+ lorj_objects = %w(common connection network subnetwork router
24
+ external_network security_groups rules
25
+ keypairs images flavor internet_network server public_ip
26
+ server_log internet_server)
27
+
28
+ lorj_objects.each do | name |
29
+ require File.join(cloud_path, 'cloud', 'process', name + '.rb')
30
+ end
data/lib/logging.rb ADDED
@@ -0,0 +1,298 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+
4
+ # (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ # create a forj.log file in ~/.hpcloud/forj.log
19
+
20
+ require 'rubygems'
21
+ require 'logger'
22
+ require 'ansi'
23
+ require 'ansi/logger'
24
+
25
+ #
26
+ # PrcLib module
27
+ #
28
+ # PrcLib Implements a Logging class based on logger.
29
+ #
30
+ # For details about this class capabilities, see PrcLib::Logging
31
+ #
32
+ # # To use the Prc::Logging system, do the following:
33
+ # require 'PrcLib'
34
+ #
35
+ # # To configure logging system:
36
+ # PrcLib.app_name = 'config/app' # Define application data path as
37
+ # # ~/.<app_name>.
38
+ # # Ex: 'config/app' will use ~/.config/app
39
+ # PrcLib.log_file = 'app.log' # Relative path to the log file name
40
+ # # stored in the Application data path.
41
+ # # Here, ~/.config/app/app.log
42
+ # PrcLib.level = Logger::FATAL # Define printout debug level. Can be any
43
+ # # Logger predefined value.
44
+ #
45
+ # # To log some information:
46
+ # PrcLib.debug('My debug message')
47
+ # PrcLib.info('My info message')
48
+ # PrcLib.warning('my warning')
49
+ # PrcLib.error('my error')
50
+ # PrcLib.fatal(2, "Fatal error, with return code = 2)
51
+ # PrcLib.message('Only printout message')
52
+ #
53
+ # # You can printout some instant message to the terminal, not logged.
54
+ # # This is useful before any action that will take time to be executed.
55
+ # # It is inform the end user that something is still running, which means
56
+ # # the application is not frozen
57
+ # PrcLib.state("Running a long task")
58
+ # # The next message will replace the previous state message.
59
+ # sleep(10)
60
+ # PrcLib.info("The long task has been executed successfully.")
61
+ #
62
+ # # You can change the logger level with PrcLib.level
63
+ # PrcLib.level = Logger::DEBUG
64
+ #
65
+ # # You can just print high level message (print without \n) if PrcLib.level
66
+ # is not DEBUG or INFO.
67
+ # PrcLib.high_level_msg("Print a message, not logged, if level is not DEBUG
68
+ # or INFO")
69
+ #
70
+ # Enjoy!
71
+ module PrcLib
72
+ # Class used to create 2 logger object, in order to keep track of error in a
73
+ # log file and change log output to OUTPUT on needs (option flags).
74
+ # The idea is that everytime, if you did not set the debug level mode, you can
75
+ # refer to the log file which is
76
+ # already configured with Logger::DEBUG level.
77
+ #
78
+ # As well, sometimes, you do not want to keep track on messages that are just
79
+ # to keep informed the end user about activity.
80
+ # So, this object implement 2 Logger objects.
81
+ # * One for log file
82
+ # * One for print out.
83
+ #
84
+ # Everytime you log a message with Logging, it is printed out if the level
85
+ # permits and stored everytime in the log file, never mind about Logger level
86
+ # set.
87
+ # In several cases, messages are printed out, but not stored in the log file.
88
+ #
89
+ # See Logging functions for details.
90
+ #
91
+ class Logging
92
+ attr_reader :level
93
+
94
+ # Initialize Logging instance
95
+ # The log file name is defined by PrcLib.log_file
96
+ # The log path is defined by PrcLib.app_name and will be kept as
97
+ # ~/.<PrcLib.app_name>
98
+ # The log level is defined by PrcLib.level. It will update only log print
99
+ # out.
100
+ # Depending on levels, messages are prefixed by colored 'ERROR!!!',
101
+ # 'FATAL!!!', 'WARNING' or <LEVEL NAME>
102
+ def initialize
103
+ file_logger_initialize
104
+
105
+ @out_logger = Logger.new(STDOUT)
106
+ @level = (PrcLib.level.nil? ? Logger::WARN : PrcLib.level)
107
+ @out_logger.level = @level
108
+ @out_logger.formatter = proc do |severity, _datetime, _progname, msg|
109
+ case severity
110
+ when 'ANY'
111
+ str = "#{msg} \n"
112
+ when 'ERROR', 'FATAL'
113
+ str = ANSI.bold(ANSI.red("#{severity}!!!")) + ": #{msg} \n"
114
+ when 'WARN'
115
+ str = ANSI.bold(ANSI.yellow('WARNING')) + ": #{msg} \n"
116
+ else
117
+ str = "#{severity}: #{msg} \n"
118
+ end
119
+ str
120
+ end
121
+ end
122
+
123
+ # Is Logging print out level is info?
124
+ def info?
125
+ (@out_logger.info?)
126
+ end
127
+
128
+ # Is Logging print out level is debug?
129
+ def debug?
130
+ (@out_logger.debug?)
131
+ end
132
+
133
+ # Is Logging print out level is error?
134
+ def error?
135
+ (@out_logger.error?)
136
+ end
137
+
138
+ # Is Logging print out level is fatal?
139
+ def fatal?
140
+ (@out_logger.fatal?)
141
+ end
142
+
143
+ # Log to STDOUT and Log file and INFO class message
144
+ def info(message)
145
+ @out_logger.info(message + ANSI.clear_line)
146
+ @file_logger.info(message)
147
+ end
148
+
149
+ # Log to STDOUT and Log file and DEBUG class message
150
+ def debug(message)
151
+ @out_logger.debug(message + ANSI.clear_line)
152
+ @file_logger.debug(message)
153
+ end
154
+
155
+ # Log to STDOUT and Log file and ERROR class message
156
+ def error(message)
157
+ @out_logger.error(message + ANSI.clear_line)
158
+ @file_logger.error(message)
159
+ end
160
+
161
+ # Log to STDOUT and Log file and FATAL class message
162
+ # fatal retrieve the caller list of functions and save it to the log file if
163
+ # the exception class is given.
164
+ # The exception class should provide message and backtrace.
165
+ def fatal(message, e = nil)
166
+ @out_logger.fatal(message + ANSI.clear_line)
167
+ @file_logger.fatal(format("%s\n%s\n%s",
168
+ message,
169
+ e.message,
170
+ e.backtrace.join("\n"))) if e
171
+ @file_logger.fatal(message)
172
+ end
173
+
174
+ # Log to STDOUT and Log file and WARNING class message
175
+ def warn(message)
176
+ @out_logger.warn(message + ANSI.clear_line)
177
+ @file_logger.warn(message)
178
+ end
179
+
180
+ # set STDOUT logger level
181
+ def level=(level)
182
+ @level = level
183
+ @out_logger.level = level
184
+ end
185
+
186
+ # Print out a message, not logged in the log file. This message is printed
187
+ # out systematically as not taking care of logger level.
188
+ def unknown(message)
189
+ @out_logger.unknown(message + ANSI.clear_line)
190
+ end
191
+
192
+ private
193
+
194
+ def file_logger_initialize
195
+ log_file = PrcLib.log_file
196
+ if log_file.nil?
197
+ default_log_file = format('%s.log', PrcLib.app_name)
198
+ log_file = File.join(PrcLib.data_path, default_log_file)
199
+ end
200
+
201
+ @file_logger = Logger.new(log_file, 'weekly')
202
+ @file_logger.level = Logger::DEBUG
203
+ @file_logger.formatter = proc do |severity, datetime, progname, msg|
204
+ "#{progname} : #{datetime}: #{severity}: #{msg} \n"
205
+ end
206
+ PrcLib.log_file = log_file
207
+ end
208
+ end
209
+
210
+ module_function
211
+
212
+ # Create a Logging object if missing and return it.
213
+ # Used internally by other functions
214
+ def log_object
215
+ if PrcLib.log.nil?
216
+ PrcLib.log = PrcLib::Logging.new
217
+ else
218
+ PrcLib.log
219
+ end
220
+ end
221
+
222
+ # Print out a message, not logged in the log file. This message is printed out
223
+ # systematically as not taking care of logger level.
224
+ def message(message, *p)
225
+ log_object.unknown(format(message, *p))
226
+ end
227
+
228
+ # Log to STDOUT and Log file and INFO class message
229
+ def info(message, *p)
230
+ log_object.info(format(message, *p))
231
+ nil
232
+ end
233
+
234
+ # Log to STDOUT and Log file and DEBUG class message
235
+ def debug(message, *p)
236
+ log_object.debug(format(message, *p))
237
+ nil
238
+ end
239
+
240
+ # Log to STDOUT and Log file and WARNING class message
241
+ def warning(message, *p)
242
+ log_object.warn(format(message, *p))
243
+ nil
244
+ end
245
+
246
+ # Log to STDOUT and Log file and ERROR class message
247
+ def error(message, *p)
248
+ log_object.error(format(message, *p))
249
+ nil
250
+ end
251
+
252
+ # Internal heap management to help controller developper to identify issue.
253
+ def dcl_fail(msg, *p)
254
+ msg = "Declaration error:\n%s"
255
+ msg += format("\nSee at %s",
256
+ PrcLib.model.heap[0]) if PrcLib.model.heap.is_a?(Array)
257
+ runtime_fail(msg, *p)
258
+ end
259
+
260
+ # fail extended with format.
261
+ def runtime_fail(msg, *p)
262
+ fail Lorj::PrcError.new, format(msg, *p)
263
+ end
264
+
265
+ # Log to STDOUT and Log file and FATAL class message then exit the application
266
+ # with a return code.
267
+ # fatal retrieve the caller list of functions and save it to the log file if
268
+ # the exception class is given.
269
+ # The exception class should provide message and backtrace.
270
+ def fatal(rc, message, *p)
271
+ e = nil
272
+ if p.length > 0 && p[-1].is_a?(Exception)
273
+ e = p[-1]
274
+ p.pop
275
+ end
276
+ log_object.fatal(format(message, *p), e)
277
+ puts 'Issues found. Please fix it and retry. Process aborted.'
278
+ exit rc
279
+ end
280
+
281
+ def level=(level)
282
+ log_object.level = level
283
+ nil
284
+ end
285
+
286
+ def state(message, *p)
287
+ print(format("%s ...%s\r",
288
+ format(message, *p),
289
+ ANSI.clear_line)) if log_object.level <= Logger::INFO
290
+ nil
291
+ end
292
+
293
+ # Not DEBUG and not INFO. Just printed to the output.
294
+ def high_level_msg(message)
295
+ print(format('%s', message)) if log_object.level > 1
296
+ nil
297
+ end
298
+ end
data/lib/lorj/version.rb CHANGED
@@ -1,3 +1,20 @@
1
+ # encoding: UTF-8
2
+
3
+ # (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Lorj version
1
18
  module Lorj
2
- VERSION = "0.2.0"
19
+ VERSION = '1.0.0'
3
20
  end
data/lib/lorj.rb CHANGED
@@ -17,32 +17,72 @@
17
17
  # limitations under the License.
18
18
  #++
19
19
 
20
-
21
-
22
- require "lorj/version"
20
+ require 'lorj/version'
23
21
 
24
22
  # This is the lorj base library.
25
23
 
26
24
  # To use it, add require 'lorj'
27
25
 
28
- require 'prc.rb' # Load PrcLib Base module
29
- require 'prc-logging.rb' # Load class PrcLib::Logging
30
- require 'prc-config.rb' # Load class Lorj::Config
31
- require 'prc-account.rb' # Load class Lorj::Account
26
+ require 'prc.rb' # PrcLib Base module
27
+ require 'rh.rb' # recursive Hash
28
+ require 'logging.rb' # class PrcLib::Logging
29
+ require 'prc_base_config.rb' # PRC::BaseConfig class
30
+ require 'prc_section_config.rb' # PRC::SectionConfig class
31
+ require 'prc_core_config.rb' # PRC::CoreConfig class
32
+ require 'lorj_defaults.rb' # PRC::Defaults class - Application defaults
33
+ require 'lorj_config.rb' # Lorj::Config class -
34
+ require 'lorj_account.rb' # Lorj::Account class - account config
32
35
 
33
- require "core/core" # Lorj Core classes
34
- require "core/lorj-data" # Lorj Lorj::Data object
35
- require "core/lorj-basedefinition" # Lorj Lorj::BaseDefinition object
36
- require "core/lorj-baseprocess" # Lorj Lorj::BaseProcess object
37
- require "core/lorj-basecontroller" # Lorj Lorj::BaseController object
38
- require "core/lorj-keypath" # Lorj Lorj::BaseDefinition object
39
- require "core/definition" # Lorj Process definition
40
- require "core/definition_internal" # Lorj internal functions
36
+ require 'core/core_internal' # Lorj Core class private init. functions
37
+ require 'core/core' # Lorj Core class
38
+ require 'core/core_model' # Lorj Model class
39
+ require 'core/core_process' # Lorj core process functions
40
+ require 'core/core_controller' # Lorj core controller functions
41
+ require 'core/core_object_data' # Lorj ObjectData class
42
+ require 'core/lorj_data' # Lorj Lorj::Data object
43
+ require 'core/lorj_basedefinition' # Lorj Lorj::BaseDefinition object
44
+ require 'core/lorj_baseprocess' # Lorj Lorj::BaseProcess object
45
+ require 'core/lorj_basecontroller' # Lorj Lorj::BaseController object
46
+ require 'core/lorj_keypath' # Lorj Lorj::BaseDefinition object
47
+ require 'core/definition' # Lorj Process definition
48
+ require 'core/definition_internal' # Lorj internal functions
41
49
 
50
+ # lorj module
42
51
  module Lorj
43
- slib_forj = File.dirname(__FILE__)
52
+ # Internal Lorj function to debug lorj.
53
+ #
54
+ # * *Args* :
55
+ # - +iLevel+ : value between 1 to 5. Setting 5 is the most verbose!
56
+ # - +sMsg+ : Array of string or symbols. keys tree to follow and check
57
+ # existence in yVal.
58
+ #
59
+ # * *Returns* :
60
+ # - nothing
61
+ #
62
+ # * *Raises* :
63
+ # No exceptions
64
+ def self::debug(iLevel, sMsg, *p)
65
+ if iLevel <= PrcLib.core_level
66
+ message = format('-%s- %s', iLevel, sMsg)
67
+
68
+ PrcLib.debug(format(message, *p))
69
+ end
70
+ end
71
+
72
+ # Internal PrcError class object derived from RuntimeError.
73
+ # Internally used with raise.
74
+ # Used to identify the error origin, while an error is thrown.
75
+ class PrcError < RuntimeError
76
+ attr_reader :lorg_message
77
+
78
+ def initialize(message = nil)
79
+ @lorj_message = message
80
+ end
81
+ end
82
+
83
+ slib_forj = File.dirname(__FILE__)
44
84
 
45
- PrcLib.lib_path = File.expand_path(File.join(File.dirname(slib_forj),'lib'))
85
+ PrcLib.lib_path = File.expand_path(File.join(File.dirname(slib_forj), 'lib'))
46
86
 
47
- PrcLib.core_level = 0
87
+ PrcLib.core_level = 0
48
88
  end