solara 0.1.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/bin/solara +3 -1
  3. data/solara/lib/core/.DS_Store +0 -0
  4. data/solara/lib/core/aliases/alias_generator.rb +1 -0
  5. data/solara/lib/core/aliases/alias_generator_manager.rb +2 -1
  6. data/solara/lib/core/aliases/solara_terminal_setup.rb +1 -1
  7. data/solara/lib/core/brands/brand_font_switcher.rb +154 -0
  8. data/solara/lib/core/brands/brand_onboarder.rb +8 -6
  9. data/solara/lib/core/brands/brand_switcher.rb +232 -166
  10. data/solara/lib/core/brands/brands_manager.rb +15 -39
  11. data/solara/lib/core/dashboard/brand/BrandDetail.js +19 -0
  12. data/solara/lib/core/dashboard/brand/BrandDetailController.js +50 -8
  13. data/solara/lib/core/dashboard/brand/BrandDetailModel.js +9 -30
  14. data/solara/lib/core/dashboard/brand/BrandDetailView.js +49 -3
  15. data/solara/lib/core/dashboard/brand/InfoPlistStringCatalogManager.js +19 -0
  16. data/solara/lib/core/dashboard/brand/brand.html +209 -62
  17. data/solara/lib/core/dashboard/brand/source/BrandLocalSource.js +1 -1
  18. data/solara/lib/core/dashboard/brand/source/BrandRemoteSource.js +38 -53
  19. data/solara/lib/core/dashboard/brands/BrandsController.js +6 -5
  20. data/solara/lib/core/dashboard/brands/BrandsModel.js +2 -2
  21. data/solara/lib/core/dashboard/brands/BrandsView.js +2 -2
  22. data/solara/lib/core/dashboard/brands/brands.html +3 -1
  23. data/solara/lib/core/dashboard/component/AliasesBottomSheet.js +7 -5
  24. data/solara/lib/core/dashboard/dashboard_manager.rb +2 -0
  25. data/solara/lib/core/dashboard/dashboard_server.rb +1 -3
  26. data/solara/lib/core/dashboard/handler/brand_alisases_handler.rb +4 -11
  27. data/solara/lib/core/dashboard/handler/brand_configurations_manager.rb +11 -11
  28. data/solara/lib/core/dashboard/handler/{brand_configurations_handler.rb → brand_details_handler.rb} +4 -4
  29. data/solara/lib/core/dashboard/handler/brands_handler.rb +1 -1
  30. data/solara/lib/core/dashboard/handler/edit_section_handler.rb +8 -8
  31. data/solara/lib/core/doctor/brand_doctor.rb +31 -31
  32. data/solara/lib/core/doctor/doctor_manager.rb +0 -1
  33. data/solara/lib/core/doctor/project_doctor.rb +0 -1
  34. data/solara/lib/core/doctor/schema/platform/android/android_config.json +0 -4
  35. data/solara/lib/core/doctor/schema/platform/ios/InfoPlist.xcstrings +15 -0
  36. data/solara/lib/core/doctor/schema/platform/ios/ios_config.json +0 -5
  37. data/solara/lib/core/doctor/schema/platform/shared/brand_config.json +9 -0
  38. data/solara/lib/core/doctor/schema/platform/shared/theme.json +94 -9
  39. data/solara/lib/core/doctor/validator/brand_settings_validator.rb +6 -0
  40. data/solara/lib/core/doctor/validator/brand_settings_validator_manager.rb +9 -21
  41. data/solara/lib/core/doctor/validator/template/android_template_validation_config.yml +22 -4
  42. data/solara/lib/core/doctor/validator/template/flutter_template_validation_config.yml +22 -6
  43. data/solara/lib/core/doctor/validator/template/ios_template_validation_config.yml +22 -4
  44. data/solara/lib/core/scripts/brand_config_generator.rb +1 -0
  45. data/solara/lib/core/scripts/brand_config_manager.rb +2 -4
  46. data/solara/lib/core/scripts/brand_exporter.rb +1 -1
  47. data/solara/lib/core/scripts/brand_importer.rb +2 -3
  48. data/solara/lib/core/scripts/brand_offboarder.rb +5 -0
  49. data/solara/lib/core/scripts/brand_resources_manager.rb +127 -54
  50. data/solara/lib/core/scripts/directory_creator.rb +2 -2
  51. data/solara/lib/core/scripts/file_manager.rb +53 -19
  52. data/solara/lib/core/scripts/file_path.rb +175 -30
  53. data/solara/lib/core/scripts/folder_copier.rb +3 -7
  54. data/solara/lib/core/scripts/gitignore_manager.rb +21 -10
  55. data/solara/lib/core/scripts/interactive_file_system_validator.rb +8 -2
  56. data/solara/lib/core/scripts/platform/android/android_manifest_switcher.rb +3 -3
  57. data/solara/lib/core/scripts/platform/android/android_strings_switcher.rb +26 -24
  58. data/solara/lib/core/scripts/platform/android/gradle_switcher.rb +7 -6
  59. data/solara/lib/core/scripts/platform/ios/infoplist_string_catalog_manager.rb +123 -0
  60. data/solara/lib/core/scripts/platform/ios/infoplist_switcher.rb +59 -0
  61. data/solara/lib/core/scripts/platform/ios/ios_plist_manager.rb +11 -20
  62. data/solara/lib/core/scripts/platform/ios/plist_font_manager.rb +33 -0
  63. data/solara/lib/core/scripts/platform/ios/xcconfig_generator.rb +15 -3
  64. data/solara/lib/core/scripts/platform/ios/xcode_asset_manager.rb +2 -3
  65. data/solara/lib/core/scripts/platform/ios/xcode_project_manager.rb +80 -1
  66. data/solara/lib/core/scripts/platform/ios/xcode_project_switcher.rb +15 -34
  67. data/solara/lib/core/scripts/solara_logger.rb +10 -0
  68. data/solara/lib/core/scripts/solara_settings_manager.rb +26 -1
  69. data/solara/lib/core/scripts/strings_xml_manager.rb +17 -2
  70. data/solara/lib/core/scripts/theme_generator.rb +133 -130
  71. data/solara/lib/core/scripts/yaml_manager.rb +23 -0
  72. data/solara/lib/core/solara_configurator.rb +1 -1
  73. data/solara/lib/core/template/brands/android/android_config.json +0 -1
  74. data/solara/lib/core/template/brands/android/res/values/strings.xml +4 -0
  75. data/solara/lib/core/template/brands/ios/InfoPlist.xcstrings +30 -0
  76. data/solara/lib/core/template/brands/ios/ios_config.json +1 -2
  77. data/solara/lib/core/template/brands/shared/brand_config.json +1 -0
  78. data/solara/lib/core/template/brands/shared/theme.json +3 -3
  79. data/solara/lib/core/template/config/android_template_config.json +11 -1
  80. data/solara/lib/core/template/config/flutter_template_config.json +12 -2
  81. data/solara/lib/core/template/config/ios_template_config.json +11 -1
  82. data/solara/lib/core/template/project_template_generator.rb +8 -3
  83. data/solara/lib/solara/version.rb +1 -1
  84. data/solara/lib/solara.rb +8 -4
  85. data/solara/lib/solara_initializer.rb +5 -2
  86. data/solara/lib/solara_manager.rb +1 -1
  87. metadata +63 -44
  88. data/solara/lib/core/dashboard/handler/brand_section_handler.rb +0 -20
  89. data/solara/lib/core/doctor/validator/directory_structure_validator.rb +0 -38
  90. data/solara/lib/core/doctor/validator/file_structure_validator.rb +0 -37
  91. data/solara/lib/core/scripts/platform/ios/ios_file_path_manager.rb +0 -109
  92. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/.DS_Store +0 -0
  93. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/100.png +0 -0
  94. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/102.png +0 -0
  95. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/1024.png +0 -0
  96. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/114.png +0 -0
  97. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/120.png +0 -0
  98. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/128.png +0 -0
  99. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/144.png +0 -0
  100. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/152.png +0 -0
  101. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/16.png +0 -0
  102. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/167.png +0 -0
  103. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/172.png +0 -0
  104. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/180.png +0 -0
  105. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/196.png +0 -0
  106. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/20.png +0 -0
  107. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/216.png +0 -0
  108. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/256.png +0 -0
  109. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/29.png +0 -0
  110. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/32.png +0 -0
  111. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/40.png +0 -0
  112. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/48.png +0 -0
  113. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/50.png +0 -0
  114. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/512.png +0 -0
  115. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/55.png +0 -0
  116. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/57.png +0 -0
  117. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/58.png +0 -0
  118. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/60.png +0 -0
  119. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/64.png +0 -0
  120. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/66.png +0 -0
  121. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/72.png +0 -0
  122. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/76.png +0 -0
  123. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/80.png +0 -0
  124. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/87.png +0 -0
  125. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/88.png +0 -0
  126. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/92.png +0 -0
  127. /data/solara/lib/core/template/brands/ios/{assets → xcassets}/AppIcon.appiconset/Contents.json +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 145b33e1ba6fda109d59904bf8e356ed6ec8f4990b16857e5fbde74fb2d5e2da
4
- data.tar.gz: 401d6f18d80006e0e030d1873ad6488a845301fc8f6fb91700ecd7cf2b959c25
3
+ metadata.gz: dea7da41ec79265551adc948a5586af994164b9c04ef3576b2c37b9fab2f108f
4
+ data.tar.gz: 31352f627b65fa267a082095bfec2346b03173a944e2c967974107c0c30f7e9b
5
5
  SHA512:
6
- metadata.gz: 4dbd300836c1b9c4885c24e9f9506f0b10fb0baa987a5a851d95aa24d5e592e9af496d96601c05f248e386736589151916baab4a53034af1d2723ccd99f26482
7
- data.tar.gz: 3bbc2fc137767dd083228dd520a8b47e8ab7a06eb1b78ea81fa6184524d70630167419665021f1eefb08ddab649cdaa771d265685e5288d4ec1b53778c4a2016
6
+ metadata.gz: a4623541490f240d2ffacbb682d8b9388058633af6e40d548cd998cad186f87addd4efc4675e2257d4c90102f42ce7589e3c90d400f84775d8ca25f1af201f5b
7
+ data.tar.gz: c5158cd2c02abd104155d482c3e59e8c7a79b4289eb4316a5c9ee7de101892b6ae1d1341c247b97a38611041add484a4abaaf9d414c4380fa7cebbf12ecbbf35
data/bin/solara CHANGED
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
+ # bin/solara
3
+
4
+ require 'solara'
2
5
 
3
6
  if RUBY_VERSION < '2.0.0'
4
7
  abort("Solara requires Ruby 2.0.0 or higher")
@@ -12,7 +15,6 @@ Dir.glob("#{__dir__}/core/aliases/*.rb").each { |file| require file }
12
15
  Dir.glob("#{__dir__}/core/dashboard/*.rb").each { |file| require file }
13
16
  Dir.glob("#{__dir__}/core/brands/*.rb").each { |file| require file }
14
17
 
15
- require 'solara'
16
18
 
17
19
  Solara::Setup.new.setup
18
20
  Solara::CLI.start(ARGV)
Binary file
@@ -18,6 +18,7 @@ class AliasGenerator
18
18
 
19
19
  def add_brand_aliases(brands)
20
20
  alias_templates = [
21
+ "solara_export_{brand_key}='solara export --brand_keys {brand_key}'",
21
22
  "solara_offboard_{brand_key}='solara offboard -k {brand_key}'",
22
23
  "solara_switch_{brand_key}='solara switch -k {brand_key}'",
23
24
  "solara_doctor_{brand_key}='solara doctor -k {brand_key}'",
@@ -1,6 +1,6 @@
1
1
  class AliasGeneratorManager
2
2
  def initialize
3
- @generator = AliasGenerator.new()
3
+ @generator = AliasGenerator.new
4
4
  end
5
5
 
6
6
  def start
@@ -8,6 +8,7 @@ class AliasGeneratorManager
8
8
  common_aliases = [
9
9
  "solara_dashboard='solara dashboard'",
10
10
  "solara_doctor='solara doctor'",
11
+ "solara_status='solara status'",
11
12
  ]
12
13
 
13
14
  @generator.add_brand_aliases(BrandsManager.instance.brands_list)
@@ -83,7 +83,7 @@ class SolaraSetup
83
83
  reg['AutoRun', Win32::Registry::REG_EXPAND_SZ] = @windows_setup_file
84
84
  end
85
85
  Solara.logger.success("Windows AutoRun registry key set up successfully.")
86
- pSolara.logger.warn("Please restart your Command Prompt to apply changes.")
86
+ Solara.logger.warn("Please restart your Command Prompt to apply changes.")
87
87
  rescue Win32::Registry::Error => e
88
88
  Solara.logger.failure("Failed to set up Windows registry: #{e.message}")
89
89
  Solara.logger.failure("Please add the following file path to your AutoRun registry key manually:")
@@ -0,0 +1,154 @@
1
+ Dir[File.expand_path('scripts/*.rb', __dir__)].each { |file| require_relative file }
2
+ Dir[File.expand_path('../template/*.rb', __dir__)].each { |file| require_relative file }
3
+ Dir[File.expand_path('platform/android/*.rb', __dir__)].each { |file| require_relative file }
4
+ Dir[File.expand_path('platform/ios/*.rb', __dir__)].each { |file| require_relative file }
5
+ Dir[File.expand_path('platform/flutter/*.rb', __dir__)].each { |file| require_relative file }
6
+ class BrandFontSwitcher
7
+ def initialize(brand_key)
8
+ @brand_key = brand_key
9
+ @fonts_path = FilePath.brand_fonts
10
+ @font_files = Dir.glob(File.join(@fonts_path, '*.{ttf,otf}'))
11
+ Solara.logger.end_step("Switch Info.plist")
12
+ end
13
+
14
+ def switch
15
+ Solara.logger.header("Switch Fonts")
16
+
17
+ case SolaraSettingsManager.instance.platform
18
+ when Platform::Flutter
19
+ FlutterFontSwitcher.new(@brand_key, @font_files).switch
20
+ AndroidFontSwitcher.new(@brand_key, @font_files).switch
21
+ IOSFontSwitcher.new(@brand_key, @font_files).switch
22
+ when Platform::Android
23
+ AndroidFontSwitcher.new(@brand_key, @font_files).switch
24
+ when Platform::IOS
25
+ IOSFontSwitcher.new(@brand_key, @font_files).switch
26
+ else
27
+ raise ArgumentError, "Invalid platform: #{SolaraSettingsManager.instance.platform}"
28
+ end
29
+ end
30
+ end
31
+
32
+ class FlutterFontSwitcher
33
+ def initialize(brand_key, font_files)
34
+ @brand_key = brand_key
35
+ @font_files = font_files
36
+ end
37
+
38
+ def switch
39
+ Solara.logger.start_step("Switch Flutter fonts")
40
+ destination = FilePath.flutter_project_fonts
41
+ copy_fonts(destination)
42
+
43
+ add_fonts_to_pubspec
44
+ Solara.logger.end_step("Switch Flutter fonts")
45
+ end
46
+
47
+ private
48
+
49
+ def add_fonts_to_pubspec
50
+ yaml_manager = YamlManager.new(FilePath.pub_spec_yaml)
51
+ font_families = Hash.new { |hash, key| hash[key] = [] }
52
+
53
+ font_names = @font_files.map { |file| File.basename(file) }
54
+ font_names.each do |font_file|
55
+ base_name = File.basename(font_file, File.extname(font_file))
56
+ family_name = base_name.split('-').first
57
+ font_families[family_name] << font_file
58
+ end
59
+
60
+ font_families.each do |family_name, files|
61
+ assets = files.map { |file| { 'asset' => "assets/solara_fonts/#{file}" } }
62
+ yaml_manager.add_font(family_name, assets)
63
+ end
64
+ end
65
+
66
+ def copy_fonts(destination)
67
+ FontCopier.new.copy(destination, @font_files)
68
+ end
69
+ end
70
+
71
+ class AndroidFontSwitcher
72
+ def initialize(brand_key, font_files)
73
+ @brand_key = brand_key
74
+ @font_files = font_files
75
+ end
76
+
77
+ def switch
78
+ Solara.logger.start_step("Switch Android fonts")
79
+ destination = FilePath.android_project_fonts
80
+ copy_fonts(destination)
81
+ rename_fonts_in_directory(FilePath.android_project_fonts)
82
+ Solara.logger.end_step("Switch Android fonts")
83
+ end
84
+
85
+ private
86
+
87
+ def rename_fonts_in_directory(directory)
88
+ Dir.foreach(directory) do |file|
89
+ next if file == '.' || file == '..' # Skip current and parent directory entries
90
+
91
+ old_path = File.join(directory, file)
92
+ if File.file?(old_path)
93
+ new_name = sanitize_font_name(file)
94
+ new_path = File.join(directory, new_name)
95
+
96
+ # Rename the file if the new name is different
97
+ unless old_path == new_path
98
+ FileUtils.mv(old_path, new_path)
99
+ Solara.logger.debug("Renamed: #{file} -> #{new_name}")
100
+ end
101
+ end
102
+ end
103
+ end
104
+
105
+ def sanitize_font_name(font_name)
106
+ # Convert to lowercase
107
+ sanitized_name = font_name.downcase
108
+ # Replace spaces with underscores
109
+ sanitized_name.gsub!('-', '_')
110
+ sanitized_name.gsub!(' ', '_')
111
+ # Remove special characters (except underscores and dots)
112
+ sanitized_name.gsub!(/[^a-z0-9_.]/, '')
113
+ sanitized_name
114
+ end
115
+
116
+ def copy_fonts(destination)
117
+ FontCopier.new.copy(destination, @font_files)
118
+ end
119
+ end
120
+
121
+ class IOSFontSwitcher
122
+ def initialize(brand_key, font_files)
123
+ @brand_key = brand_key
124
+ @font_files = font_files
125
+ end
126
+
127
+ def switch
128
+ Solara.logger.start_step("Switch iOS fonts")
129
+ destination = FilePath.ios_project_fonts
130
+ copy_fonts(destination)
131
+
132
+ font_names = @font_files.map { |file| File.basename(file) }
133
+ info_plist_path = FilePath.info_plist
134
+ manager = IOSPlistManager.new(@project, info_plist_path)
135
+ manager.add_fonts(font_names)
136
+
137
+ Solara.logger.end_step("Switch iOS fonts")
138
+ end
139
+
140
+ private
141
+
142
+ def copy_fonts(destination)
143
+ FontCopier.new.copy(destination, @font_files)
144
+ end
145
+ end
146
+
147
+ class FontCopier
148
+ def copy(destination, font_files)
149
+ FileUtils.mkdir_p(destination)
150
+ return if font_files.empty?
151
+
152
+ FolderCopier.new(FilePath.brand_fonts, destination).copy
153
+ end
154
+ end
@@ -20,15 +20,11 @@ class BrandOnboarder
20
20
  add_to_brands_list
21
21
  end
22
22
 
23
- def add_to_brands_list
24
- BrandsManager.instance.add_brand(@brand_name, @brand_key)
25
- end
26
-
27
23
  def generate_brand_template
28
24
  Solara.logger.debug("Onboarding #{@brand_key} from template.")
29
25
 
30
26
  template_dir = FilePath.template_brands
31
- target_dir = File.join(FilePath.solara, 'brands', @brand_key)
27
+ target_dir = FilePath.brand(@brand_key)
32
28
  config_file = FilePath.template_config
33
29
 
34
30
  generator = ProjectTemplateGenerator.new(template_dir, target_dir, config_file)
@@ -38,9 +34,15 @@ class BrandOnboarder
38
34
  def clone_brand
39
35
  Solara.logger.debug("Cloning #{@clone_brand_key} to #{@brand_key}")
40
36
  source = FilePath.brand(@clone_brand_key)
41
- destination = File.join(FilePath.solara, 'brands', @brand_key)
37
+ destination = FilePath.brand(@brand_key)
38
+
39
+ FileManager.delete_if_exists(destination)
42
40
  FolderCopier.new(source, destination).copy
43
41
  end
44
42
 
43
+ def add_to_brands_list
44
+ BrandsManager.instance.add_brand(@brand_name, @brand_key)
45
+ end
46
+
45
47
  end
46
48