solara 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/solara/lib/.DS_Store +0 -0
  3. data/solara/lib/core/.DS_Store +0 -0
  4. data/solara/lib/core/brands/brand_onboarder.rb +29 -25
  5. data/solara/lib/core/brands/brand_switcher.rb +59 -24
  6. data/solara/lib/core/dashboard/brand/BrandDetailController.js +6 -3
  7. data/solara/lib/core/dashboard/brand/BrandDetailModel.js +1 -0
  8. data/solara/lib/core/dashboard/brand/SectionsFormManager.js +76 -15
  9. data/solara/lib/core/dashboard/brand/brand.html +47 -8
  10. data/solara/lib/core/dashboard/brand/source/BrandLocalSource.js +2 -2
  11. data/solara/lib/core/dashboard/brand/source/BrandRemoteSource.js +19 -3
  12. data/solara/lib/core/dashboard/component/OnboardBrandBottomSheet.js +4 -0
  13. data/solara/lib/core/dashboard/handler/edit_section_handler.rb +5 -17
  14. data/solara/lib/core/dashboard/handler/onboard_brand_handler.rb +0 -15
  15. data/solara/lib/core/doctor/schema/brand_configurations.json +2 -2
  16. data/solara/lib/core/doctor/schema/platform/json_manifest.json +20 -38
  17. data/solara/lib/core/doctor/validator/template/android_template_validation_config.yml +3 -3
  18. data/solara/lib/core/doctor/validator/template/flutter_template_validation_config.yml +2 -2
  19. data/solara/lib/core/doctor/validator/template/ios_template_validation_config.yml +3 -3
  20. data/solara/lib/core/scripts/brand_config_updater.rb +29 -0
  21. data/solara/lib/core/scripts/brand_configurations_manager.rb +76 -14
  22. data/solara/lib/core/scripts/brand_importer.rb +9 -20
  23. data/solara/lib/core/scripts/code_generator.rb +1 -1
  24. data/solara/lib/core/scripts/file_manager.rb +11 -15
  25. data/solara/lib/core/scripts/gitignore_manager.rb +3 -4
  26. data/solara/lib/core/scripts/json_manifest_processor.rb +86 -45
  27. data/solara/lib/core/scripts/resource_manifest_processor.rb +11 -10
  28. data/solara/lib/core/scripts/string_case.rb +18 -0
  29. data/solara/lib/core/template/.DS_Store +0 -0
  30. data/solara/lib/core/template/brands/json/Json-Manifest.md +8 -10
  31. data/solara/lib/core/template/brands/json/json_manifest.json +9 -11
  32. data/solara/lib/core/template/config/android_template_config.json +6 -6
  33. data/solara/lib/core/template/config/flutter_template_config.json +4 -4
  34. data/solara/lib/core/template/config/ios_template_config.json +6 -6
  35. data/solara/lib/core/template/configurations.json +34 -21
  36. data/solara/lib/core/template/project_template_generator.rb +119 -13
  37. data/solara/lib/solara/version.rb +1 -1
  38. data/solara/lib/solara_manager.rb +25 -13
  39. metadata +5 -2
@@ -25,7 +25,7 @@
25
25
  "items": {
26
26
  "type": "object",
27
27
  "properties": {
28
- "key": {
28
+ "filename": {
29
29
  "type": "string"
30
30
  },
31
31
  "name": {
@@ -37,7 +37,7 @@
37
37
  }
38
38
  },
39
39
  "required": [
40
- "key",
40
+ "filename",
41
41
  "name",
42
42
  "content"
43
43
  ]
@@ -10,48 +10,30 @@
10
10
  "type": "string"
11
11
  },
12
12
  "generate": {
13
- "type": "object",
14
- "properties": {
15
- "enabled": {
16
- "type": "boolean"
17
- },
18
- "className": {
19
- "type": "string"
20
- },
21
- "customClassNames": {
22
- "type": "array",
23
- "items": {
24
- "type": "object",
25
- "properties": {
26
- "generatedName": {
27
- "type": "string"
28
- },
29
- "customName": {
30
- "type": "string"
31
- }
32
- },
33
- "required": [
34
- "generatedName",
35
- "customName"
36
- ]
13
+ "type": "boolean"
14
+ },
15
+ "parentClassName": {
16
+ "type": "string"
17
+ },
18
+ "customClassNames": {
19
+ "type": "array",
20
+ "items": {
21
+ "type": "object",
22
+ "properties": {
23
+ "originalName": {
24
+ "type": "string"
25
+ },
26
+ "customName": {
27
+ "type": "string"
37
28
  }
38
- }
39
- },
40
- "required": [
41
- "enabled",
42
- "className",
43
- "customClassNames"
44
- ]
29
+ },
30
+ "required": ["originalName", "customName"]
31
+ }
45
32
  }
46
33
  },
47
- "required": [
48
- "fileName",
49
- "generate"
50
- ]
34
+ "required": ["fileName", "generate", "parentClassName", "customClassNames"]
51
35
  }
52
36
  }
53
37
  },
54
- "required": [
55
- "files"
56
- ]
38
+ "required": ["files"]
57
39
  }
@@ -28,7 +28,7 @@ structure:
28
28
  json:
29
29
  type: directory
30
30
  contents:
31
- json_manifest.json:
31
+ android_json_manifest.json:
32
32
  type: file
33
33
  validations:
34
34
  - type: valid_json
@@ -63,7 +63,7 @@ structure:
63
63
  json:
64
64
  type: directory
65
65
  contents:
66
- json_manifest.json:
66
+ ios_json_manifest.json:
67
67
  type: file
68
68
  validations:
69
69
  - type: valid_json
@@ -94,7 +94,7 @@ structure:
94
94
  json:
95
95
  type: directory
96
96
  contents:
97
- json_manifest.json:
97
+ global_json_manifest.json:
98
98
  type: file
99
99
  validations:
100
100
  - type: valid_json
@@ -5,7 +5,7 @@ structure:
5
5
  json:
6
6
  type: directory
7
7
  contents:
8
- json_manifest.json:
8
+ flutter_json_manifest.json:
9
9
  type: file
10
10
  validations:
11
11
  - type: valid_json
@@ -89,7 +89,7 @@ structure:
89
89
  json:
90
90
  type: directory
91
91
  contents:
92
- json_manifest.json:
92
+ global_json_manifest.json:
93
93
  type: file
94
94
  validations:
95
95
  - type: valid_json
@@ -28,7 +28,7 @@ structure:
28
28
  json:
29
29
  type: directory
30
30
  contents:
31
- json_manifest.json:
31
+ android_json_manifest.json:
32
32
  type: file
33
33
  validations:
34
34
  - type: valid_json
@@ -63,7 +63,7 @@ structure:
63
63
  json:
64
64
  type: directory
65
65
  contents:
66
- json_manifest.json:
66
+ ios_json_manifest.json:
67
67
  type: file
68
68
  validations:
69
69
  - type: valid_json
@@ -94,7 +94,7 @@ structure:
94
94
  json:
95
95
  type: directory
96
96
  contents:
97
- json_manifest.json:
97
+ global_json_manifest.json:
98
98
  type: file
99
99
  validations:
100
100
  - type: valid_json
@@ -0,0 +1,29 @@
1
+ class BrandConfigUpdater
2
+
3
+ def update(filename, data, brand_key)
4
+ template = BrandConfigurationsManager.new(brand_key).template_with_filename(filename)
5
+ if template.nil?
6
+ Solara.logger.debug("Can't find tempate for filename: #{filename}, with brand key: #{brand_key}")
7
+ return
8
+ end
9
+
10
+ path = template[:path]
11
+ json = JSON.pretty_generate(data)
12
+
13
+ begin
14
+ # Check if the file exists
15
+ if File.exist?(path)
16
+ # If it exists, update the file
17
+ File.write(path, json)
18
+ Solara.logger.debug("Updated Config for #{path}: #{data}")
19
+ else
20
+ # If it doesn't exist, create the file with the data
21
+ File.write(path, json)
22
+ Solara.logger.debug("Created Config for #{path}: #{data}")
23
+ end
24
+ rescue StandardError => e
25
+ Solara.logger.failure("Error updating #{brand_key} config file #{path}: #{e.message}")
26
+ raise
27
+ end
28
+ end
29
+ end
@@ -4,19 +4,12 @@ class BrandConfigurationsManager
4
4
  @brand_key = brand_key
5
5
  end
6
6
 
7
- def template_with_key(key)
8
- templates.select { |section| section[:key] === key }.first
7
+ def template_with_filename(filename)
8
+ templates.select { |template| template[:filename] === filename }.first
9
9
  end
10
10
 
11
11
  def templates
12
- configurations = JSON.parse(File.read(FilePath.brand_configurations))['configurations']
13
- configurations.map do |config|
14
- {
15
- key: config['key'],
16
- name: config['name'],
17
- path: "#{FilePath.brand(@brand_key)}/#{config['filePath']}"
18
- }
19
- end
12
+ TemplateManager.new(@brand_key).templates
20
13
  end
21
14
 
22
15
  def create
@@ -24,18 +17,87 @@ class BrandConfigurationsManager
24
17
 
25
18
  config_templates.map do |template|
26
19
  create_config_item(
27
- template[:key],
20
+ template[:filename],
28
21
  template[:name],
29
22
  template[:path]
30
23
  )
31
24
  end
32
25
  end
33
26
 
34
- def create_config_item(key, name, path)
27
+ def create_config_item(filename, name, path)
35
28
  {
36
- key: key,
29
+ filename: filename,
37
30
  name: name,
38
31
  content: JSON.parse(File.read(path)),
39
32
  }
40
33
  end
41
- end
34
+ end
35
+
36
+ class TemplateManager
37
+
38
+ def initialize(brand_key)
39
+ @brand_key = brand_key
40
+ end
41
+
42
+ def templates
43
+ result = parse_configurations
44
+ collect_json_templates.each do |template|
45
+ result << template unless result.any? { |r| r['filename'] == template['filename'] }
46
+ end
47
+ result.compact
48
+ rescue StandardError => e
49
+ Solara.logger.error("Failed to generate templates: #{e.message}")
50
+ []
51
+ end
52
+
53
+ private
54
+
55
+ def parse_configurations
56
+ configurations = JSON.parse(File.read(FilePath.brand_configurations))['configurations']
57
+ configurations.map do |config|
58
+ path = build_path(config['filePath'])
59
+ next unless File.exist?(path)
60
+
61
+ filename_without_extension = File.basename(config['filename'], '.json')
62
+
63
+ {
64
+ filename: File.basename(config['filename']),
65
+ name: StringCase.snake_to_capitalized_spaced(filename_without_extension, exclude: "ios"),
66
+ path: path
67
+ }
68
+ end
69
+ rescue StandardError => e
70
+ Solara.logger.error("Failed to parse configurations: #{e.message}")
71
+ []
72
+ end
73
+
74
+ def collect_json_templates
75
+ directories = [
76
+ FilePath.brand_global_json_dir,
77
+ FilePath.brand_json_dir(@brand_key)
78
+ ]
79
+
80
+ directories.flat_map do |dir|
81
+ get_json_files(dir).map do |file|
82
+ filename_without_extension = File.basename(file, '.json')
83
+
84
+ {
85
+ filename: File.basename(file),
86
+ name: StringCase.snake_to_capitalized_spaced(filename_without_extension, exclude: "ios"),
87
+ path: file
88
+ }
89
+ end
90
+ end
91
+ end
92
+
93
+ def get_json_files(dir)
94
+ Dir.glob(File.join(dir, '**', '*.json'))
95
+ rescue StandardError => e
96
+ Solara.logger.error("Error reading directory #{dir}: #{e.message}")
97
+ []
98
+ end
99
+
100
+ def build_path(file_path)
101
+ "#{FilePath.brand(@brand_key)}/#{file_path}"
102
+ end
103
+ end
@@ -26,8 +26,8 @@ class BrandImporter
26
26
  validate_json(configurations_path)
27
27
  validate_json_schema(configurations_path)
28
28
 
29
- configurations_json = JSON.parse(File.read(configurations_path))
30
- brand = configurations_json['brand']
29
+ configurations = JSON.parse(File.read(configurations_path))
30
+ brand = configurations['brand']
31
31
  brand_key = brand['key'] # Ensure to use 'key' instead of 'brand_key'
32
32
 
33
33
  exists = BrandsManager.instance.exists(brand_key)
@@ -35,32 +35,21 @@ class BrandImporter
35
35
  SolaraManager.new.onboard(brand_key, brand['name'], open_dashboard: false)
36
36
  end
37
37
 
38
- update_brand(brand_key, configurations_json)
38
+ SolaraManager.new.sync_brand_with_template(brand_key) if exists
39
+ update_brand(brand_key, configurations)
39
40
 
40
41
  message_suffix = exists ? "The existing brand '#{brand_key}' has been updated." : "A new brand with the key '#{brand_key}' has been onboarded."
41
42
  Solara.logger.success("Successfully imported (#{configurations_path}). #{message_suffix}")
42
43
  end
43
44
 
44
- def update_brand(brand_key, configurations_json)
45
- brand_path = FilePath.brand(brand_key)
46
-
47
- configurations_json['configurations'].each do |configuration|
48
- file_name = configuration['key']
49
- file_path = find_file_in_subdirectories(brand_path, file_name)
50
-
51
- # Create or replace the contents of the configuration file
52
- if file_path
53
- File.write(file_path, JSON.pretty_generate(configuration['content']))
54
- else
55
- Solara.logger.failure("File #{file_name} not found in #{brand_path}, ignoring importing it!")
56
- end
45
+ def update_brand(brand_key, configurations)
46
+ configurations['configurations'].each do |configuration|
47
+ filename = configuration['filename']
48
+ data = configuration['content']
49
+ BrandConfigUpdater.new.update(filename, data, brand_key)
57
50
  end
58
51
  end
59
52
 
60
- def find_file_in_subdirectories(base_path, file_name)
61
- Dir.glob(File.join(base_path, '**', file_name)).first
62
- end
63
-
64
53
  def validate_json(configurations_path)
65
54
  begin
66
55
  JsonFileValidator.new([configurations_path]).validate
@@ -212,7 +212,7 @@ class BaseCodeGenerator
212
212
  end
213
213
 
214
214
  def capitalize(string)
215
- "#{string[0].upcase}#{string[1..-1]}"
215
+ StringCase.capitalize(string)
216
216
  end
217
217
  end
218
218
 
@@ -5,23 +5,19 @@ class FileManager
5
5
  source_path = Pathname.new(source_dir).expand_path
6
6
  destination_path = Pathname.new(destination_dir).expand_path
7
7
 
8
- if Dir.exist?(source_path)
9
- Dir.glob(source_path.join('*')).each do |item|
10
- relative_path = Pathname.new(item).relative_path_from(source_path).to_s
11
- destination_item_path = destination_path.join(relative_path)
12
-
13
- if File.directory?(item)
14
- FileUtils.mkdir_p(destination_item_path)
15
- FileUtils.cp_r(item + '/.', destination_item_path) # Ensure to copy contents
16
- else
17
- FileUtils.mkdir_p(destination_item_path.dirname) # Create parent directory
18
- FileUtils.cp(item, destination_item_path)
19
- end
8
+ Dir.glob(source_path.join('*')).each do |item|
9
+ relative_path = Pathname.new(item).relative_path_from(source_path).to_s
10
+ destination_item_path = destination_path.join(relative_path)
20
11
 
21
- Solara.logger.debug("🚗 Copied #{relative_path} \n\t↑ From: #{source_path} \n\t↓ To: #{destination_path}")
22
- end
12
+ if File.directory?(item)
13
+ FileUtils.mkdir_p(destination_item_path)
14
+ FileUtils.cp_r(item + '/.', destination_item_path) # Ensure to copy contents
23
15
  else
24
- Solara.logger.failure("#{source_path} not found!")
16
+ FileUtils.mkdir_p(destination_item_path.dirname) # Create parent directory
17
+ FileUtils.cp(item, destination_item_path)
18
+ end
19
+
20
+ Solara.logger.debug("🚗 Copied #{relative_path} \n\t↑ From: #{source_path} \n\t↓ To: #{destination_path}")
25
21
  end
26
22
  end
27
23
 
@@ -18,9 +18,7 @@ class GitignoreManager
18
18
  ]
19
19
 
20
20
  if Platform.is_flutter || Platform.is_ios
21
- items << FileManager.get_relative_path_to_root(FilePath.project_infoplist_string_catalog)
22
- # The excluded InfoPlist.xcstrings maybe at the root. In this case we have to avoid ignoring the brands files.
23
- items << '!solara/brand/brands/**/InfoPlist.xcstrings'
21
+ items << "/#{FileManager.get_relative_path_to_root(FilePath.project_infoplist_string_catalog)}"
24
22
  end
25
23
 
26
24
  GitignoreManager.new(FilePath.project_root).add_items(items)
@@ -29,11 +27,12 @@ class GitignoreManager
29
27
 
30
28
  def add_items(items)
31
29
  items.each do |item|
32
- add_item(FileManager.get_relative_path_to_root(item))
30
+ add_item(item.start_with?('/') ? item : FileManager.get_relative_path_to_root(item))
33
31
  end
34
32
  end
35
33
 
36
34
  def add_item(item)
35
+ puts item
37
36
  existing_items = read_gitignore
38
37
 
39
38
  if existing_items.include?(item)
@@ -1,53 +1,116 @@
1
1
  require 'json'
2
2
 
3
3
  class JsonManifestProcessor
4
-
5
4
  def initialize(json_path, language, output_path)
6
5
  @json_path = json_path
7
6
  @language = language
8
7
  @output_path = output_path
8
+ @manifest = read_manifest
9
9
  end
10
10
 
11
11
  def process
12
- manifest = read_json
13
- process_files(manifest)
12
+ # First process files specified in manifest
13
+ process_manifest_files if @manifest && @manifest['files']
14
+
15
+ # Then process remaining JSON files
16
+ process_remaining_files
14
17
  end
15
18
 
16
19
  private
17
20
 
18
- def process_files(manifest)
19
- manifest['files'].each do |file|
20
- generate_code(file)
21
+ def read_manifest
22
+ manifest_path = File.join(@json_path, "#{SolaraSettingsManager.instance.platform}_json_manifest.json")
23
+ JSON.parse(File.read(manifest_path))
24
+ rescue JSON::ParserError => e
25
+ Solara.logger.debug("Error parsing manifest JSON: #{e.message}")
26
+ nil
27
+ rescue Errno::ENOENT => e
28
+ Solara.logger.debug("Manifest file not found: #{e.message}")
29
+ nil
30
+ rescue StandardError => e
31
+ Solara.logger.debug("Unexpected error reading manifest: #{e.message}")
32
+ nil
33
+ end
34
+
35
+ def process_manifest_files
36
+ @manifest['files'].each do |file|
37
+ process_manifest_file(file)
21
38
  end
22
39
  end
23
40
 
24
- def generate_code(file)
25
- return unless file['generate']['enabled']
41
+ def process_manifest_file(file)
42
+ return unless file['generate']
43
+
44
+ file_name = file['fileName']
45
+ class_name = file['parentClassName']
46
+
47
+ return if file_name.empty? || class_name.empty?
48
+
49
+ custom_class_names = convert_to_map(file['customClassNames'])
50
+ process_json_file(
51
+ File.join(@json_path, file_name),
52
+ class_name,
53
+ custom_class_names,
54
+ true
55
+ )
56
+ end
57
+
58
+ def process_remaining_files
59
+ manifest_files = @manifest&.dig('files')&.map { |f| f['fileName'] } || []
26
60
 
27
- file_name = file['fileName']
28
- class_name = file['generate']['className']
61
+ json_files = get_json_files
62
+ json_files.each do |file_path|
63
+ file_name = File.basename(file_path)
64
+ # Skip files that were already processed via manifest
65
+ next if manifest_files.include?(file_name)
66
+ next if file_name == 'json_manifest.json'
29
67
 
30
- puts "generate_code: file_name = #{file_name}, class_name = #{class_name}"
31
- return if file_name.empty? || class_name.empty?
32
- puts "generate_code: file_name = #{file_name}, class_name = #{class_name}"
68
+ class_name = derive_class_name(file_name)
69
+ process_json_file(file_path, class_name, {}, false)
70
+ end
71
+ end
33
72
 
34
- custom_class_names = convert_to_map(file['generate']['customClassNames'])
73
+ def get_json_files
74
+ Dir.glob(File.join(@json_path, '**', '*.json'))
75
+ rescue StandardError => e
76
+ Solara.logger.debug("Error reading directory #{@json_path}: #{e.message}")
77
+ []
78
+ end
35
79
 
36
- file_path = File.join(@json_path, file_name)
80
+ def process_json_file(file_path, class_name, custom_types, is_manifest_file)
81
+ begin
82
+ json_content = JSON.parse(File.read(file_path))
37
83
  code_generator = CodeGenerator.new(
38
- json: JSON.parse(File.read(file_path)),
39
- language: @language ,
84
+ json: json_content,
85
+ language: @language,
40
86
  parent_class_name: class_name,
41
- custom_types: custom_class_names
87
+ custom_types: custom_types
42
88
  )
43
89
 
44
90
  generated_code = code_generator.generate
45
-
46
- output_path = File.join(@output_path, gnerated_filename(class_name))
91
+ output_path = File.join(@output_path, generated_filename(class_name))
47
92
  write_to_file(output_path, generated_code)
93
+ rescue JSON::ParserError => e
94
+ Solara.logger.debug("Error parsing JSON file #{File.basename(file_path)}: #{e.message}")
95
+ rescue StandardError => e
96
+ Solara.logger.debug("Error processing file #{File.basename(file_path)}: #{e.message}")
97
+ end
48
98
  end
49
99
 
50
- def gnerated_filename(class_name)
100
+ def derive_class_name(file_name)
101
+ # Remove .json extension and convert to PascalCase
102
+ base_name = File.basename(file_name, '.json')
103
+ base_name.split('_').map(&:capitalize).join
104
+ end
105
+
106
+ def convert_to_map(custom_class_names)
107
+ return {} unless custom_class_names
108
+ custom_class_names.each_with_object({}) do |item, result|
109
+ result[item['originalName']] = item['customName']
110
+ end
111
+ end
112
+
113
+ def generated_filename(class_name)
51
114
  case SolaraSettingsManager.instance.platform
52
115
  when Platform::Flutter
53
116
  "#{to_snake_case(class_name)}.dart"
@@ -65,31 +128,9 @@ class JsonManifestProcessor
65
128
  end
66
129
 
67
130
  def write_to_file(output, content)
68
- puts "generate_code: output = #{output}, content = #{content}"
69
131
  File.write(output, content)
70
- Solara.logger.debug("Genrated #{output}")
71
- rescue StandardError => e
72
- Solara.logger.debug("Error writing to file #{file_name}: #{e.message}")
73
- end
74
-
75
- def convert_to_map(custom_class_names)
76
- custom_class_names.each_with_object({}) do |item, result|
77
- result[item['generatedName']] = item['customName']
78
- end
79
- end
80
-
81
- def read_json
82
- mainfest_path = File.join(@json_path, 'json_manifest.json')
83
- JSON.parse(File.read(mainfest_path))
84
- rescue JSON::ParserError => e
85
- Solara.logger.debug("Error parsing JSON: #{e.message}")
86
- {}
87
- rescue Errno::ENOENT => e
88
- Solara.logger.debug("Error reading file: #{e.message}")
89
- {}
132
+ Solara.logger.debug("Generated #{output}")
90
133
  rescue StandardError => e
91
- Solara.logger.debug("Unexpected error: #{e.message}")
92
- {}
134
+ Solara.logger.debug("Error writing to file #{output}: #{e.message}")
93
135
  end
94
-
95
136
  end
@@ -2,8 +2,9 @@ require 'json'
2
2
  require 'fileutils'
3
3
 
4
4
  class ResourceManifestProcessor
5
- def initialize(brand_key)
5
+ def initialize(brand_key, ignore_health_check:)
6
6
  @brand_key = brand_key
7
+ @ignore_health_check = ignore_health_check
7
8
  @manifest_file = FilePath.resources_manifest
8
9
  @config = load_manifest_file
9
10
  end
@@ -33,7 +34,7 @@ class ResourceManifestProcessor
33
34
 
34
35
  return skip_empty_paths(item) if empty_paths?(item)
35
36
 
36
- check_mandatory_file(item, src, dst)
37
+ check_mandatory_file(item, src)
37
38
 
38
39
  if File.exist?(src)
39
40
  copy_file(src, dst)
@@ -88,7 +89,8 @@ class ResourceManifestProcessor
88
89
 
89
90
  def git_ignore(files)
90
91
  files.each do |file|
91
- GitignoreManager.new(FilePath.project_root).add_items([file])
92
+ path = FileManager.get_relative_path_to_root(file)
93
+ GitignoreManager.new(FilePath.project_root).add_items(["/#{path}"])
92
94
  end
93
95
  end
94
96
 
@@ -104,10 +106,11 @@ class ResourceManifestProcessor
104
106
  Solara.logger.debug("Skipped (empty source or destination) for #{@brand_key}: #{item['source']} -> #{item['destination']}")
105
107
  end
106
108
 
107
- def check_mandatory_file(item, src, dst)
109
+ def check_mandatory_file(item, src)
110
+ return if @ignore_health_check
111
+
108
112
  if item['mandatory'] && !File.exist?(src)
109
- Solara.logger.fatal("Mandatory resource file/folder not found for #{@brand_key}: #{src}. Please add the resource or mark it as not mandatory in #{FilePath.resources_manifest}.")
110
- exit 1
113
+ raise "Mandatory resource file/folder not found for #{@brand_key}: #{src}. Please add the resource or mark it as not mandatory in #{FilePath.resources_manifest}."
111
114
  end
112
115
 
113
116
  end
@@ -134,8 +137,7 @@ class ResourceManifestProcessor
134
137
 
135
138
  def validate_manifest_file_existence
136
139
  unless File.exist?(@manifest_file)
137
- Solara.logger.fatal("Brand switch copy manifest not found for #{@brand_key}: #{@manifest_file}")
138
- exit 1
140
+ raise "Resources manifest not found for #{@brand_key}: #{@manifest_file}"
139
141
  end
140
142
  end
141
143
 
@@ -143,8 +145,7 @@ class ResourceManifestProcessor
143
145
  begin
144
146
  JSON.parse(File.read(@manifest_file))
145
147
  rescue JSON::ParserError => e
146
- Solara.logger.fatal("Invalid brand switch copy manifest for #{@brand_key}: #{e.message}")
147
- exit 1
148
+ raise "Invalid resources manifest for #{@brand_key}: #{e.message}"
148
149
  end
149
150
  end
150
151