solara 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. checksums.yaml +7 -0
  2. data/bin/solara +18 -0
  3. data/solara/lib/.DS_Store +0 -0
  4. data/solara/lib/core/.DS_Store +0 -0
  5. data/solara/lib/core/aliases/alias_generator.rb +128 -0
  6. data/solara/lib/core/aliases/alias_generator_manager.rb +28 -0
  7. data/solara/lib/core/aliases/solara_terminal_setup.rb +103 -0
  8. data/solara/lib/core/brands/brand_onboarder.rb +46 -0
  9. data/solara/lib/core/brands/brand_switcher.rb +204 -0
  10. data/solara/lib/core/brands/brands_manager.rb +154 -0
  11. data/solara/lib/core/dashboard/.DS_Store +0 -0
  12. data/solara/lib/core/dashboard/brand/.DS_Store +0 -0
  13. data/solara/lib/core/dashboard/brand/BrandDetail.js +11 -0
  14. data/solara/lib/core/dashboard/brand/BrandDetailController.js +361 -0
  15. data/solara/lib/core/dashboard/brand/BrandDetailModel.js +155 -0
  16. data/solara/lib/core/dashboard/brand/BrandDetailView.js +245 -0
  17. data/solara/lib/core/dashboard/brand/brand.html +477 -0
  18. data/solara/lib/core/dashboard/brand/source/BrandLocalSource.js +123 -0
  19. data/solara/lib/core/dashboard/brand/source/BrandRemoteSource.js +260 -0
  20. data/solara/lib/core/dashboard/brands/Brands.js +10 -0
  21. data/solara/lib/core/dashboard/brands/BrandsController.js +155 -0
  22. data/solara/lib/core/dashboard/brands/BrandsModel.js +136 -0
  23. data/solara/lib/core/dashboard/brands/BrandsView.js +136 -0
  24. data/solara/lib/core/dashboard/brands/brands.html +345 -0
  25. data/solara/lib/core/dashboard/component/AddFieldSheet.js +212 -0
  26. data/solara/lib/core/dashboard/component/AliasesBottomSheet.js +128 -0
  27. data/solara/lib/core/dashboard/component/BrandOptionsBottomSheet.js +130 -0
  28. data/solara/lib/core/dashboard/component/ConfirmationDialog.js +103 -0
  29. data/solara/lib/core/dashboard/component/MessageBottomSheet.js +80 -0
  30. data/solara/lib/core/dashboard/component/OnboardBrandBottomSheet.js +214 -0
  31. data/solara/lib/core/dashboard/dashboard_manager.rb +19 -0
  32. data/solara/lib/core/dashboard/dashboard_server.rb +132 -0
  33. data/solara/lib/core/dashboard/handler/base_handler.rb +25 -0
  34. data/solara/lib/core/dashboard/handler/brand_alisases_handler.rb +33 -0
  35. data/solara/lib/core/dashboard/handler/brand_configurations_handler.rb +18 -0
  36. data/solara/lib/core/dashboard/handler/brand_configurations_manager.rb +73 -0
  37. data/solara/lib/core/dashboard/handler/brand_icon_handler.rb +20 -0
  38. data/solara/lib/core/dashboard/handler/brand_section_handler.rb +20 -0
  39. data/solara/lib/core/dashboard/handler/brands_handler.rb +14 -0
  40. data/solara/lib/core/dashboard/handler/current_brand_handler.rb +18 -0
  41. data/solara/lib/core/dashboard/handler/doctor_handler.rb +39 -0
  42. data/solara/lib/core/dashboard/handler/edit_section_handler.rb +55 -0
  43. data/solara/lib/core/dashboard/handler/offboard_brand_handler.rb +34 -0
  44. data/solara/lib/core/dashboard/handler/onboard_brand_handler.rb +53 -0
  45. data/solara/lib/core/dashboard/handler/redirect_handler.rb +12 -0
  46. data/solara/lib/core/dashboard/handler/switch_handler.rb +25 -0
  47. data/solara/lib/core/dashboard/index.html +36 -0
  48. data/solara/lib/core/dashboard/local.html +41 -0
  49. data/solara/lib/core/dashboard/res/favicon/android-chrome-192x192.png +0 -0
  50. data/solara/lib/core/dashboard/res/favicon/android-chrome-512x512.png +0 -0
  51. data/solara/lib/core/dashboard/res/favicon/apple-touch-icon.png +0 -0
  52. data/solara/lib/core/dashboard/res/favicon/favicon-16x16.png +0 -0
  53. data/solara/lib/core/dashboard/res/favicon/favicon-32x32.png +0 -0
  54. data/solara/lib/core/dashboard/res/favicon/favicon.ico +0 -0
  55. data/solara/lib/core/dashboard/res/favicon/site.webmanifest +1 -0
  56. data/solara/lib/core/dashboard/solara.png +0 -0
  57. data/solara/lib/core/doctor/brand_doctor.rb +94 -0
  58. data/solara/lib/core/doctor/doctor_manager.rb +35 -0
  59. data/solara/lib/core/doctor/project_doctor.rb +8 -0
  60. data/solara/lib/core/doctor/schema/brand_configurations.json +60 -0
  61. data/solara/lib/core/doctor/schema/platform/android/android_config.json +23 -0
  62. data/solara/lib/core/doctor/schema/platform/android/android_signing.json +23 -0
  63. data/solara/lib/core/doctor/schema/platform/ios/ios_config.json +27 -0
  64. data/solara/lib/core/doctor/schema/platform/ios/ios_signing.json +27 -0
  65. data/solara/lib/core/doctor/schema/platform/shared/theme.json +48 -0
  66. data/solara/lib/core/doctor/validator/brand_settings_validator.rb +55 -0
  67. data/solara/lib/core/doctor/validator/brand_settings_validator_manager.rb +82 -0
  68. data/solara/lib/core/doctor/validator/directory_structure_validator.rb +38 -0
  69. data/solara/lib/core/doctor/validator/file_structure_validator.rb +37 -0
  70. data/solara/lib/core/doctor/validator/json_file_validator.rb +21 -0
  71. data/solara/lib/core/doctor/validator/json_schema_validator.rb +32 -0
  72. data/solara/lib/core/doctor/validator/project_filesystem_validator.rb +70 -0
  73. data/solara/lib/core/doctor/validator/template/android_template_validation_config.yml +51 -0
  74. data/solara/lib/core/doctor/validator/template/flutter_template_validation_config.yml +53 -0
  75. data/solara/lib/core/doctor/validator/template/ios_template_validation_config.yml +51 -0
  76. data/solara/lib/core/doctor/validator/template/template_validator.rb +108 -0
  77. data/solara/lib/core/doctor/validator/validation_strategy.rb +7 -0
  78. data/solara/lib/core/scripts/brand_config_generator.rb +245 -0
  79. data/solara/lib/core/scripts/brand_config_manager.rb +90 -0
  80. data/solara/lib/core/scripts/brand_exporter.rb +38 -0
  81. data/solara/lib/core/scripts/brand_importer.rb +84 -0
  82. data/solara/lib/core/scripts/brand_offboarder.rb +19 -0
  83. data/solara/lib/core/scripts/brand_resources_manager.rb +77 -0
  84. data/solara/lib/core/scripts/directory_creator.rb +22 -0
  85. data/solara/lib/core/scripts/file_manager.rb +90 -0
  86. data/solara/lib/core/scripts/file_path.rb +327 -0
  87. data/solara/lib/core/scripts/folder_copier.rb +41 -0
  88. data/solara/lib/core/scripts/gitignore_manager.rb +54 -0
  89. data/solara/lib/core/scripts/interactive_file_system_validator.rb +110 -0
  90. data/solara/lib/core/scripts/platform/android/android_manifest_switcher.rb +24 -0
  91. data/solara/lib/core/scripts/platform/android/android_strings_switcher.rb +39 -0
  92. data/solara/lib/core/scripts/platform/android/gradle_switcher.rb +233 -0
  93. data/solara/lib/core/scripts/platform/android/properties_generator.rb +31 -0
  94. data/solara/lib/core/scripts/platform/ios/ios_file_path_manager.rb +109 -0
  95. data/solara/lib/core/scripts/platform/ios/ios_plist_manager.rb +42 -0
  96. data/solara/lib/core/scripts/platform/ios/xcconfig_generator.rb +44 -0
  97. data/solara/lib/core/scripts/platform/ios/xcode_asset_manager.rb +56 -0
  98. data/solara/lib/core/scripts/platform/ios/xcode_project_manager.rb +82 -0
  99. data/solara/lib/core/scripts/platform/ios/xcode_project_switcher.rb +130 -0
  100. data/solara/lib/core/scripts/project_settings_manager.rb +39 -0
  101. data/solara/lib/core/scripts/solara_logger.rb +103 -0
  102. data/solara/lib/core/scripts/solara_settings_manager.rb +73 -0
  103. data/solara/lib/core/scripts/solara_status_manager.rb +55 -0
  104. data/solara/lib/core/scripts/solara_version_manager.rb +42 -0
  105. data/solara/lib/core/scripts/strings_xml_manager.rb +22 -0
  106. data/solara/lib/core/scripts/terminal_input_manager.rb +22 -0
  107. data/solara/lib/core/scripts/theme_generator.rb +250 -0
  108. data/solara/lib/core/scripts/yaml_manager.rb +72 -0
  109. data/solara/lib/core/solara_configurator.rb +15 -0
  110. data/solara/lib/core/template/brands/android/android_config.json +8 -0
  111. data/solara/lib/core/template/brands/android/android_signing.json +6 -0
  112. data/solara/lib/core/template/brands/android/res/.DS_Store +0 -0
  113. data/solara/lib/core/template/brands/android/res/mipmap-hdpi/ic_launcher.png +0 -0
  114. data/solara/lib/core/template/brands/android/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  115. data/solara/lib/core/template/brands/android/res/mipmap-mdpi/ic_launcher.png +0 -0
  116. data/solara/lib/core/template/brands/android/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  117. data/solara/lib/core/template/brands/android/res/mipmap-xhdpi/ic_launcher.png +0 -0
  118. data/solara/lib/core/template/brands/android/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  119. data/solara/lib/core/template/brands/android/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  120. data/solara/lib/core/template/brands/android/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  121. data/solara/lib/core/template/brands/android/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  122. data/solara/lib/core/template/brands/android/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  123. data/solara/lib/core/template/brands/brands.json +4 -0
  124. data/solara/lib/core/template/brands/ios/assets/.DS_Store +0 -0
  125. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/100.png +0 -0
  126. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/102.png +0 -0
  127. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/1024.png +0 -0
  128. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/114.png +0 -0
  129. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/120.png +0 -0
  130. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/128.png +0 -0
  131. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/144.png +0 -0
  132. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/152.png +0 -0
  133. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/16.png +0 -0
  134. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/167.png +0 -0
  135. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/172.png +0 -0
  136. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/180.png +0 -0
  137. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/196.png +0 -0
  138. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/20.png +0 -0
  139. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/216.png +0 -0
  140. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/256.png +0 -0
  141. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/29.png +0 -0
  142. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/32.png +0 -0
  143. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/40.png +0 -0
  144. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/48.png +0 -0
  145. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/50.png +0 -0
  146. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/512.png +0 -0
  147. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/55.png +0 -0
  148. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/57.png +0 -0
  149. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/58.png +0 -0
  150. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/60.png +0 -0
  151. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/64.png +0 -0
  152. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/66.png +0 -0
  153. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/72.png +0 -0
  154. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/76.png +0 -0
  155. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/80.png +0 -0
  156. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/87.png +0 -0
  157. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/88.png +0 -0
  158. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/92.png +0 -0
  159. data/solara/lib/core/template/brands/ios/assets/AppIcon.appiconset/Contents.json +1 -0
  160. data/solara/lib/core/template/brands/ios/ios_config.json +7 -0
  161. data/solara/lib/core/template/brands/ios/ios_signing.json +7 -0
  162. data/solara/lib/core/template/brands/shared/.DS_Store +0 -0
  163. data/solara/lib/core/template/brands/shared/brand_config.json +2 -0
  164. data/solara/lib/core/template/brands/shared/theme.json +46 -0
  165. data/solara/lib/core/template/config/android_template_config.json +57 -0
  166. data/solara/lib/core/template/config/flutter_template_config.json +62 -0
  167. data/solara/lib/core/template/config/ios_template_config.json +57 -0
  168. data/solara/lib/core/template/project_template_generator.rb +63 -0
  169. data/solara/lib/platform_detector.rb +84 -0
  170. data/solara/lib/solara/cli.rb +5 -0
  171. data/solara/lib/solara/version.rb +3 -0
  172. data/solara/lib/solara.rb +238 -0
  173. data/solara/lib/solara_initializer.rb +44 -0
  174. data/solara/lib/solara_manager.rb +73 -0
  175. metadata +346 -0
@@ -0,0 +1,250 @@
1
+ require 'json'
2
+ require 'fileutils'
3
+
4
+ class ThemeGenerator
5
+ def initialize(input_path, output_path, language)
6
+ @theme = JSON.parse(File.read(input_path))
7
+ @output_path = output_path
8
+ @language = language.downcase
9
+
10
+ unless %w[kotlin swift dart].include?(@language)
11
+ raise ArgumentError, "Unsupported language. Choose 'kotlin', 'swift', or 'dart'."
12
+ end
13
+ end
14
+
15
+ def generate
16
+ code = send("generate_#{@language}")
17
+ write_to_file(code)
18
+ end
19
+
20
+ private
21
+
22
+ def generate_kotlin
23
+ kotlin_code = "import androidx.compose.ui.graphics.Color\n"
24
+ kotlin_code += "import androidx.compose.ui.unit.dp\n"
25
+ kotlin_code += "import androidx.compose.ui.unit.sp\n\n"
26
+ kotlin_code += "object #{@theme['name']} {\n"
27
+ kotlin_code += generate_kotlin_colors
28
+ kotlin_code += generate_kotlin_typography
29
+ kotlin_code += generate_kotlin_spacing
30
+ kotlin_code += generate_kotlin_border_radius
31
+ kotlin_code += generate_kotlin_elevation
32
+ kotlin_code += "}"
33
+ kotlin_code
34
+ end
35
+
36
+ def generate_swift
37
+ swift_code = "import SwiftUI\n\n"
38
+ swift_code += "struct #{@theme['name']} {\n"
39
+ swift_code += generate_swift_colors
40
+ swift_code += generate_swift_typography
41
+ swift_code += generate_swift_spacing
42
+ swift_code += generate_swift_border_radius
43
+ swift_code += generate_swift_elevation
44
+ swift_code += "}\n\n"
45
+ swift_code += generate_swift_colors_hext_extension
46
+ swift_code
47
+ end
48
+
49
+ def generate_dart
50
+ dart_code = "import 'package:flutter/material.dart';\n\n"
51
+ dart_code += generate_dart_colors
52
+ dart_code += generate_dart_typography
53
+ dart_code += generate_dart_spacing
54
+ dart_code += generate_dart_border_radius
55
+ dart_code += generate_dart_elevation
56
+ dart_code
57
+ end
58
+
59
+ def write_to_file(code)
60
+ FileUtils.mkdir_p(File.dirname(@output_path))
61
+ File.write(@output_path, code)
62
+ Solara.logger.debug("Generated #{@language.capitalize} theme file: #{@output_path}")
63
+ end
64
+
65
+ def generate_kotlin_colors
66
+ code = " object Colors {\n"
67
+ @theme['colors'].each do |name, value|
68
+ code += " val #{name} = Color(0xFF#{value[1..-1]})\n"
69
+ end
70
+ code += " }\n\n"
71
+ code
72
+ end
73
+
74
+ def generate_kotlin_typography
75
+ code = " object Typography {\n"
76
+ code += " object FontFamily {\n"
77
+ @theme['typography']['fontFamily'].each do |name, value|
78
+ code += " val #{name} = \"#{value}\"\n"
79
+ end
80
+ code += " }\n\n"
81
+ code += " object FontSize {\n"
82
+ @theme['typography']['fontSize'].each do |name, value|
83
+ code += " val #{name} = #{value}.sp\n"
84
+ end
85
+ code += " }\n"
86
+ code += " }\n\n"
87
+ code
88
+ end
89
+
90
+ def generate_kotlin_spacing
91
+ code = " object Spacing {\n"
92
+ @theme['spacing'].each do |name, value|
93
+ code += " val #{name} = #{value}.dp\n"
94
+ end
95
+ code += " }\n\n"
96
+ code
97
+ end
98
+
99
+ def generate_kotlin_border_radius
100
+ code = " object BorderRadius {\n"
101
+ @theme['borderRadius'].each do |name, value|
102
+ code += " val #{name} = #{value}.dp\n"
103
+ end
104
+ code += " }\n\n"
105
+ code
106
+ end
107
+
108
+ def generate_kotlin_elevation
109
+ code = " object Elevation {\n"
110
+ @theme['elevation'].each do |name, value|
111
+ code += " val #{name} = #{value}.dp\n"
112
+ end
113
+ code += " }\n"
114
+ code
115
+ end
116
+
117
+ def generate_swift_colors
118
+ code = " struct Colors {\n"
119
+ @theme['colors'].each do |name, value|
120
+ code += " static let #{name} = Color(hex: \"#{value}\")\n"
121
+ end
122
+ code += " }\n\n"
123
+ code
124
+ end
125
+
126
+ def generate_swift_colors_hext_extension
127
+ code = <<-SWIFT
128
+ extension Color {
129
+ init(hex: String) {
130
+ let hex = hex.trimmingCharacters(in: CharacterSet.alphanumerics.inverted)
131
+ var int: UInt64 = 0
132
+ Scanner(string: hex).scanHexInt64(&int)
133
+ let a, r, g, b: UInt64
134
+ switch hex.count {
135
+ case 3: // RGB (12-bit)
136
+ (a, r, g, b) = (255, (int >> 8) * 17, (int >> 4 & 0xF) * 17, (int & 0xF) * 17)
137
+ case 6: // RGB (24-bit)
138
+ (a, r, g, b) = (255, int >> 16, int >> 8 & 0xFF, int & 0xFF)
139
+ case 8: // ARGB (32-bit)
140
+ (a, r, g, b) = (int >> 24, int >> 16 & 0xFF, int >> 8 & 0xFF, int & 0xFF)
141
+ default:
142
+ (a, r, g, b) = (1, 1, 1, 0)
143
+ }
144
+
145
+ self.init(
146
+ .sRGB,
147
+ red: Double(r) / 255,
148
+ green: Double(g) / 255,
149
+ blue: Double(b) / 255,
150
+ opacity: Double(a) / 255
151
+ )
152
+ }
153
+ }
154
+ SWIFT
155
+ code
156
+ end
157
+
158
+ def generate_swift_typography
159
+ code = " struct Typography {\n"
160
+ code += " struct FontFamily {\n"
161
+ @theme['typography']['fontFamily'].each do |name, value|
162
+ code += " static let #{name} = \"#{value}\"\n"
163
+ end
164
+ code += " }\n\n"
165
+ code += " struct FontSize {\n"
166
+ @theme['typography']['fontSize'].each do |name, value|
167
+ code += " static let #{name}: CGFloat = #{value}\n"
168
+ end
169
+ code += " }\n"
170
+ code += " }\n\n"
171
+ code
172
+ end
173
+
174
+ def generate_swift_spacing
175
+ code = " struct Spacing {\n"
176
+ @theme['spacing'].each do |name, value|
177
+ code += " static let #{name}: CGFloat = #{value}\n"
178
+ end
179
+ code += " }\n\n"
180
+ code
181
+ end
182
+
183
+ def generate_swift_border_radius
184
+ code = " struct BorderRadius {\n"
185
+ @theme['borderRadius'].each do |name, value|
186
+ code += " static let #{name}: CGFloat = #{value}\n"
187
+ end
188
+ code += " }\n\n"
189
+ code
190
+ end
191
+
192
+ def generate_swift_elevation
193
+ code = " struct Elevation {\n"
194
+ @theme['elevation'].each do |name, value|
195
+ code += " static let #{name}: CGFloat = #{value}\n"
196
+ end
197
+ code += " }\n"
198
+ code
199
+ end
200
+
201
+ def generate_dart_colors
202
+ code = " class BrandColors {\n"
203
+ @theme['colors'].each do |name, value|
204
+ code += " static const Color #{name} = Color(0xFF#{value[1..-1]});\n"
205
+ end
206
+ code += " }\n\n"
207
+ code
208
+ end
209
+
210
+ def generate_dart_typography
211
+ code = " class FontFamily {\n"
212
+ @theme['typography']['fontFamily'].each do |name, value|
213
+ code += " static const String #{name} = '#{value}';\n"
214
+ end
215
+ code += " }\n\n"
216
+ code += " class FontSize {\n"
217
+ @theme['typography']['fontSize'].each do |name, value|
218
+ code += " static const double #{name} = #{value};\n"
219
+ end
220
+ code += " }\n\n"
221
+ code
222
+ end
223
+
224
+ def generate_dart_spacing
225
+ code = " class Spacing {\n"
226
+ @theme['spacing'].each do |name, value|
227
+ code += " static const double #{name} = #{value};\n"
228
+ end
229
+ code += " }\n\n"
230
+ code
231
+ end
232
+
233
+ def generate_dart_border_radius
234
+ code = " class BorderRadius {\n"
235
+ @theme['borderRadius'].each do |name, value|
236
+ code += " static const double #{name} = #{value};\n"
237
+ end
238
+ code += " }\n\n"
239
+ code
240
+ end
241
+
242
+ def generate_dart_elevation
243
+ code = " class Elevation {\n"
244
+ @theme['elevation'].each do |name, value|
245
+ code += " static const double #{name} = #{value};\n"
246
+ end
247
+ code += " }\n"
248
+ code
249
+ end
250
+ end
@@ -0,0 +1,72 @@
1
+ require 'yaml'
2
+ require 'psych'
3
+
4
+ class YamlManager
5
+ def initialize(file_path)
6
+ @file_path = file_path
7
+ end
8
+
9
+ def add_property(property_name, property_value)
10
+ yaml_data = load_yaml
11
+
12
+ if yaml_data.key?(property_name)
13
+ Solara.logger.debug("YamlManager: Property '#{property_name}' already exists in the YAML file.")
14
+ else
15
+ yaml_data[property_name] = property_value
16
+ save_yaml(yaml_data)
17
+ Solara.logger.debug("YamlManager: Property '#{property_name}' has been added to the YAML file.")
18
+ end
19
+ end
20
+
21
+ def add_to_array(property_name, value)
22
+ yaml_data = load_yaml
23
+
24
+ if yaml_data.key?(property_name)
25
+ if yaml_data[property_name].is_a?(Array)
26
+ yaml_data[property_name] << value
27
+ save_yaml(yaml_data)
28
+ Solara.logger.debug("YamlManager: Value '#{value}' has been added to the array '#{property_name}'.")
29
+ else
30
+ Solara.logger.debug("YamlManager: Property '#{property_name}' exists but is not an array.")
31
+ end
32
+ else
33
+ yaml_data[property_name] = [value]
34
+ save_yaml(yaml_data)
35
+ Solara.logger.debug("YamlManager: New array '#{property_name}' has been created with value '#{value}'.")
36
+ end
37
+ end
38
+
39
+ def add_to_nested_array(parent_property, array_property, value)
40
+ yaml_data = load_yaml
41
+
42
+ yaml_data[parent_property] ||= {}
43
+ yaml_data[parent_property][array_property] ||= []
44
+
45
+ if yaml_data[parent_property][array_property].include?(value)
46
+ Solara.logger.debug("YamlManager: Value '#{value}' already exists in the array '#{array_property}' under '#{parent_property}'.")
47
+ else
48
+ yaml_data[parent_property][array_property] << value
49
+ save_yaml(yaml_data)
50
+ Solara.logger.debug("YamlManager: Value '#{value}' has been added to the array '#{array_property}' under '#{parent_property}'.")
51
+ end
52
+ end
53
+
54
+ private
55
+
56
+ def load_yaml
57
+ YAML.load_file(@file_path)
58
+ rescue Errno::ENOENT
59
+ Solara.logger.debug("YamlManager: File not found. Creating a new YAML file.")
60
+ {}
61
+ end
62
+
63
+ def save_yaml(data)
64
+ File.open(@file_path, 'w') do |file|
65
+ file.write(yaml_dump(data))
66
+ end
67
+ end
68
+
69
+ def yaml_dump(data)
70
+ Psych.dump(data, indentation: 2, line_width: -1).gsub(/^---\n/, '')
71
+ end
72
+ end
@@ -0,0 +1,15 @@
1
+ Dir[File.expand_path('scripts/*.rb', __dir__)].each { |file| require_relative file }
2
+ Dir[File.expand_path('platform/android/*.rb', __dir__)].each { |file| require_relative file }
3
+ Dir[File.expand_path('platform/flutter/*.rb', __dir__)].each { |file| require_relative file }
4
+
5
+ class SolaraConfigurator
6
+ def initialize
7
+ end
8
+
9
+ def start
10
+ GitignoreManager.ignore_redundant_files
11
+ AliasGeneratorManager.new.start
12
+ end
13
+
14
+ end
15
+
@@ -0,0 +1,8 @@
1
+ {
2
+ "brandName": "",
3
+ "applicationId": "",
4
+ "versionName": "1.0.0",
5
+ "versionCode": 1,
6
+ "sourceSets": [
7
+ ]
8
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "storeFile": "",
3
+ "keyAlias": "",
4
+ "storePassword": "",
5
+ "keyPassword": ""
6
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "brands": [
3
+ ]
4
+ }
@@ -0,0 +1 @@
1
+ {"images":[{"size":"60x60","expected-size":"180","filename":"180.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"40x40","expected-size":"80","filename":"80.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"40x40","expected-size":"120","filename":"120.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"60x60","expected-size":"120","filename":"120.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"57x57","expected-size":"57","filename":"57.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"1x"},{"size":"29x29","expected-size":"58","filename":"58.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"29x29","expected-size":"29","filename":"29.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"1x"},{"size":"29x29","expected-size":"87","filename":"87.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"57x57","expected-size":"114","filename":"114.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"20x20","expected-size":"40","filename":"40.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"20x20","expected-size":"60","filename":"60.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"1024x1024","filename":"1024.png","expected-size":"1024","idiom":"ios-marketing","folder":"Assets.xcassets/AppIcon.appiconset/","scale":"1x"},{"size":"40x40","expected-size":"80","filename":"80.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"72x72","expected-size":"72","filename":"72.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"76x76","expected-size":"152","filename":"152.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"50x50","expected-size":"100","filename":"100.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"29x29","expected-size":"58","filename":"58.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"76x76","expected-size":"76","filename":"76.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"29x29","expected-size":"29","filename":"29.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"50x50","expected-size":"50","filename":"50.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"72x72","expected-size":"144","filename":"144.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"40x40","expected-size":"40","filename":"40.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"83.5x83.5","expected-size":"167","filename":"167.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"20x20","expected-size":"20","filename":"20.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"20x20","expected-size":"40","filename":"40.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"idiom":"watch","filename":"172.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"38mm","scale":"2x","size":"86x86","expected-size":"172","role":"quickLook"},{"idiom":"watch","filename":"80.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"38mm","scale":"2x","size":"40x40","expected-size":"80","role":"appLauncher"},{"idiom":"watch","filename":"88.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"40mm","scale":"2x","size":"44x44","expected-size":"88","role":"appLauncher"},{"idiom":"watch","filename":"102.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"41mm","scale":"2x","size":"45x45","expected-size":"102","role":"appLauncher"},{"idiom":"watch","filename":"92.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"41mm","scale":"2x","size":"46x46","expected-size":"92","role":"appLauncher"},{"idiom":"watch","filename":"100.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"44mm","scale":"2x","size":"50x50","expected-size":"100","role":"appLauncher"},{"idiom":"watch","filename":"196.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"42mm","scale":"2x","size":"98x98","expected-size":"196","role":"quickLook"},{"idiom":"watch","filename":"216.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"44mm","scale":"2x","size":"108x108","expected-size":"216","role":"quickLook"},{"idiom":"watch","filename":"48.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"38mm","scale":"2x","size":"24x24","expected-size":"48","role":"notificationCenter"},{"idiom":"watch","filename":"55.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"42mm","scale":"2x","size":"27.5x27.5","expected-size":"55","role":"notificationCenter"},{"idiom":"watch","filename":"66.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"45mm","scale":"2x","size":"33x33","expected-size":"66","role":"notificationCenter"},{"size":"29x29","expected-size":"87","filename":"87.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"watch","role":"companionSettings","scale":"3x"},{"size":"29x29","expected-size":"58","filename":"58.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"watch","role":"companionSettings","scale":"2x"},{"size":"1024x1024","expected-size":"1024","filename":"1024.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"watch-marketing","scale":"1x"},{"size":"128x128","expected-size":"128","filename":"128.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"1x"},{"size":"256x256","expected-size":"256","filename":"256.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"1x"},{"size":"128x128","expected-size":"256","filename":"256.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"2x"},{"size":"256x256","expected-size":"512","filename":"512.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"2x"},{"size":"32x32","expected-size":"32","filename":"32.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"1x"},{"size":"512x512","expected-size":"512","filename":"512.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"1x"},{"size":"16x16","expected-size":"16","filename":"16.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"1x"},{"size":"16x16","expected-size":"32","filename":"32.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"2x"},{"size":"32x32","expected-size":"64","filename":"64.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"2x"},{"size":"512x512","expected-size":"1024","filename":"1024.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"2x"}]}
@@ -0,0 +1,7 @@
1
+ {
2
+ "PRODUCT_NAME": "",
3
+ "PRODUCT_BUNDLE_IDENTIFIER": "",
4
+ "MARKETING_VERSION": "1.0.0",
5
+ "BUNDLE_VERSION": "1",
6
+ "APL_MRCH_ID": ""
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "CODE_SIGN_IDENTITY": "",
3
+ "DEVELOPMENT_TEAM": "",
4
+ "PROVISIONING_PROFILE_SPECIFIER": "",
5
+ "CODE_SIGN_STYLE": "Automatic",
6
+ "CODE_SIGN_ENTITLEMENTS": ""
7
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "BrandTheme",
3
+ "version": "1.0.0",
4
+ "colors": {
5
+ "primary": "#007AFF",
6
+ "secondary": "#5AC8FA",
7
+ "background": "#FFFFFF",
8
+ "surface": "#F2F2F7",
9
+ "error": "#FF3B30",
10
+ "onPrimary": "#FFFFFF",
11
+ "onSecondary": "#000000",
12
+ "onBackground": "#000000",
13
+ "onSurface": "#000000",
14
+ "onError": "#FFFFFF"
15
+ },
16
+ "typography": {
17
+ "fontFamily": {
18
+ "regular": "Roboto",
19
+ "medium": "Roboto-Medium",
20
+ "bold": "Roboto-Bold"
21
+ },
22
+ "fontSize": {
23
+ "small": 12,
24
+ "medium": 16,
25
+ "large": 20,
26
+ "extraLarge": 24
27
+ }
28
+ },
29
+ "spacing": {
30
+ "small": 8,
31
+ "medium": 16,
32
+ "large": 24,
33
+ "extraLarge": 32
34
+ },
35
+ "borderRadius": {
36
+ "small": 4,
37
+ "medium": 8,
38
+ "large": 12
39
+ },
40
+ "elevation": {
41
+ "none": 0,
42
+ "low": 2,
43
+ "medium": 4,
44
+ "high": 8
45
+ }
46
+ }
@@ -0,0 +1,57 @@
1
+ {
2
+ "files": [
3
+ {
4
+ "source": "brands.json",
5
+ "target": "../brands.json",
6
+ "condition": "true"
7
+ },
8
+ {
9
+ "source": "android/assets/",
10
+ "target": "android/assets/",
11
+ "condition": "true"
12
+ },
13
+ {
14
+ "source": "android/res/",
15
+ "target": "android/res/",
16
+ "condition": "true"
17
+ },
18
+ {
19
+ "source": "android/android_config.json",
20
+ "target": "android/android_config.json",
21
+ "condition": "true"
22
+ },
23
+ {
24
+ "source": "android/android_signing.json",
25
+ "target": "android/android_signing.json",
26
+ "condition": "true"
27
+ },
28
+ {
29
+ "source": "ios/assets/",
30
+ "target": "ios/assets/",
31
+ "condition": "true"
32
+ },
33
+ {
34
+ "source": "ios/ios_config.json",
35
+ "target": "ios/ios_config.json",
36
+ "condition": "true"
37
+ },
38
+ {
39
+ "source": "ios/ios_signing.json",
40
+ "target": "ios/ios_signing.json",
41
+ "condition": "true"
42
+ },
43
+ {
44
+ "source": "shared/theme.json",
45
+ "target": "shared/theme.json",
46
+ "condition": "true"
47
+ },
48
+ {
49
+ "source": "shared/brand_config.json",
50
+ "target": "shared/brand_config.json",
51
+ "condition": "true"
52
+ }
53
+ ],
54
+ "variables": {
55
+ "platform": "android"
56
+ }
57
+ }