solara 0.2.2 → 0.2.4

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 (27) hide show
  1. checksums.yaml +4 -4
  2. data/bin/solara +2 -2
  3. data/solara/lib/core/aliases/alias_generator.rb +231 -57
  4. data/solara/lib/core/aliases/{solara_terminal_setup.rb → terminal_setup.rb} +69 -34
  5. data/solara/lib/core/brands/brands_manager.rb +15 -0
  6. data/solara/lib/core/dashboard/brand/BrandDetailView.js +1 -0
  7. data/solara/lib/core/dashboard/brand/brand.html +131 -132
  8. data/solara/lib/core/dashboard/brand/source/BrandRemoteSource.js +4 -4
  9. data/solara/lib/core/dashboard/brands/brands.html +79 -79
  10. data/solara/lib/core/dashboard/component/AddFieldSheet.js +105 -142
  11. data/solara/lib/core/dashboard/component/AliasesBottomSheet.js +85 -79
  12. data/solara/lib/core/dashboard/component/BrandOptionsBottomSheet.js +68 -67
  13. data/solara/lib/core/dashboard/component/ConfirmationDialog.js +66 -64
  14. data/solara/lib/core/dashboard/component/MessageBottomSheet.js +48 -48
  15. data/solara/lib/core/dashboard/component/OnboardBrandBottomSheet.js +128 -125
  16. data/solara/lib/core/dashboard/dashboard_server.rb +1 -1
  17. data/solara/lib/core/dashboard/handler/brand_alisases_handler.rb +1 -1
  18. data/solara/lib/core/dashboard/handler/brand_configurations_manager.rb +2 -2
  19. data/solara/lib/core/dashboard/handler/brand_icon_handler.rb +1 -1
  20. data/solara/lib/core/doctor/doctor_manager.rb +15 -1
  21. data/solara/lib/core/scripts/file_path.rb +9 -1
  22. data/solara/lib/core/scripts/solara_status_manager.rb +4 -0
  23. data/solara/lib/core/solara_configurator.rb +1 -1
  24. data/solara/lib/solara/version.rb +1 -1
  25. data/solara/lib/solara.rb +4 -2
  26. metadata +4 -5
  27. data/solara/lib/core/aliases/alias_generator_manager.rb +0 -29
@@ -12,134 +12,137 @@ class OnboardBrandBottomSheet extends HTMLElement {
12
12
 
13
13
  render() {
14
14
  this.shadowRoot.innerHTML = `
15
- <head>
16
- <style>
17
- .overlay {
18
- display: none;
19
- position: fixed;
20
- top: 0;
21
- left: 0;
22
- right: 0;
23
- bottom: 0;
24
- background-color: rgba(0, 0, 0, 0.5);
25
- z-index: 999;
26
- }
27
- .bottom-sheet {
28
- display: none;
29
- position: fixed;
30
- bottom: 0;
31
- left: 0;
32
- right: 0;
33
- background-color: white;
34
- border-top-left-radius: 20px;
35
- border-top-right-radius: 20px;
36
- box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
37
- z-index: 1000;
38
- padding: 20px;
39
- transition: transform 0.3s ease-out;
40
- transform: translateY(100%);
41
- max-width: 700px;
42
- margin: 0 auto;
43
- width: 100%;
44
- }
45
- .bottom-sheet.show {
46
- transform: translateY(0);
47
- }
48
- h3 {
49
- color: var(--primary-color, #4A90E2);
50
- margin-top: 0;
51
- }
52
- .onboard-brand-form {
53
- display: flex;
54
- flex-direction: column;
55
- gap: 15px;
56
- }
57
- .form-group {
58
- display: flex;
59
- flex-direction: column;
60
- }
61
- .form-group label {
62
- display: flex;
63
- align-items: center;
64
- margin-bottom: 5px;
65
- font-weight: bold;
66
- }
67
- .form-group input {
68
- padding: 10px;
69
- border: 1px solid var(--border-color, #E1E4E8);
70
- border-radius: 5px;
71
- font-size: 16px;
72
- }
73
- .tooltip {
74
- position: relative;
75
- display: inline-block;
76
- margin: 5px;
77
- }
78
- .tooltip .tooltiptext {
79
- visibility: hidden;
80
- width: 200px;
81
- background-color: #555;
82
- color: #fff;
83
- text-align: center;
84
- border-radius: 6px;
85
- padding: 5px;
86
- position: absolute;
87
- z-index: 1;
88
- bottom: 125%;
89
- left: 50%;
90
- margin-left: -100px;
91
- opacity: 0;
92
- transition: opacity 0.3s;
93
- }
94
- .tooltip:hover .tooltiptext {
95
- visibility: visible;
96
- opacity: 1;
97
- }
98
- .onboard-brand-button {
99
- background-color: var(--primary-color, #4A90E2);
100
- color: white;
101
- border: none;
102
- padding: 10px 20px;
103
- border-radius: 5px;
104
- cursor: pointer;
105
- font-size: 16px;
106
- transition: background-color 0.3s ease;
107
- }
108
- .onboard-brand-button:hover {
109
- background-color: #3a7bc8;
110
- }
111
- </style>
112
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css">
113
- </head>
114
- <div>
115
- <div class="overlay" id="overlay"></div>
116
- <div class="bottom-sheet" id="onboardBrandSheet">
117
- <h3 id="sheetTitle">Onboard New Brand</h3>
118
- <form class="onboard-brand-form" id="onboardBrandForm">
119
- <div class="form-group">
120
- <label for="brandKey">
121
- Brand Key
122
- <div class="tooltip">
123
- <i class="fas fa-question-circle question-icon"></i>
124
- <span class="tooltiptext">Brand key will be added to the brands.json and is used to identify the brand with a unique name. It must match the brand folder in brands.</span>
125
- </div>
126
- </label>
127
- <input type="text" id="brandKey" name="brandKey" required>
15
+ <head>
16
+ <style>
17
+ .overlay {
18
+ display: none;
19
+ position: fixed;
20
+ top: 0;
21
+ left: 0;
22
+ right: 0;
23
+ bottom: 0;
24
+ background-color: rgba(0, 0, 0, 0.5);
25
+ z-index: 999;
26
+ }
27
+ .bottom-sheet {
28
+ display: none;
29
+ position: fixed;
30
+ bottom: 0;
31
+ left: 0;
32
+ right: 0;
33
+ background-color: white;
34
+ border-top-left-radius: 14px;
35
+ border-top-right-radius: 14px;
36
+ box-shadow: 0 -1.4px 7px rgba(0, 0, 0, 0.1);
37
+ z-index: 1000;
38
+ padding: 14px;
39
+ transition: transform 0.3s ease-out;
40
+ transform: translateY(100%);
41
+ max-width: 490px;
42
+ margin: 0 auto;
43
+ width: 100%;
44
+ }
45
+ .bottom-sheet.show {
46
+ transform: translateY(0);
47
+ }
48
+ h3 {
49
+ color: var(--primary-color, #4A90E2);
50
+ margin-top: 0;
51
+ font-size: 15.4px;
52
+ }
53
+ .onboard-brand-form {
54
+ display: flex;
55
+ flex-direction: column;
56
+ gap: 10.5px;
57
+ }
58
+ .form-group {
59
+ display: flex;
60
+ flex-direction: column;
61
+ }
62
+ .form-group label {
63
+ display: flex;
64
+ align-items: center;
65
+ margin-bottom: 3.5px;
66
+ font-weight: bold;
67
+ font-size: 11.2px;
68
+ }
69
+ .form-group input {
70
+ padding: 7px;
71
+ border: 0.7px solid var(--border-color, #E1E4E8);
72
+ border-radius: 3.5px;
73
+ font-size: 11.2px;
74
+ }
75
+ .tooltip {
76
+ position: relative;
77
+ display: inline-block;
78
+ margin: 3.5px;
79
+ }
80
+ .tooltip .tooltiptext {
81
+ visibility: hidden;
82
+ width: 140px;
83
+ background-color: #555;
84
+ color: #fff;
85
+ text-align: center;
86
+ border-radius: 4.2px;
87
+ padding: 3.5px;
88
+ position: absolute;
89
+ z-index: 1;
90
+ bottom: 125%;
91
+ left: 50%;
92
+ margin-left: -70px;
93
+ opacity: 0;
94
+ transition: opacity 0.3s;
95
+ font-size: 9.8px;
96
+ }
97
+ .tooltip:hover .tooltiptext {
98
+ visibility: visible;
99
+ opacity: 1;
100
+ }
101
+ .onboard-brand-button {
102
+ background-color: var(--primary-color, #4A90E2);
103
+ color: white;
104
+ border: none;
105
+ padding: 7px 14px;
106
+ border-radius: 3.5px;
107
+ cursor: pointer;
108
+ font-size: 11.2px;
109
+ transition: background-color 0.3s ease;
110
+ }
111
+ .onboard-brand-button:hover {
112
+ background-color: #3a7bc8;
113
+ }
114
+ </style>
115
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css">
116
+ </head>
117
+ <div>
118
+ <div class="overlay" id="overlay"></div>
119
+ <div class="bottom-sheet" id="onboardBrandSheet">
120
+ <h3 id="sheetTitle">Onboard New Brand</h3>
121
+ <form class="onboard-brand-form" id="onboardBrandForm">
122
+ <div class="form-group">
123
+ <label for="brandKey">
124
+ Brand Key
125
+ <div class="tooltip">
126
+ <i class="fas fa-question-circle question-icon"></i>
127
+ <span class="tooltiptext">Brand key will be added to the brands.json and is used to identify the brand with a unique name. It must match the brand folder in brands.</span>
128
128
  </div>
129
- <div class="form-group">
130
- <label for="brandName">
131
- Brand Name
132
- <div class="tooltip">
133
- <i class="fas fa-question-circle question-icon"></i>
134
- <span class="tooltiptext">The brand name will be added to the brands.json and is used to identify the brand in Solara. It is not used in the actual app.</span>
135
- </div>
136
- </label>
137
- <input type="text" id="brandName" name="brandName" required>
129
+ </label>
130
+ <input type="text" id="brandKey" name="brandKey" required>
131
+ </div>
132
+ <div class="form-group">
133
+ <label for="brandName">
134
+ Brand Name
135
+ <div class="tooltip">
136
+ <i class="fas fa-question-circle question-icon"></i>
137
+ <span class="tooltiptext">The brand name will be added to the brands.json and is used to identify the brand in Solara. It is not used in the actual app.</span>
138
138
  </div>
139
- <button id="submitBtn" type="submit" class="onboard-brand-button">Onboard Brand</button>
140
- </form>
139
+ </label>
140
+ <input type="text" id="brandName" name="brandName" required>
141
141
  </div>
142
- </div>
142
+ <button id="submitBtn" type="submit" class="onboard-brand-button">Onboard Brand</button>
143
+ </form>
144
+ </div>
145
+ </div>
143
146
  `;
144
147
  }
145
148
 
@@ -81,8 +81,8 @@ class DashboardServer
81
81
  end
82
82
 
83
83
  def print_server_info
84
- Solara.logger.info("Please click the link or copy and paste it into your browser if it doesn't open automatically: http://localhost:#{@port}")
85
84
  Solara.logger.info("Server starting on http://localhost:#{@port}")
85
+ Solara.logger.info("http://localhost:#{@port} should open in your browser automatically. If it doesn't, please click it or copy and paste in you browser.")
86
86
  Solara.logger.info("Serving files from: #{@root}")
87
87
  Solara.logger.info("Press Ctrl+C to stop the server")
88
88
  end
@@ -18,7 +18,7 @@ class BrandAliasesHandler < BaseHandler
18
18
  end
19
19
 
20
20
  def get_brand_aliases
21
- AliasGeneratorManager.aliases_json
21
+ AliasManager.aliases_json
22
22
  rescue StandardError => e
23
23
  Solara.logger.failure("Error getting brand aliases: #{e.message}")
24
24
  raise
@@ -24,7 +24,7 @@ class BrandConfigurationsManager
24
24
  },
25
25
  {
26
26
  key: 'android_config.json',
27
- name: 'Android Platform Configuration',
27
+ name: 'Android Configuration',
28
28
  input_type: 'text',
29
29
  path: FilePath.android_brand_config(@brand_key)
30
30
  },
@@ -36,7 +36,7 @@ class BrandConfigurationsManager
36
36
  },
37
37
  {
38
38
  key: 'ios_config.json',
39
- name: 'iOS Platform Configuration',
39
+ name: 'iOS Configuration',
40
40
  input_type: 'text',
41
41
  path: FilePath.ios_config(@brand_key)
42
42
  },
@@ -5,7 +5,7 @@ class BrandIconHandler < BaseHandler
5
5
  brand_key = req.query['brand_key']
6
6
  filepath = FilePath.launcher_icon(brand_key)
7
7
  if File.exist?(filepath)
8
- res.body = File.read(filepath)
8
+ res.body = File.binread(filepath) # Use binread for binary files
9
9
  res['Content-Type'] = 'image/png' # Adjust as necessary
10
10
  else
11
11
  res.status = 404
@@ -20,6 +20,19 @@ class DoctorManager
20
20
  Solara.logger.end_step("Project Health Check")
21
21
  end
22
22
 
23
+ def ensure_switched
24
+ unless File.exist?(FilePath.current_brand)
25
+ message = <<-MESSAGE
26
+ It looks like you haven't switched to a brand yet!
27
+ You can open the dashboard by running 'solara dashboard' in your terminal and make the switch there.
28
+ Alternatively, you can execute 'solara switch YOUR_BRAND_KEY_HERE' in your terminal.
29
+ MESSAGE
30
+ Solara.logger.error(message)
31
+ return false
32
+ end
33
+ return true
34
+ end
35
+
23
36
  private
24
37
 
25
38
  def ensure_initialized!
@@ -31,4 +44,5 @@ class DoctorManager
31
44
  exit 1
32
45
  end
33
46
  end
34
- end
47
+
48
+ end
@@ -303,10 +303,18 @@ module FilePath
303
303
  File.join(dot_solara, 'solara_version.json')
304
304
  end
305
305
 
306
- def self.solara_aliases_sh
306
+ def self.solara_generated_aliases_unix
307
307
  File.join(ENV['HOME'], '.solara', 'aliases.sh')
308
308
  end
309
309
 
310
+ def self.solara_generated_aliases_windows_command_prompt
311
+ File.join(ENV['HOME'], '.solara', 'command_prompt_aliases.bat')
312
+ end
313
+
314
+ def self.solara_generated_aliases_powershell
315
+ File.join(ENV['HOME'], '.solara', 'powershell_aliases.ps1')
316
+ end
317
+
310
318
  def self.solara_aliases_readme
311
319
  File.join(dot_solara, 'aliases', 'README.md')
312
320
  end
@@ -8,6 +8,10 @@ class SolaraStatusManager
8
8
  end
9
9
 
10
10
  def current_brand_draft
11
+ unless DoctorManager.new.ensure_switched
12
+ return
13
+ end
14
+
11
15
  current_brand = BrandsManager.instance.current_brand
12
16
  unless current_brand
13
17
  return
@@ -8,7 +8,7 @@ class SolaraConfigurator
8
8
 
9
9
  def start
10
10
  GitignoreManager.ignore
11
- AliasGeneratorManager.new.start
11
+ AliasManager.new.start
12
12
  end
13
13
 
14
14
  end
@@ -1,3 +1,3 @@
1
1
  module Solara
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.4"
3
3
  end
data/solara/lib/solara.rb CHANGED
@@ -187,8 +187,10 @@ module Solara
187
187
  end
188
188
  end
189
189
 
190
- def check_project_health
191
- DoctorManager.new.visit_project!
190
+ def check_project_health(ensure_switched: false)
191
+ manager = DoctorManager.new
192
+ manager.visit_project!
193
+ manager.ensure_switched if ensure_switched
192
194
  end
193
195
 
194
196
  def validate_brand_key(brand_key, ignore_if_nil: false, ignore_brand_check: false, message: nil)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solara
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Malek Kamel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-24 00:00:00.000000000 Z
11
+ date: 2024-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -164,8 +164,7 @@ files:
164
164
  - solara/lib/.DS_Store
165
165
  - solara/lib/core/.DS_Store
166
166
  - solara/lib/core/aliases/alias_generator.rb
167
- - solara/lib/core/aliases/alias_generator_manager.rb
168
- - solara/lib/core/aliases/solara_terminal_setup.rb
167
+ - solara/lib/core/aliases/terminal_setup.rb
169
168
  - solara/lib/core/brands/brand_font_switcher.rb
170
169
  - solara/lib/core/brands/brand_onboarder.rb
171
170
  - solara/lib/core/brands/brand_switcher.rb
@@ -350,7 +349,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
350
349
  requirements:
351
350
  - - ">="
352
351
  - !ruby/object:Gem::Version
353
- version: '0'
352
+ version: 3.0.0
354
353
  required_rubygems_version: !ruby/object:Gem::Requirement
355
354
  requirements:
356
355
  - - ">="
@@ -1,29 +0,0 @@
1
- class AliasGeneratorManager
2
- def initialize
3
- @generator = AliasGenerator.new
4
- end
5
-
6
- def start
7
- Solara.logger.start_step("Generate terminal command aliases")
8
- common_aliases = [
9
- "solara_dashboard='solara dashboard'",
10
- "solara_doctor='solara doctor'",
11
- "solara_status='solara status'",
12
- ]
13
-
14
- @generator.add_brand_aliases(BrandsManager.instance.brands_list)
15
- @generator.add_common_aliases(common_aliases)
16
- @generator.generate_shell_file
17
- @generator.save_aliases_to_json
18
- @generator.generate_readme
19
-
20
- SolaraSetup.new.run
21
- Solara.logger.end_step("Generate terminal command aliases")
22
- end
23
-
24
- def self.aliases_json
25
- path = FilePath.solara_aliases_json
26
- JSON.parse(File.read(path))
27
- end
28
-
29
- end