blufin 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/bf +5 -0
- data/bin/blufin +5 -0
- data/lib/blufin.rb +245 -0
- data/lib/core/code_scanners/common/scanner_common.rb +83 -0
- data/lib/core/code_scanners/common/scanner_java.rb +106 -0
- data/lib/core/code_scanners/scanner_java_embedded_objects.rb +386 -0
- data/lib/core/code_scanners/scanner_java_enums.rb +125 -0
- data/lib/core/code_scanners/scanner_java_source.rb +29 -0
- data/lib/core/code_scanners/scanner_java_tests.rb +157 -0
- data/lib/core/error_handling/schema_error.rb +9 -0
- data/lib/core/error_handling/sql_error.rb +21 -0
- data/lib/core/error_handling/sql_error_handler.rb +149 -0
- data/lib/core/error_handling/yml_error.rb +21 -0
- data/lib/core/error_handling/yml_error_handler.rb +437 -0
- data/lib/core/mysql.rb +347 -0
- data/lib/core/opt.rb +21 -0
- data/lib/core/site/site.rb +26 -0
- data/lib/core/site/site_auth.rb +88 -0
- data/lib/core/site/site_embedded.rb +27 -0
- data/lib/core/site/site_ports.rb +9 -0
- data/lib/core/site/site_resolver.rb +276 -0
- data/lib/core/site/site_services.rb +162 -0
- data/lib/core/site/site_ui.rb +16 -0
- data/lib/core/yml/config/yml_config_validator.rb +219 -0
- data/lib/core/yml/maven/yml_maven_validator.rb +1132 -0
- data/lib/core/yml/resource/yml_resource_validator.rb +154 -0
- data/lib/core/yml/schema/yml_schema_flags.rb +9 -0
- data/lib/core/yml/schema/yml_schema_validator.rb +1850 -0
- data/lib/core/yml/yml_cache_handler.rb +115 -0
- data/lib/core/yml/yml_common.rb +487 -0
- data/lib/core/yml/yml_meta_writer_base.rb +300 -0
- data/lib/core/yml/yml_outputter.rb +307 -0
- data/lib/core/yml/yml_validator_base.rb +630 -0
- data/lib/core/yml_writers/yml_configuration_writer.rb +40 -0
- data/lib/core/yml_writers/yml_java_api_resource_writer.rb +348 -0
- data/lib/core/yml_writers/yml_java_cron_type_writer.rb +113 -0
- data/lib/core/yml_writers/yml_java_css_dependency_writer.rb +59 -0
- data/lib/core/yml_writers/yml_java_dao_writer.rb +364 -0
- data/lib/core/yml_writers/yml_java_dto_writer.rb +251 -0
- data/lib/core/yml_writers/yml_java_embedded_object_writer.rb +968 -0
- data/lib/core/yml_writers/yml_java_enum_writer.rb +161 -0
- data/lib/core/yml_writers/yml_java_js_dependency_writer.rb +59 -0
- data/lib/core/yml_writers/yml_java_message_type_writer.rb +106 -0
- data/lib/core/yml_writers/yml_java_meta_writer.rb +173 -0
- data/lib/core/yml_writers/yml_java_model_writer.rb +510 -0
- data/lib/core/yml_writers/yml_java_pom_writer.rb +1050 -0
- data/lib/core/yml_writers/yml_java_resource_data_writer.rb +251 -0
- data/lib/core/yml_writers/yml_java_sdk_writer.rb +732 -0
- data/lib/core/yml_writers/yml_java_validator_writer.rb +280 -0
- data/lib/core/yml_writers/yml_java_worker_writer.rb +81 -0
- data/lib/core/yml_writers/yml_sql_structure_writer.rb +307 -0
- data/lib/core/yml_writers/yml_sql_template_writer.rb +243 -0
- data/lib/core/yml_writers/yml_vue_service_writer.rb +170 -0
- data/lib/core/yml_writers/yml_writer_base.rb +114 -0
- data/lib/routes/api_list.rb +35 -0
- data/lib/routes/api_meta.rb +59 -0
- data/lib/routes/build.rb +46 -0
- data/lib/routes/create/create_api.rb +35 -0
- data/lib/routes/create/create_ui.rb +84 -0
- data/lib/routes/export.rb +56 -0
- data/lib/routes/generate/generate_api.rb +225 -0
- data/lib/routes/generate/generate_img_favicon.rb +56 -0
- data/lib/routes/generate/generate_img_landing.rb +94 -0
- data/lib/routes/generate/generate_lambda.rb +43 -0
- data/lib/routes/lint.rb +35 -0
- data/lib/routes/mysql_reset.rb +43 -0
- data/lib/routes/release_blufin.rb +351 -0
- data/lib/routes/run.rb +35 -0
- data/lib/version.rb +1 -0
- data/opt/README.MD +2 -0
- data/opt/config/schema.yml +73 -0
- data/opt/config/template.yml +25 -0
- data/opt/sql/data/config/data-client.sql +7 -0
- data/opt/sql/data/config/data-db-configuration-property.sql +47 -0
- data/opt/sql/data/config/data-db-configuration.sql +9 -0
- data/opt/sql/data/config/data-db.sql +175 -0
- data/opt/sql/data/config/data-profile-api.sql +47 -0
- data/opt/sql/data/config/data-profile-cron.sql +0 -0
- data/opt/sql/data/config/data-profile-worker.sql +0 -0
- data/opt/sql/data/config/data-profile.sql +87 -0
- data/opt/sql/data/config/data-project.sql +95 -0
- data/opt/sql/structure/blufin-master-structure-fks.sql +65 -0
- data/opt/sql/structure/blufin-master-structure.sql +97 -0
- data/opt/sql/structure/blufin-mock-structure-fks.sql +38 -0
- data/opt/sql/structure/blufin-mock-structure.sql +98 -0
- data/opt/sql/templates/config/template-client.sql +7 -0
- data/opt/sql/templates/config/template-db-configuration-property.sql +11 -0
- data/opt/sql/templates/config/template-db-configuration.sql +9 -0
- data/opt/sql/templates/config/template-db.sql +21 -0
- data/opt/sql/templates/config/template-profile-api.sql +11 -0
- data/opt/sql/templates/config/template-profile-cron.sql +7 -0
- data/opt/sql/templates/config/template-profile-worker.sql +7 -0
- data/opt/sql/templates/config/template-profile.sql +21 -0
- data/opt/sql/templates/config/template-project.sql +23 -0
- data/opt/yml/api/schema/config/client.yml +14 -0
- data/opt/yml/api/schema/config/db.yml +45 -0
- data/opt/yml/api/schema/config/db_configuration.yml +22 -0
- data/opt/yml/api/schema/config/db_configuration_property.yml +22 -0
- data/opt/yml/api/schema/config/profile.yml +53 -0
- data/opt/yml/api/schema/config/profile_api.yml +22 -0
- data/opt/yml/api/schema/config/profile_cron.yml +14 -0
- data/opt/yml/api/schema/config/profile_worker.yml +14 -0
- data/opt/yml/api/schema/config/project.yml +48 -0
- data/opt/yml/api/schema/mock/mock.yml +99 -0
- data/opt/yml/api/schema/mock/mock_nested_if_enum.yml +16 -0
- data/opt/yml/api/schema/mock/mock_nested_if_enum_system.yml +16 -0
- data/opt/yml/api/schema/mock/mock_nested_linked.yml +43 -0
- data/opt/yml/api/schema/mock/mock_nested_multiple.yml +61 -0
- data/opt/yml/api/schema/mock/mock_nested_single.yml +67 -0
- data/opt/yml/api/schema/mock/mock_nested_single_super_deep.yml +32 -0
- data/opt/yml/api/schema/mock/mock_nested_single_super_super_deep.yml +17 -0
- metadata +240 -0
@@ -0,0 +1,219 @@
|
|
1
|
+
module Blufin
|
2
|
+
|
3
|
+
class YmlConfigValidator < Blufin::YmlValidatorBase
|
4
|
+
|
5
|
+
GET = 'GET'
|
6
|
+
POST = 'POST'
|
7
|
+
PUT = 'PUT'
|
8
|
+
PATCH = 'PATCH'
|
9
|
+
DELETE = 'DELETE'
|
10
|
+
|
11
|
+
VALID_METHODS = [GET, POST, PUT, PATCH, DELETE]
|
12
|
+
|
13
|
+
attr_accessor :config_data
|
14
|
+
|
15
|
+
GLOBAL = 'global'
|
16
|
+
GLOBAL_AUTHENTICATION = 'authentication'
|
17
|
+
|
18
|
+
CRON = 'cron'
|
19
|
+
|
20
|
+
WORKER = 'worker'
|
21
|
+
WORKER_PRIORITY = 'priority'
|
22
|
+
WORKER_DESCRIPTION = 'description'
|
23
|
+
|
24
|
+
MESSAGE = 'message'
|
25
|
+
MESSAGE_RECEIVER = 'MessageReceiver'
|
26
|
+
|
27
|
+
STRUCTURE = [
|
28
|
+
{
|
29
|
+
:section_name => GLOBAL,
|
30
|
+
:section_type => Blufin::YmlValidatorBase::SECTION_TYPE_FIXED,
|
31
|
+
:section_data => {
|
32
|
+
GLOBAL_AUTHENTICATION => {
|
33
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT,
|
34
|
+
:required => true
|
35
|
+
}
|
36
|
+
}
|
37
|
+
},
|
38
|
+
{
|
39
|
+
:section_name => CRON,
|
40
|
+
:section_type => Blufin::YmlValidatorBase::SECTION_TYPE_DYNAMIC,
|
41
|
+
:section_data => {
|
42
|
+
:section_alphabetical => true,
|
43
|
+
:section_regex => /\A[a-z_]+\z/,
|
44
|
+
:section_fields => {
|
45
|
+
MESSAGE => {
|
46
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT,
|
47
|
+
:required => true
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
},
|
52
|
+
{
|
53
|
+
:section_name => WORKER,
|
54
|
+
:section_type => Blufin::YmlValidatorBase::SECTION_TYPE_DYNAMIC,
|
55
|
+
:section_data => {
|
56
|
+
:section_alphabetical => true,
|
57
|
+
:section_regex => /\A[a-z_]+\z/,
|
58
|
+
:section_fields => {
|
59
|
+
WORKER_PRIORITY => {
|
60
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT,
|
61
|
+
:required => true
|
62
|
+
},
|
63
|
+
WORKER_DESCRIPTION => {
|
64
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT,
|
65
|
+
:required => true
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
]
|
71
|
+
|
72
|
+
PLACEHOLDER_PACKAGE = '{{--PLACEHOLDER-PACKAGE--}}'
|
73
|
+
PLACEHOLDER_CLASS = '{{--PLACEHOLDER-CLASS--}}'
|
74
|
+
PLACEHOLDER_ONE = '{{--PLACEHOLDER-ONE--}}'
|
75
|
+
PLACEHOLDER_TWO = '{{--PLACEHOLDER-TWO--}}'
|
76
|
+
PLACEHOLDER_THREE = '{{--PLACEHOLDER-THREE--}}'
|
77
|
+
PLACEHOLDER_FOUR = '{{--PLACEHOLDER-FOUR--}}'
|
78
|
+
PLACEHOLDER_FIVE = '{{--PLACEHOLDER-FIVE--}}'
|
79
|
+
PLACEHOLDER_SIX = '{{--PLACEHOLDER-SIX--}}'
|
80
|
+
PLACEHOLDER_SITE_NAME = '{{--SITE-NAME--}}'
|
81
|
+
PLACEHOLDER_SITE_DOMAIN = '{{--SITE-DOMAIN--}}'
|
82
|
+
|
83
|
+
TEMPLATE_WORKER = <<TEMPLATE
|
84
|
+
package #{PLACEHOLDER_PACKAGE};
|
85
|
+
|
86
|
+
import org.blufin.core.cloud.queue.MessageIncoming;
|
87
|
+
import org.blufin.worker.queue.MessageHandlerInterface;
|
88
|
+
|
89
|
+
public final class #{PLACEHOLDER_CLASS} implements MessageHandlerInterface {
|
90
|
+
|
91
|
+
@Override
|
92
|
+
public boolean handle(MessageIncoming message) throws Exception {
|
93
|
+
|
94
|
+
return false;
|
95
|
+
}
|
96
|
+
}
|
97
|
+
TEMPLATE
|
98
|
+
|
99
|
+
# Initialize the class.
|
100
|
+
# @return void
|
101
|
+
def initialize(site, error_handler)
|
102
|
+
|
103
|
+
@site = Blufin::SiteResolver::validate_site(site)
|
104
|
+
@site_path = Blufin::SiteResolver::get_site_location(@site)
|
105
|
+
@site_name = Blufin::SiteResolver::get_site_name(@site)
|
106
|
+
@site_domain = Blufin::SiteResolver::get_site_domain(@site)
|
107
|
+
|
108
|
+
@error_handler = error_handler
|
109
|
+
@config_file = "#{Blufin::SiteResolver::get_site_location(@site)}/#{Blufin::Site::PATH_TO_YML_CONFIG}/config.yml"
|
110
|
+
|
111
|
+
@@message_types = nil
|
112
|
+
@@cron_types = nil
|
113
|
+
|
114
|
+
return unless Blufin::YmlCommon::validate_directory_structure(@site_path, Blufin::Site::PATH_TO_YML_CONFIG, %w(config.yml), [], @error_handler)
|
115
|
+
|
116
|
+
@@config_data = validate_single_file(site, @config_file, STRUCTURE, error_handler)
|
117
|
+
@@config_data = @@config_data[@config_file]
|
118
|
+
|
119
|
+
@config_data = @@config_data
|
120
|
+
|
121
|
+
validate_data
|
122
|
+
|
123
|
+
end
|
124
|
+
|
125
|
+
# Get MessageType(s) as Array from @@config_data.
|
126
|
+
# @return Array
|
127
|
+
def self.get_message_types
|
128
|
+
if @@message_types.nil?
|
129
|
+
@@message_types = {}
|
130
|
+
if !@@config_data[WORKER].nil? && @@config_data[WORKER].keys.any?
|
131
|
+
@@config_data[WORKER].each do |key, data|
|
132
|
+
@@message_types[key] = data
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
@@message_types
|
137
|
+
end
|
138
|
+
|
139
|
+
# Get CronTypes(s) as Array from @@config_data.
|
140
|
+
# @return Array
|
141
|
+
def self.get_cron_types
|
142
|
+
if @@cron_types.nil?
|
143
|
+
@@cron_types = {}
|
144
|
+
if !@@config_data[CRON].nil? && @@config_data[CRON].keys.any?
|
145
|
+
@@config_data[CRON].each do |key, data|
|
146
|
+
@@cron_types[key] = data
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
@@cron_types
|
151
|
+
end
|
152
|
+
|
153
|
+
private
|
154
|
+
|
155
|
+
# Custom validation only applicable to CONFIG YML definition(s).
|
156
|
+
# @return void
|
157
|
+
def validate_data
|
158
|
+
|
159
|
+
validate_global
|
160
|
+
return unless validate_worker # Worker needs to go first because it contains all the "message" types.
|
161
|
+
validate_cron
|
162
|
+
|
163
|
+
end
|
164
|
+
|
165
|
+
# Validates -> "global" section
|
166
|
+
# @return void
|
167
|
+
def validate_global
|
168
|
+
if @@config_data[GLOBAL].is_a?(Hash)
|
169
|
+
value = @@config_data[GLOBAL][GLOBAL_AUTHENTICATION]
|
170
|
+
valid_auth_levels = Blufin::SiteAuth::AUTHENTICATION_LEVELS.keys
|
171
|
+
# Make sure the AuthLevel is a valid value.
|
172
|
+
unless valid_auth_levels.include?(value)
|
173
|
+
@yml_error_handler.add_error(Blufin::YmlErrorHandler::FIELD_INVALID_VALUE, @config_file, GLOBAL, GLOBAL_AUTHENTICATION, valid_auth_levels.join(' '))
|
174
|
+
return
|
175
|
+
end
|
176
|
+
raise 'This error occurred because you forgot to run Blufin::SiteEmbedded::init() somewhere...' if Blufin::SiteEmbedded::get_data.nil?
|
177
|
+
# Make sure the embedded object exists.
|
178
|
+
valid_embedded_objects = Blufin::SiteEmbedded::get_data.keys
|
179
|
+
expected_embedded_objects = Blufin::SiteAuth::AUTHENTICATION_LEVELS[value]
|
180
|
+
expected_embedded_objects.each do |expected_embedded_object|
|
181
|
+
@yml_error_handler.add_error(Blufin::YmlErrorHandler::EMBEDDED_OBJECT_NOT_FOUND, @config_file, GLOBAL, GLOBAL_AUTHENTICATION, expected_embedded_object) unless valid_embedded_objects.include?(expected_embedded_object)
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
# Validates -> "worker" section
|
187
|
+
# Checks that the boiler-plate MessageType handlers exist and implement correct interface.
|
188
|
+
# @return void
|
189
|
+
def validate_worker
|
190
|
+
message_types = Blufin::YmlConfigValidator::get_message_types.keys
|
191
|
+
return false unless message_types.any?
|
192
|
+
content_hash = {}
|
193
|
+
message_types.each do |snake_cased_string|
|
194
|
+
class_name = "#{Blufin::Strings::snake_case_to_camel_case(snake_cased_string)}#{Blufin::YmlJavaWorkerWriter::MESSAGE_HANDLER}"
|
195
|
+
message_type_camel_cased_lower = Blufin::Strings::snake_case_to_camel_case_lower(snake_cased_string)
|
196
|
+
contents = TEMPLATE_WORKER
|
197
|
+
contents = contents.gsub(PLACEHOLDER_PACKAGE, "#{@site_domain}.#{@site_name.gsub('-', '.')}.#{Blufin::SiteServices::WORKER}.messages.#{message_type_camel_cased_lower}".gsub(/^\./, ''))
|
198
|
+
contents = contents.gsub(PLACEHOLDER_CLASS, class_name)
|
199
|
+
content_hash[snake_cased_string] = [contents, [' return false;'], "#{class_name}.java"]
|
200
|
+
end
|
201
|
+
path = "#{Blufin::SiteResolver::path_to_java_worker(@site)}/src/main/java/#{@site_domain.gsub('.', '/')}/#{@site_name}/#{Blufin::SiteServices::WORKER}/messages"
|
202
|
+
Blufin::YmlCommon::create_boilerplate_files(content_hash, path, @site, @error_handler)
|
203
|
+
true
|
204
|
+
end
|
205
|
+
|
206
|
+
# Validates -> "cron" section
|
207
|
+
# @return void
|
208
|
+
def validate_cron
|
209
|
+
cron_types = Blufin::YmlConfigValidator::get_cron_types
|
210
|
+
return false unless cron_types.any?
|
211
|
+
message_types = Blufin::YmlConfigValidator::get_message_types.keys
|
212
|
+
cron_types.each do |key, value|
|
213
|
+
@error_handler.add_error(Blufin::YmlErrorHandler::WORKER_MESSAGE_TYPE_NOT_FOUND, @config_file, CRON, "#{key}|#{MESSAGE}", value[MESSAGE]) unless message_types.include?(value[MESSAGE])
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
end
|
218
|
+
|
219
|
+
end
|
@@ -0,0 +1,1132 @@
|
|
1
|
+
module Blufin
|
2
|
+
|
3
|
+
class YmlMavenValidator < Blufin::YmlValidatorBase
|
4
|
+
|
5
|
+
attr_accessor :data_blufin, :data_app
|
6
|
+
|
7
|
+
CONFIG = 'config'
|
8
|
+
CONFIG_JAVA = 'java'
|
9
|
+
CONFIG_JAVA_VERSION = 'version'
|
10
|
+
CONFIG_BLUFIN = 'blufin'
|
11
|
+
CONFIG_BLUFIN_VERSION = 'version'
|
12
|
+
CONFIG_PARENTS = 'parents'
|
13
|
+
CONFIG_PARENTS_NAME = 'name'
|
14
|
+
CONFIG_PARENTS_TITLE = 'title'
|
15
|
+
CONFIG_APP_VERSION = 'version'
|
16
|
+
|
17
|
+
|
18
|
+
DEPENDENCIES_APP = 'dependencies-app'
|
19
|
+
DEPENDENCIES_BLUFIN = 'dependencies-blufin'
|
20
|
+
DEPENDENCIES_MVN = 'dependencies-mvn'
|
21
|
+
DEPENDENCIES_GROUP_ID = 'group-id'
|
22
|
+
DEPENDENCIES_ARTIFACT_ID = 'artifact-id'
|
23
|
+
DEPENDENCIES_VERSION = 'version'
|
24
|
+
DEPENDENCIES_USE = 'use'
|
25
|
+
DEPENDENCIES_EXCLUDE = 'exclude'
|
26
|
+
DEPENDENCIES_TEST_SCOPE = 'testScope'
|
27
|
+
DEPENDENCIES_TEST_JAR = 'testJar'
|
28
|
+
|
29
|
+
BLUFIN = 'blufin'
|
30
|
+
BLUFIN_TITLE = 'title'
|
31
|
+
BLUFIN_PARENT = 'parent'
|
32
|
+
|
33
|
+
APP_INFRASTRUCTURE = 'app-infrastructure'
|
34
|
+
APP_INFRASTRUCTURE_API = 'api'
|
35
|
+
APP_INFRASTRUCTURE_CRON = 'cron'
|
36
|
+
APP_INFRASTRUCTURE_LIB = 'lib'
|
37
|
+
APP_INFRASTRUCTURE_SDK_CORE = 'sdk-core'
|
38
|
+
APP_INFRASTRUCTURE_SDK_INTERNAL = 'sdk-internal'
|
39
|
+
APP_INFRASTRUCTURE_SDK_OAUTH = 'sdk-oauth'
|
40
|
+
APP_INFRASTRUCTURE_WORKER = 'worker'
|
41
|
+
APP_INFRASTRUCTURE_BUILD_PLUGINS = 'dependencies-external'
|
42
|
+
|
43
|
+
EXTRA_DATA = 'extra-data'
|
44
|
+
EXTRA_DATA_CORE_LIBS = 'core-libs'
|
45
|
+
EXTRA_DATA_CORE_LIBS_WITH_CHILDREN = 'core-libs-with-children'
|
46
|
+
EXTRA_DATA_CORE_LIBS_PARENTS = 'core-libs-parents'
|
47
|
+
EXTRA_DATA_MVN_CACHE = 'extra-data-mvn-cache'
|
48
|
+
|
49
|
+
TYPE_BLUFIN = 'type_blufin'
|
50
|
+
TYPE_APP = 'type_app'
|
51
|
+
|
52
|
+
STRUCTURE_BLUFIN = [
|
53
|
+
{
|
54
|
+
:section_name => CONFIG,
|
55
|
+
:section_type => Blufin::YmlValidatorBase::SECTION_TYPE_FIXED,
|
56
|
+
:section_data => {
|
57
|
+
CONFIG_JAVA => {
|
58
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_NESTED_DATA,
|
59
|
+
:required => true,
|
60
|
+
:section_data => {
|
61
|
+
CONFIG_JAVA_VERSION => {
|
62
|
+
:type => FIELD_TYPE_TEXT,
|
63
|
+
:required => true,
|
64
|
+
:regex => /\A1\.[0-9]+\z/
|
65
|
+
}
|
66
|
+
}
|
67
|
+
},
|
68
|
+
CONFIG_BLUFIN => {
|
69
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_NESTED_DATA,
|
70
|
+
:required => true,
|
71
|
+
:section_data => {
|
72
|
+
CONFIG_BLUFIN_VERSION => {
|
73
|
+
:type => FIELD_TYPE_TEXT,
|
74
|
+
:required => true,
|
75
|
+
:regex => /\A[0-9]{1,4}\.[0-9]{1,4}\.[0-9]{1,4}(-SNAPSHOT)?\z/
|
76
|
+
}
|
77
|
+
}
|
78
|
+
},
|
79
|
+
CONFIG_PARENTS => {
|
80
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
81
|
+
:required => false,
|
82
|
+
:section_data => {
|
83
|
+
CONFIG_PARENTS_NAME => {
|
84
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT,
|
85
|
+
:regex => /\Ablufin-([a-z0-9\-])+\z/
|
86
|
+
},
|
87
|
+
CONFIG_PARENTS_TITLE => {
|
88
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
89
|
+
},
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
},
|
94
|
+
{
|
95
|
+
:section_name => DEPENDENCIES_MVN,
|
96
|
+
:section_type => Blufin::YmlValidatorBase::SECTION_TYPE_ARRAY,
|
97
|
+
:section_data => {
|
98
|
+
DEPENDENCIES_GROUP_ID => {
|
99
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
100
|
+
},
|
101
|
+
DEPENDENCIES_ARTIFACT_ID => {
|
102
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
103
|
+
},
|
104
|
+
DEPENDENCIES_VERSION => {
|
105
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
106
|
+
}
|
107
|
+
}
|
108
|
+
},
|
109
|
+
{
|
110
|
+
:section_name => BLUFIN,
|
111
|
+
:section_type => Blufin::YmlValidatorBase::SECTION_TYPE_DYNAMIC,
|
112
|
+
:section_data => {
|
113
|
+
:section_alphabetical => true,
|
114
|
+
:section_regex => /[a-z\-]+/,
|
115
|
+
:section_fields => {
|
116
|
+
BLUFIN_TITLE => {
|
117
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT,
|
118
|
+
:required => true
|
119
|
+
},
|
120
|
+
BLUFIN_PARENT => {
|
121
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT,
|
122
|
+
:required => false
|
123
|
+
},
|
124
|
+
DEPENDENCIES_BLUFIN => {
|
125
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
126
|
+
:required => false,
|
127
|
+
:section_data => {
|
128
|
+
DEPENDENCIES_USE => {
|
129
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
130
|
+
},
|
131
|
+
DEPENDENCIES_EXCLUDE => {
|
132
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
133
|
+
:required => false
|
134
|
+
},
|
135
|
+
DEPENDENCIES_TEST_SCOPE => {
|
136
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
137
|
+
:required => false
|
138
|
+
},
|
139
|
+
DEPENDENCIES_TEST_JAR => {
|
140
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
141
|
+
:required => false
|
142
|
+
}
|
143
|
+
}
|
144
|
+
},
|
145
|
+
DEPENDENCIES_MVN => {
|
146
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
147
|
+
:required => false,
|
148
|
+
:section_data => {
|
149
|
+
DEPENDENCIES_USE => {
|
150
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
151
|
+
},
|
152
|
+
DEPENDENCIES_EXCLUDE => {
|
153
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
154
|
+
:required => false
|
155
|
+
},
|
156
|
+
DEPENDENCIES_TEST_SCOPE => {
|
157
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
158
|
+
:required => false
|
159
|
+
}
|
160
|
+
}
|
161
|
+
}
|
162
|
+
},
|
163
|
+
}
|
164
|
+
}
|
165
|
+
]
|
166
|
+
|
167
|
+
STRUCTURE_APP = [
|
168
|
+
{
|
169
|
+
:section_name => CONFIG,
|
170
|
+
:section_type => Blufin::YmlValidatorBase::SECTION_TYPE_FIXED,
|
171
|
+
:section_data => {
|
172
|
+
CONFIG_JAVA => {
|
173
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_NESTED_DATA,
|
174
|
+
:required => true,
|
175
|
+
:section_data => {
|
176
|
+
CONFIG_JAVA_VERSION => {
|
177
|
+
:type => FIELD_TYPE_TEXT,
|
178
|
+
:required => true,
|
179
|
+
:regex => /\A1\.[0-9]+\z/
|
180
|
+
}
|
181
|
+
}
|
182
|
+
},
|
183
|
+
CONFIG_BLUFIN => {
|
184
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_NESTED_DATA,
|
185
|
+
:required => true,
|
186
|
+
:section_data => {
|
187
|
+
CONFIG_BLUFIN_VERSION => {
|
188
|
+
:type => FIELD_TYPE_TEXT,
|
189
|
+
:required => true,
|
190
|
+
:regex => /\A[0-9]{1,4}\.[0-9]{1,4}\.[0-9]{1,4}(-SNAPSHOT)?\z/
|
191
|
+
}
|
192
|
+
}
|
193
|
+
},
|
194
|
+
CONFIG_PARENTS => {
|
195
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
196
|
+
:required => false,
|
197
|
+
:section_data => {
|
198
|
+
CONFIG_PARENTS_NAME => {
|
199
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT,
|
200
|
+
:regex => /\A[a-z0-9\-]+-[a-z0-9\-]+\z/
|
201
|
+
},
|
202
|
+
CONFIG_PARENTS_TITLE => {
|
203
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
204
|
+
},
|
205
|
+
}
|
206
|
+
}
|
207
|
+
}
|
208
|
+
},
|
209
|
+
{
|
210
|
+
:section_name => DEPENDENCIES_MVN,
|
211
|
+
:section_type => Blufin::YmlValidatorBase::SECTION_TYPE_ARRAY,
|
212
|
+
:required => false,
|
213
|
+
:section_data => {
|
214
|
+
DEPENDENCIES_GROUP_ID => {
|
215
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
216
|
+
},
|
217
|
+
DEPENDENCIES_ARTIFACT_ID => {
|
218
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
219
|
+
},
|
220
|
+
DEPENDENCIES_VERSION => {
|
221
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
222
|
+
}
|
223
|
+
}
|
224
|
+
},
|
225
|
+
{
|
226
|
+
:section_name => APP_INFRASTRUCTURE,
|
227
|
+
:section_type => Blufin::YmlValidatorBase::SECTION_TYPE_FIXED,
|
228
|
+
:section_data => {
|
229
|
+
APP_INFRASTRUCTURE_API => {
|
230
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_NESTED_DATA,
|
231
|
+
:required => true,
|
232
|
+
:section_data => {
|
233
|
+
BLUFIN_TITLE => {
|
234
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT,
|
235
|
+
:required => true
|
236
|
+
},
|
237
|
+
BLUFIN_PARENT => {
|
238
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT,
|
239
|
+
:required => false
|
240
|
+
},
|
241
|
+
DEPENDENCIES_APP => {
|
242
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
243
|
+
:required => false,
|
244
|
+
:section_data => {
|
245
|
+
DEPENDENCIES_USE => {
|
246
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
247
|
+
},
|
248
|
+
DEPENDENCIES_EXCLUDE => {
|
249
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
250
|
+
:required => false
|
251
|
+
},
|
252
|
+
DEPENDENCIES_TEST_SCOPE => {
|
253
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
254
|
+
:required => false
|
255
|
+
},
|
256
|
+
DEPENDENCIES_TEST_JAR => {
|
257
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
258
|
+
:required => false
|
259
|
+
}
|
260
|
+
}
|
261
|
+
},
|
262
|
+
DEPENDENCIES_BLUFIN => {
|
263
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
264
|
+
:required => false,
|
265
|
+
:section_data => {
|
266
|
+
DEPENDENCIES_USE => {
|
267
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
268
|
+
},
|
269
|
+
DEPENDENCIES_EXCLUDE => {
|
270
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
271
|
+
:required => false
|
272
|
+
},
|
273
|
+
DEPENDENCIES_TEST_SCOPE => {
|
274
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
275
|
+
:required => false
|
276
|
+
},
|
277
|
+
DEPENDENCIES_TEST_JAR => {
|
278
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
279
|
+
:required => false
|
280
|
+
}
|
281
|
+
}
|
282
|
+
},
|
283
|
+
DEPENDENCIES_MVN => {
|
284
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
285
|
+
:required => false,
|
286
|
+
:section_data => {
|
287
|
+
DEPENDENCIES_USE => {
|
288
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
289
|
+
},
|
290
|
+
DEPENDENCIES_EXCLUDE => {
|
291
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
292
|
+
:required => false
|
293
|
+
},
|
294
|
+
DEPENDENCIES_TEST_SCOPE => {
|
295
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
296
|
+
:required => false
|
297
|
+
}
|
298
|
+
}
|
299
|
+
}
|
300
|
+
}
|
301
|
+
},
|
302
|
+
APP_INFRASTRUCTURE_CRON => {
|
303
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_NESTED_DATA,
|
304
|
+
:required => true,
|
305
|
+
:section_data => {
|
306
|
+
BLUFIN_TITLE => {
|
307
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT,
|
308
|
+
:required => true
|
309
|
+
},
|
310
|
+
BLUFIN_PARENT => {
|
311
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT,
|
312
|
+
:required => false
|
313
|
+
},
|
314
|
+
DEPENDENCIES_APP => {
|
315
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
316
|
+
:required => false,
|
317
|
+
:section_data => {
|
318
|
+
DEPENDENCIES_USE => {
|
319
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
320
|
+
},
|
321
|
+
DEPENDENCIES_EXCLUDE => {
|
322
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
323
|
+
:required => false
|
324
|
+
},
|
325
|
+
DEPENDENCIES_TEST_SCOPE => {
|
326
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
327
|
+
:required => false
|
328
|
+
},
|
329
|
+
DEPENDENCIES_TEST_JAR => {
|
330
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
331
|
+
:required => false
|
332
|
+
}
|
333
|
+
}
|
334
|
+
},
|
335
|
+
DEPENDENCIES_BLUFIN => {
|
336
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
337
|
+
:required => false,
|
338
|
+
:section_data => {
|
339
|
+
DEPENDENCIES_USE => {
|
340
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
341
|
+
},
|
342
|
+
DEPENDENCIES_EXCLUDE => {
|
343
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
344
|
+
:required => false
|
345
|
+
},
|
346
|
+
DEPENDENCIES_TEST_SCOPE => {
|
347
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
348
|
+
:required => false
|
349
|
+
},
|
350
|
+
DEPENDENCIES_TEST_JAR => {
|
351
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
352
|
+
:required => false
|
353
|
+
}
|
354
|
+
}
|
355
|
+
},
|
356
|
+
DEPENDENCIES_MVN => {
|
357
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
358
|
+
:required => false,
|
359
|
+
:section_data => {
|
360
|
+
DEPENDENCIES_USE => {
|
361
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
362
|
+
},
|
363
|
+
DEPENDENCIES_EXCLUDE => {
|
364
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
365
|
+
:required => false
|
366
|
+
},
|
367
|
+
DEPENDENCIES_TEST_SCOPE => {
|
368
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
369
|
+
:required => false
|
370
|
+
}
|
371
|
+
}
|
372
|
+
}
|
373
|
+
}
|
374
|
+
},
|
375
|
+
APP_INFRASTRUCTURE_LIB => {
|
376
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_NESTED_DATA,
|
377
|
+
:required => true,
|
378
|
+
:section_data => {
|
379
|
+
BLUFIN_TITLE => {
|
380
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT,
|
381
|
+
:required => true
|
382
|
+
},
|
383
|
+
BLUFIN_PARENT => {
|
384
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT,
|
385
|
+
:required => false
|
386
|
+
},
|
387
|
+
DEPENDENCIES_APP => {
|
388
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
389
|
+
:required => false,
|
390
|
+
:section_data => {
|
391
|
+
DEPENDENCIES_USE => {
|
392
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
393
|
+
},
|
394
|
+
DEPENDENCIES_EXCLUDE => {
|
395
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
396
|
+
:required => false
|
397
|
+
},
|
398
|
+
DEPENDENCIES_TEST_SCOPE => {
|
399
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
400
|
+
:required => false
|
401
|
+
},
|
402
|
+
DEPENDENCIES_TEST_JAR => {
|
403
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
404
|
+
:required => false
|
405
|
+
}
|
406
|
+
}
|
407
|
+
},
|
408
|
+
DEPENDENCIES_BLUFIN => {
|
409
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
410
|
+
:required => false,
|
411
|
+
:section_data => {
|
412
|
+
DEPENDENCIES_USE => {
|
413
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
414
|
+
},
|
415
|
+
DEPENDENCIES_EXCLUDE => {
|
416
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
417
|
+
:required => false
|
418
|
+
},
|
419
|
+
DEPENDENCIES_TEST_SCOPE => {
|
420
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
421
|
+
:required => false
|
422
|
+
},
|
423
|
+
DEPENDENCIES_TEST_JAR => {
|
424
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
425
|
+
:required => false
|
426
|
+
}
|
427
|
+
}
|
428
|
+
},
|
429
|
+
DEPENDENCIES_MVN => {
|
430
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
431
|
+
:required => false,
|
432
|
+
:section_data => {
|
433
|
+
DEPENDENCIES_USE => {
|
434
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
435
|
+
},
|
436
|
+
DEPENDENCIES_EXCLUDE => {
|
437
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
438
|
+
:required => false
|
439
|
+
},
|
440
|
+
DEPENDENCIES_TEST_SCOPE => {
|
441
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
442
|
+
:required => false
|
443
|
+
}
|
444
|
+
}
|
445
|
+
}
|
446
|
+
}
|
447
|
+
},
|
448
|
+
APP_INFRASTRUCTURE_SDK_CORE => {
|
449
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_NESTED_DATA,
|
450
|
+
:required => true,
|
451
|
+
:section_data => {
|
452
|
+
BLUFIN_TITLE => {
|
453
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT,
|
454
|
+
:required => true
|
455
|
+
},
|
456
|
+
BLUFIN_PARENT => {
|
457
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT,
|
458
|
+
:required => false
|
459
|
+
},
|
460
|
+
DEPENDENCIES_APP => {
|
461
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
462
|
+
:required => false,
|
463
|
+
:section_data => {
|
464
|
+
DEPENDENCIES_USE => {
|
465
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
466
|
+
},
|
467
|
+
DEPENDENCIES_EXCLUDE => {
|
468
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
469
|
+
:required => false
|
470
|
+
},
|
471
|
+
DEPENDENCIES_TEST_SCOPE => {
|
472
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
473
|
+
:required => false
|
474
|
+
},
|
475
|
+
DEPENDENCIES_TEST_JAR => {
|
476
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
477
|
+
:required => false
|
478
|
+
}
|
479
|
+
}
|
480
|
+
},
|
481
|
+
DEPENDENCIES_BLUFIN => {
|
482
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
483
|
+
:required => false,
|
484
|
+
:section_data => {
|
485
|
+
DEPENDENCIES_USE => {
|
486
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
487
|
+
},
|
488
|
+
DEPENDENCIES_EXCLUDE => {
|
489
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
490
|
+
:required => false
|
491
|
+
},
|
492
|
+
DEPENDENCIES_TEST_SCOPE => {
|
493
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
494
|
+
:required => false
|
495
|
+
},
|
496
|
+
DEPENDENCIES_TEST_JAR => {
|
497
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
498
|
+
:required => false
|
499
|
+
}
|
500
|
+
}
|
501
|
+
},
|
502
|
+
DEPENDENCIES_MVN => {
|
503
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
504
|
+
:required => false,
|
505
|
+
:section_data => {
|
506
|
+
DEPENDENCIES_USE => {
|
507
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
508
|
+
},
|
509
|
+
DEPENDENCIES_EXCLUDE => {
|
510
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
511
|
+
:required => false
|
512
|
+
},
|
513
|
+
DEPENDENCIES_TEST_SCOPE => {
|
514
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
515
|
+
:required => false
|
516
|
+
}
|
517
|
+
}
|
518
|
+
}
|
519
|
+
}
|
520
|
+
},
|
521
|
+
APP_INFRASTRUCTURE_SDK_INTERNAL => {
|
522
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_NESTED_DATA,
|
523
|
+
:required => true,
|
524
|
+
:section_data => {
|
525
|
+
BLUFIN_TITLE => {
|
526
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT,
|
527
|
+
:required => true
|
528
|
+
},
|
529
|
+
BLUFIN_PARENT => {
|
530
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT,
|
531
|
+
:required => false
|
532
|
+
},
|
533
|
+
DEPENDENCIES_APP => {
|
534
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
535
|
+
:required => false,
|
536
|
+
:section_data => {
|
537
|
+
DEPENDENCIES_USE => {
|
538
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
539
|
+
},
|
540
|
+
DEPENDENCIES_EXCLUDE => {
|
541
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
542
|
+
:required => false
|
543
|
+
},
|
544
|
+
DEPENDENCIES_TEST_SCOPE => {
|
545
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
546
|
+
:required => false
|
547
|
+
},
|
548
|
+
DEPENDENCIES_TEST_JAR => {
|
549
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
550
|
+
:required => false
|
551
|
+
}
|
552
|
+
}
|
553
|
+
},
|
554
|
+
DEPENDENCIES_BLUFIN => {
|
555
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
556
|
+
:required => false,
|
557
|
+
:section_data => {
|
558
|
+
DEPENDENCIES_USE => {
|
559
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
560
|
+
},
|
561
|
+
DEPENDENCIES_EXCLUDE => {
|
562
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
563
|
+
:required => false
|
564
|
+
},
|
565
|
+
DEPENDENCIES_TEST_SCOPE => {
|
566
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
567
|
+
:required => false
|
568
|
+
},
|
569
|
+
DEPENDENCIES_TEST_JAR => {
|
570
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
571
|
+
:required => false
|
572
|
+
}
|
573
|
+
}
|
574
|
+
},
|
575
|
+
DEPENDENCIES_MVN => {
|
576
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
577
|
+
:required => false,
|
578
|
+
:section_data => {
|
579
|
+
DEPENDENCIES_USE => {
|
580
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
581
|
+
},
|
582
|
+
DEPENDENCIES_EXCLUDE => {
|
583
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
584
|
+
:required => false
|
585
|
+
},
|
586
|
+
DEPENDENCIES_TEST_SCOPE => {
|
587
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
588
|
+
:required => false
|
589
|
+
}
|
590
|
+
}
|
591
|
+
}
|
592
|
+
}
|
593
|
+
},
|
594
|
+
APP_INFRASTRUCTURE_SDK_OAUTH => {
|
595
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_NESTED_DATA,
|
596
|
+
:required => true,
|
597
|
+
:section_data => {
|
598
|
+
BLUFIN_TITLE => {
|
599
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT,
|
600
|
+
:required => true
|
601
|
+
},
|
602
|
+
BLUFIN_PARENT => {
|
603
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT,
|
604
|
+
:required => false
|
605
|
+
},
|
606
|
+
DEPENDENCIES_APP => {
|
607
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
608
|
+
:required => false,
|
609
|
+
:section_data => {
|
610
|
+
DEPENDENCIES_USE => {
|
611
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
612
|
+
},
|
613
|
+
DEPENDENCIES_EXCLUDE => {
|
614
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
615
|
+
:required => false
|
616
|
+
},
|
617
|
+
DEPENDENCIES_TEST_SCOPE => {
|
618
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
619
|
+
:required => false
|
620
|
+
},
|
621
|
+
DEPENDENCIES_TEST_JAR => {
|
622
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
623
|
+
:required => false
|
624
|
+
}
|
625
|
+
}
|
626
|
+
},
|
627
|
+
DEPENDENCIES_BLUFIN => {
|
628
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
629
|
+
:required => false,
|
630
|
+
:section_data => {
|
631
|
+
DEPENDENCIES_USE => {
|
632
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
633
|
+
},
|
634
|
+
DEPENDENCIES_EXCLUDE => {
|
635
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
636
|
+
:required => false
|
637
|
+
},
|
638
|
+
DEPENDENCIES_TEST_SCOPE => {
|
639
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
640
|
+
:required => false
|
641
|
+
},
|
642
|
+
DEPENDENCIES_TEST_JAR => {
|
643
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
644
|
+
:required => false
|
645
|
+
}
|
646
|
+
}
|
647
|
+
},
|
648
|
+
DEPENDENCIES_MVN => {
|
649
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
650
|
+
:required => false,
|
651
|
+
:section_data => {
|
652
|
+
DEPENDENCIES_USE => {
|
653
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
654
|
+
},
|
655
|
+
DEPENDENCIES_EXCLUDE => {
|
656
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
657
|
+
:required => false
|
658
|
+
},
|
659
|
+
DEPENDENCIES_TEST_SCOPE => {
|
660
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
661
|
+
:required => false
|
662
|
+
}
|
663
|
+
}
|
664
|
+
}
|
665
|
+
}
|
666
|
+
},
|
667
|
+
APP_INFRASTRUCTURE_WORKER => {
|
668
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_NESTED_DATA,
|
669
|
+
:required => true,
|
670
|
+
:section_data => {
|
671
|
+
BLUFIN_TITLE => {
|
672
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT,
|
673
|
+
:required => true
|
674
|
+
},
|
675
|
+
BLUFIN_PARENT => {
|
676
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT,
|
677
|
+
:required => false
|
678
|
+
},
|
679
|
+
DEPENDENCIES_APP => {
|
680
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
681
|
+
:required => false,
|
682
|
+
:section_data => {
|
683
|
+
DEPENDENCIES_USE => {
|
684
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
685
|
+
},
|
686
|
+
DEPENDENCIES_EXCLUDE => {
|
687
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
688
|
+
:required => false
|
689
|
+
},
|
690
|
+
DEPENDENCIES_TEST_SCOPE => {
|
691
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
692
|
+
:required => false
|
693
|
+
},
|
694
|
+
DEPENDENCIES_TEST_JAR => {
|
695
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
696
|
+
:required => false
|
697
|
+
}
|
698
|
+
}
|
699
|
+
},
|
700
|
+
DEPENDENCIES_BLUFIN => {
|
701
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
702
|
+
:required => false,
|
703
|
+
:section_data => {
|
704
|
+
DEPENDENCIES_USE => {
|
705
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
706
|
+
},
|
707
|
+
DEPENDENCIES_EXCLUDE => {
|
708
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
709
|
+
:required => false
|
710
|
+
},
|
711
|
+
DEPENDENCIES_TEST_SCOPE => {
|
712
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
713
|
+
:required => false
|
714
|
+
},
|
715
|
+
DEPENDENCIES_TEST_JAR => {
|
716
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
717
|
+
:required => false
|
718
|
+
}
|
719
|
+
}
|
720
|
+
},
|
721
|
+
DEPENDENCIES_MVN => {
|
722
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
723
|
+
:required => false,
|
724
|
+
:section_data => {
|
725
|
+
DEPENDENCIES_USE => {
|
726
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT
|
727
|
+
},
|
728
|
+
DEPENDENCIES_EXCLUDE => {
|
729
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
730
|
+
:required => false
|
731
|
+
},
|
732
|
+
DEPENDENCIES_TEST_SCOPE => {
|
733
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN,
|
734
|
+
:required => false
|
735
|
+
}
|
736
|
+
}
|
737
|
+
}
|
738
|
+
}
|
739
|
+
}
|
740
|
+
}
|
741
|
+
}
|
742
|
+
]
|
743
|
+
|
744
|
+
# Initialize the class.
|
745
|
+
# @return void
|
746
|
+
def initialize(site, error_handler)
|
747
|
+
|
748
|
+
@error_handler = error_handler
|
749
|
+
@config_file_blufin = "#{Blufin::Config::get_path('Paths', 'BlufinJava')}/maven.yml"
|
750
|
+
|
751
|
+
unless site.nil?
|
752
|
+
|
753
|
+
@site = Blufin::SiteResolver::validate_site(site)
|
754
|
+
@site_path = Blufin::SiteResolver::get_site_location(@site)
|
755
|
+
@site_name = Blufin::SiteResolver::get_site_name(@site)
|
756
|
+
@site_title = Blufin::SiteResolver::get_site_title(@site)
|
757
|
+
@site_domain = Blufin::SiteResolver::get_site_domain(@site)
|
758
|
+
|
759
|
+
@config_file_app = "#{Blufin::SiteResolver::get_site_location(@site)}/#{Blufin::YmlMavenValidator::APP_INFRASTRUCTURE}/maven.yml"
|
760
|
+
|
761
|
+
return unless Blufin::YmlCommon::validate_directory_structure(@site_path, Blufin::Site::PATH_TO_YML_CONFIG, %w(config.yml), [], @error_handler)
|
762
|
+
|
763
|
+
end
|
764
|
+
|
765
|
+
# Parse BLUFIN maven.yml.
|
766
|
+
error_count_before = @error_handler.get_error_count
|
767
|
+
@data = validate_single_file(site, @config_file_blufin, STRUCTURE_BLUFIN, error_handler)
|
768
|
+
return false if @data.nil? || @error_handler.get_error_count > error_count_before
|
769
|
+
@data = @data[@config_file_blufin]
|
770
|
+
@data_blufin = validate_yml_file(@config_file_blufin, TYPE_BLUFIN)
|
771
|
+
|
772
|
+
unless site.nil?
|
773
|
+
|
774
|
+
@core_libraries = nil
|
775
|
+
@core_libraries_with_children = nil
|
776
|
+
|
777
|
+
# Parse APP-INFRASTRUCTURE maven.yml.
|
778
|
+
error_count_before = @error_handler.get_error_count
|
779
|
+
@data = validate_single_file(site, @config_file_app, alter_structure_for_app(STRUCTURE_APP), error_handler)
|
780
|
+
return false if @data.nil? || @error_handler.get_error_count > error_count_before
|
781
|
+
@data = @data[@config_file_app]
|
782
|
+
@data_app = validate_yml_file(@config_file_app, TYPE_APP)
|
783
|
+
|
784
|
+
end
|
785
|
+
|
786
|
+
end
|
787
|
+
|
788
|
+
private
|
789
|
+
|
790
|
+
# Custom validation only applicable to MAVEN YML definition(s) - BLUFIN.
|
791
|
+
# @return void
|
792
|
+
def validate_yml_file(config_file, type)
|
793
|
+
|
794
|
+
@data[EXTRA_DATA] = {}
|
795
|
+
@data[EXTRA_DATA][EXTRA_DATA_CORE_LIBS_PARENTS] = {}
|
796
|
+
@data[DEPENDENCIES_MVN] = [] if @data[DEPENDENCIES_MVN].nil?
|
797
|
+
|
798
|
+
# CACHE PARENT DEFINITIONS.
|
799
|
+
if @data[CONFIG].has_key?(CONFIG_PARENTS)
|
800
|
+
|
801
|
+
@data[CONFIG][CONFIG_PARENTS].each do |parent_definition|
|
802
|
+
name = nil
|
803
|
+
title = nil
|
804
|
+
parent_definition.each do |pd|
|
805
|
+
key = pd.keys[0]
|
806
|
+
value = pd.values[0]
|
807
|
+
if key == CONFIG_PARENTS_NAME
|
808
|
+
name = value
|
809
|
+
elsif key == CONFIG_PARENTS_TITLE
|
810
|
+
title = value
|
811
|
+
end
|
812
|
+
end
|
813
|
+
raise RuntimeError, 'name was empty, this should never happen!' if name.nil?
|
814
|
+
raise RuntimeError, 'title was empty, this should never happen!' if title.nil?
|
815
|
+
@data[EXTRA_DATA][EXTRA_DATA_CORE_LIBS_PARENTS][name] = {
|
816
|
+
:title => title
|
817
|
+
}
|
818
|
+
end
|
819
|
+
|
820
|
+
end
|
821
|
+
|
822
|
+
if type == TYPE_BLUFIN
|
823
|
+
|
824
|
+
# CHECK FOR DUPLICATES (blufin-java).
|
825
|
+
mvn_modules_internal = get_mvn_modules_and_check_for_duplicates(@data[DEPENDENCIES_MVN], config_file, DEPENDENCIES_MVN)
|
826
|
+
|
827
|
+
# CHECK MODULES ARE IN ALPHABETICAL ORDER (blufin-java).
|
828
|
+
check_modules_are_alphabetical_and_not_duplicated(mvn_modules_internal, DEPENDENCIES_MVN, nil, type)
|
829
|
+
|
830
|
+
else
|
831
|
+
|
832
|
+
@data_blufin[DEPENDENCIES_MVN].each do |bsd|
|
833
|
+
asd_found = false
|
834
|
+
if @data[DEPENDENCIES_MVN].any?
|
835
|
+
bsd_extract = Blufin::YmlCommon::extract_group_artifact_version_from_array(bsd)
|
836
|
+
@data[DEPENDENCIES_MVN].each do |asd|
|
837
|
+
asd_extract = Blufin::YmlCommon::extract_group_artifact_version_from_array(asd)
|
838
|
+
asd_found = true if "#{bsd_extract[DEPENDENCIES_GROUP_ID]}:#{bsd_extract[DEPENDENCIES_ARTIFACT_ID]}" == "#{asd_extract[DEPENDENCIES_GROUP_ID]}:#{asd_extract[DEPENDENCIES_ARTIFACT_ID]}"
|
839
|
+
end
|
840
|
+
end
|
841
|
+
@data[DEPENDENCIES_MVN] << bsd unless asd_found
|
842
|
+
end
|
843
|
+
|
844
|
+
end
|
845
|
+
|
846
|
+
@data[EXTRA_DATA][EXTRA_DATA_MVN_CACHE] = map_dependencies(DEPENDENCIES_MVN)
|
847
|
+
@data[EXTRA_DATA][EXTRA_DATA_CORE_LIBS] = get_core_libraries(type == TYPE_BLUFIN ? Blufin::Config::get_path('Paths', 'BlufinJava') : "#{@site_path}/#{APP_INFRASTRUCTURE}", type)
|
848
|
+
@data[EXTRA_DATA][EXTRA_DATA_CORE_LIBS_WITH_CHILDREN] = get_core_libraries_with_children(type)
|
849
|
+
|
850
|
+
# ADD ERROR FOR UNUSED PARENTS.
|
851
|
+
@data[EXTRA_DATA][EXTRA_DATA_CORE_LIBS_PARENTS].keys.each { |n| @error_handler.add_error(Blufin::YmlErrorHandler::MAVEN_MODULE_UNUSED_PARENT, config_file, CONFIG, CONFIG_PARENTS, n) unless @data[EXTRA_DATA][EXTRA_DATA_CORE_LIBS_WITH_CHILDREN].include?(n) }
|
852
|
+
|
853
|
+
# VALIDATE CORE
|
854
|
+
core_libraries = @data[EXTRA_DATA][EXTRA_DATA_CORE_LIBS]
|
855
|
+
core_modules = []
|
856
|
+
|
857
|
+
data_key = type == TYPE_BLUFIN ? BLUFIN : @site_name
|
858
|
+
|
859
|
+
@data[data_key].each do |key, data|
|
860
|
+
validate_dependencies_are_alphabetical_and_exist(data[DEPENDENCIES_BLUFIN], "#{key}.#{DEPENDENCIES_BLUFIN}", DEPENDENCIES_BLUFIN, data_key, type)
|
861
|
+
validate_dependencies_are_alphabetical_and_exist(data[DEPENDENCIES_MVN], "#{key}.#{DEPENDENCIES_MVN}", DEPENDENCIES_MVN, data_key, type)
|
862
|
+
@error_handler.add_error(Blufin::YmlErrorHandler::MAVEN_MODULE_UNRECOGNIZED, config_file, data_key, key, key) unless core_libraries.include?(key)
|
863
|
+
core_modules << key
|
864
|
+
end
|
865
|
+
core_libraries.each do |core_library|
|
866
|
+
@error_handler.add_error(Blufin::YmlErrorHandler::MAVEN_MODULE_NOT_DEFINED, config_file, data_key, nil, core_library) unless core_modules.include?(core_library)
|
867
|
+
end
|
868
|
+
|
869
|
+
@data
|
870
|
+
|
871
|
+
end
|
872
|
+
|
873
|
+
# Alter's the APP-STRUCTURE Hash for this particular site (IE: TaskBot).
|
874
|
+
# @return Array
|
875
|
+
def alter_structure_for_app(structure)
|
876
|
+
structure[0][:section_data] = {
|
877
|
+
CONFIG_JAVA => structure[0][:section_data][CONFIG_JAVA],
|
878
|
+
CONFIG_BLUFIN => structure[0][:section_data][CONFIG_BLUFIN],
|
879
|
+
@site_name => structure[0][:section_data][@site_name] = {
|
880
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_NESTED_DATA,
|
881
|
+
:required => true,
|
882
|
+
:section_data => {
|
883
|
+
CONFIG_BLUFIN_VERSION => {
|
884
|
+
:type => FIELD_TYPE_TEXT,
|
885
|
+
:required => true,
|
886
|
+
:regex => /\A[0-9]{1,4}\.[0-9]{1,4}\.[0-9]{1,4}(-SNAPSHOT)?\z/
|
887
|
+
}
|
888
|
+
}
|
889
|
+
},
|
890
|
+
CONFIG_PARENTS => {
|
891
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY,
|
892
|
+
:required => false,
|
893
|
+
:section_data => {
|
894
|
+
CONFIG_PARENTS_NAME => {
|
895
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT,
|
896
|
+
:regex => /\A(#{@site_name})-[a-z\-]+\z/
|
897
|
+
},
|
898
|
+
CONFIG_PARENTS_TITLE => {
|
899
|
+
:type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT,
|
900
|
+
:regex => /\A(#{@site_title})\s[A-Za-z0-9\-()\s]+\z/
|
901
|
+
|
902
|
+
},
|
903
|
+
}
|
904
|
+
}
|
905
|
+
}
|
906
|
+
app_idx = nil # The index of the key in APP_STRUCTURE for which to make changes.
|
907
|
+
structure.each_with_index { |n, idx| app_idx = idx if n[:section_name] == APP_INFRASTRUCTURE }
|
908
|
+
app_hash = {}
|
909
|
+
structure[app_idx][:section_data].keys.each do |key|
|
910
|
+
base_config = structure[app_idx][:section_data][key]
|
911
|
+
base_config[:section_data][BLUFIN_TITLE][:regex] = /\A(#{@site_title})\s[A-Za-z0-9\-()\s]+\z/
|
912
|
+
base_config[:section_data][BLUFIN_PARENT][:regex] = /\A(#{@site_name})-[a-z\-]+\z/
|
913
|
+
app_hash["#{@site_name}-#{key}"] = base_config
|
914
|
+
end
|
915
|
+
structure[app_idx][:section_name] = @site_name
|
916
|
+
structure[app_idx][:section_data] = app_hash
|
917
|
+
structure
|
918
|
+
end
|
919
|
+
|
920
|
+
# Returns and Array of formatted modules & checks there are no duplicates.
|
921
|
+
# @return Array
|
922
|
+
def get_mvn_modules_and_check_for_duplicates(dependencies, config_file, dependencies_for_error)
|
923
|
+
mvn_modules = []
|
924
|
+
dependencies.each do |mvn_module|
|
925
|
+
group = ''
|
926
|
+
artifact = ''
|
927
|
+
mvn_module.each do |mmi|
|
928
|
+
group = mmi.values[0] if mmi.keys[0] == DEPENDENCIES_GROUP_ID
|
929
|
+
artifact = mmi.values[0] if mmi.keys[0] == DEPENDENCIES_ARTIFACT_ID
|
930
|
+
end
|
931
|
+
raise RuntimeError, 'group should never be nil!' if group.nil?
|
932
|
+
raise RuntimeError, 'artifact should never be nil!' if artifact.nil?
|
933
|
+
group_artifact = "#{group}:#{artifact}"
|
934
|
+
if mvn_modules.include?(group_artifact)
|
935
|
+
@error_handler.add_error(Blufin::YmlErrorHandler::MAVEN_MODULE_DUPLICATE, config_file, data_key, dependencies_for_error, group_artifact)
|
936
|
+
next
|
937
|
+
end
|
938
|
+
mvn_modules << group_artifact
|
939
|
+
end
|
940
|
+
mvn_modules
|
941
|
+
end
|
942
|
+
|
943
|
+
# Validate order of dependencies.
|
944
|
+
# @return void
|
945
|
+
def validate_dependencies_are_alphabetical_and_exist(data, field, section_type, section, type)
|
946
|
+
if data.is_a?(Array) && data.length > 0
|
947
|
+
config_file = type == TYPE_BLUFIN ? @config_file_blufin : @config_file_app
|
948
|
+
modules = []
|
949
|
+
data.each do |data_inner|
|
950
|
+
data_inner.each do |di|
|
951
|
+
if di.keys[0] == DEPENDENCIES_USE
|
952
|
+
val = di.values[0]
|
953
|
+
case section_type
|
954
|
+
when DEPENDENCIES_BLUFIN
|
955
|
+
if type == TYPE_BLUFIN
|
956
|
+
@error_handler.add_error(Blufin::YmlErrorHandler::MAVEN_MODULE_NOT_REGISTERED, config_file, section, field, val) unless @data[EXTRA_DATA][EXTRA_DATA_CORE_LIBS].include?(val)
|
957
|
+
else
|
958
|
+
|
959
|
+
# TODO - MUST VALIDATE AGAINST CORE-LIBS WHEN LOOPING APP MAVEN.YML
|
960
|
+
|
961
|
+
end
|
962
|
+
when DEPENDENCIES_MVN
|
963
|
+
@error_handler.add_error(Blufin::YmlErrorHandler::MAVEN_MODULE_NOT_REGISTERED, config_file, section, field, val) unless @data[EXTRA_DATA][EXTRA_DATA_MVN_CACHE].keys.include?(val)
|
964
|
+
else
|
965
|
+
raise RuntimeError, "Unrecognized section-type: #{field}"
|
966
|
+
end
|
967
|
+
modules << val
|
968
|
+
end
|
969
|
+
end
|
970
|
+
end
|
971
|
+
# CHECK FOR DUPLICATES (Must come BEFORE A-Z check).
|
972
|
+
modules_dup = modules.select { |n| modules.count(n) > 1 }
|
973
|
+
modules_dup.uniq!
|
974
|
+
# TODO - This is commented out because blufin-api needs blufin-core as a regular dependency and a '<type>test-jar</type>' (for the Mocks). This flags it as a duplicate.
|
975
|
+
# if modules_dup.length > 0
|
976
|
+
# modules_dup.each do |duplicate|
|
977
|
+
# @error_handler.add_error(Blufin::YmlErrorHandler::MAVEN_MODULE_DUPLICATE, config_file, section, field, duplicate)
|
978
|
+
# end
|
979
|
+
# end
|
980
|
+
# CHECK IF IN ALPHABETICAL ORDER
|
981
|
+
modules.uniq!
|
982
|
+
modules_sorted = modules.sort
|
983
|
+
modules.each_with_index do |mvn_module, idx|
|
984
|
+
if modules_sorted[idx] != mvn_module
|
985
|
+
@error_handler.add_error(Blufin::YmlErrorHandler::MAVEN_MODULE_ORDER, config_file, section, field, mvn_module)
|
986
|
+
return
|
987
|
+
end
|
988
|
+
end
|
989
|
+
end
|
990
|
+
end
|
991
|
+
|
992
|
+
# Throw error if not in alphabetical order.
|
993
|
+
# @return void
|
994
|
+
def check_modules_are_alphabetical_and_not_duplicated(modules, section, field, type)
|
995
|
+
modules = modules.dup
|
996
|
+
config_file = type == TYPE_BLUFIN ? @config_file_blufin : @config_file_app
|
997
|
+
# CHECK FOR DUPLICATES (Must come BEFORE A-Z check).
|
998
|
+
modules_dup = modules.select { |n| modules.count(n) > 1 }
|
999
|
+
modules_dup.uniq!
|
1000
|
+
if modules_dup.length > 0
|
1001
|
+
modules_dup.each do |duplicate|
|
1002
|
+
@error_handler.add_error(Blufin::YmlErrorHandler::MAVEN_MODULE_DUPLICATE, config_file, section, field, duplicate)
|
1003
|
+
end
|
1004
|
+
end
|
1005
|
+
# CHECK IF IN ALPHABETICAL ORDER
|
1006
|
+
modules.uniq!
|
1007
|
+
modules_sorted = modules.sort
|
1008
|
+
modules.each_with_index do |mvn_module, idx|
|
1009
|
+
if modules_sorted[idx] != mvn_module
|
1010
|
+
@error_handler.add_error(Blufin::YmlErrorHandler::MAVEN_MODULE_ORDER, config_file, section, field, mvn_module)
|
1011
|
+
return
|
1012
|
+
end
|
1013
|
+
end
|
1014
|
+
end
|
1015
|
+
|
1016
|
+
# Gets an Array of core libs.
|
1017
|
+
# @return Array
|
1018
|
+
def get_core_libraries(site_path, type)
|
1019
|
+
if @core_libraries.nil?
|
1020
|
+
core_libraries = []
|
1021
|
+
core_libraries_with_children = get_core_libraries_with_children(type)
|
1022
|
+
Blufin::Files::get_dirs_in_dir(site_path).each do |path|
|
1023
|
+
path = get_path_fragment(path)
|
1024
|
+
if core_libraries_with_children.include?(path)
|
1025
|
+
Blufin::Files::get_dirs_in_dir("#{site_path}/#{path}").each do |path|
|
1026
|
+
path = get_path_fragment(path)
|
1027
|
+
core_libraries << path unless path == 'target'
|
1028
|
+
end
|
1029
|
+
else
|
1030
|
+
core_libraries << path unless path == 'target'
|
1031
|
+
end
|
1032
|
+
end
|
1033
|
+
@core_libraries = core_libraries
|
1034
|
+
end
|
1035
|
+
@core_libraries
|
1036
|
+
end
|
1037
|
+
|
1038
|
+
# Gets an Array of all libraries which have children.
|
1039
|
+
# @return Array
|
1040
|
+
def get_core_libraries_with_children(type)
|
1041
|
+
if @core_libraries_with_children.nil?
|
1042
|
+
parent_keys = @data[EXTRA_DATA][EXTRA_DATA_CORE_LIBS_PARENTS].keys
|
1043
|
+
non_existent_parents = []
|
1044
|
+
core_libraries_with_children = []
|
1045
|
+
@data[type == TYPE_BLUFIN ? BLUFIN : @site_name].each do |key, data|
|
1046
|
+
if data.has_key?(BLUFIN_PARENT)
|
1047
|
+
parent = data[BLUFIN_PARENT]
|
1048
|
+
core_libraries_with_children << parent
|
1049
|
+
non_existent_parents << [parent, key] unless parent_keys.include?(parent)
|
1050
|
+
end
|
1051
|
+
end
|
1052
|
+
config_file = type == TYPE_BLUFIN ? @config_file_blufin : @config_file_app
|
1053
|
+
if non_existent_parents.any?
|
1054
|
+
non_existent_parents.each do |nep|
|
1055
|
+
@error_handler.add_error(Blufin::YmlErrorHandler::MAVEN_MODULE_UNDEFINED_PARENT, config_file, nep[1], BLUFIN_PARENT, nep[0]) unless parent_keys.include?(nep[0])
|
1056
|
+
end
|
1057
|
+
end
|
1058
|
+
core_libraries_with_children.sort!
|
1059
|
+
core_libraries_with_children.uniq!
|
1060
|
+
@core_libraries_with_children = core_libraries_with_children
|
1061
|
+
end
|
1062
|
+
@core_libraries_with_children
|
1063
|
+
end
|
1064
|
+
|
1065
|
+
# Returns an Array of colon (:) separated dependencies from all the internal dependencies.
|
1066
|
+
# @return Array
|
1067
|
+
def get_core_libraries_as_pair
|
1068
|
+
pairs = []
|
1069
|
+
@data[BLUFIN].each do |key, data|
|
1070
|
+
if data.has_key?(BLUFIN_PARENT)
|
1071
|
+
pairs << "org.blufin.#{get_core_lib_suffix(key).gsub('-', '.')}:#{key}"
|
1072
|
+
else
|
1073
|
+
pairs << "org.blufin:#{key}"
|
1074
|
+
end
|
1075
|
+
end
|
1076
|
+
pairs
|
1077
|
+
end
|
1078
|
+
|
1079
|
+
# Turns path/to/blufin-core -> blufin-core
|
1080
|
+
# @return String
|
1081
|
+
def get_path_fragment(path)
|
1082
|
+
path = path.split('/')
|
1083
|
+
path[path.length - 1]
|
1084
|
+
end
|
1085
|
+
|
1086
|
+
# Caches MVN dependencies.
|
1087
|
+
# @return Hash
|
1088
|
+
def map_dependencies(data_map_key)
|
1089
|
+
cache = {}
|
1090
|
+
dep_data = @data[data_map_key]
|
1091
|
+
if dep_data.is_a?(Array) || dep_data.length > 0
|
1092
|
+
dep_data.each do |dep|
|
1093
|
+
dep_hash = {}
|
1094
|
+
dep.each do |dep_inner|
|
1095
|
+
key = dep_inner.keys[0]
|
1096
|
+
val = dep_inner.values[0]
|
1097
|
+
case key
|
1098
|
+
when DEPENDENCIES_GROUP_ID
|
1099
|
+
dep_hash[:group] = val
|
1100
|
+
when DEPENDENCIES_ARTIFACT_ID
|
1101
|
+
dep_hash[:artifact] = val
|
1102
|
+
when DEPENDENCIES_VERSION
|
1103
|
+
dep_hash[:version] = val
|
1104
|
+
when DEPENDENCIES_EXCLUDE
|
1105
|
+
dep_hash[:exclude] = val
|
1106
|
+
else
|
1107
|
+
raise RuntimeError, "Unrecognized key: #{key}"
|
1108
|
+
end
|
1109
|
+
end
|
1110
|
+
raise RuntimeError, ":group must be defined: #{dep_hash.inspect}" if dep_hash[:group].nil?
|
1111
|
+
raise RuntimeError, ":artifact must be defined: #{dep_hash.inspect}" if dep_hash[:artifact].nil?
|
1112
|
+
raise RuntimeError, ":version must be defined: #{dep_hash.inspect}" if dep_hash[:version].nil?
|
1113
|
+
cache["#{dep_hash[:group]}:#{dep_hash[:artifact]}"] = dep_hash
|
1114
|
+
end
|
1115
|
+
end
|
1116
|
+
cache
|
1117
|
+
end
|
1118
|
+
|
1119
|
+
# Returns the group "suffix" (if any) for core libs -- or NIL.
|
1120
|
+
# @return Hash
|
1121
|
+
def get_core_lib_suffix(core_lib_name)
|
1122
|
+
@data[EXTRA_DATA][EXTRA_DATA_CORE_LIBS_WITH_CHILDREN].each do |core_lib_with_child|
|
1123
|
+
if core_lib_name =~ /\A#{core_lib_with_child}-/
|
1124
|
+
return core_lib_with_child.gsub(/\Ablufin-/, '')
|
1125
|
+
end
|
1126
|
+
end
|
1127
|
+
nil
|
1128
|
+
end
|
1129
|
+
|
1130
|
+
end
|
1131
|
+
|
1132
|
+
end
|