solara 0.2.1 → 0.2.3
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.
- checksums.yaml +4 -4
- data/solara/lib/core/aliases/alias_generator.rb +231 -57
- data/solara/lib/core/aliases/{solara_terminal_setup.rb → terminal_setup.rb} +69 -34
- data/solara/lib/core/brands/brands_manager.rb +15 -0
- data/solara/lib/core/dashboard/brand/BrandDetailView.js +1 -0
- data/solara/lib/core/dashboard/brand/brand.html +131 -132
- data/solara/lib/core/dashboard/brand/source/BrandRemoteSource.js +4 -4
- data/solara/lib/core/dashboard/brands/brands.html +79 -79
- data/solara/lib/core/dashboard/component/AddFieldSheet.js +105 -142
- data/solara/lib/core/dashboard/component/AliasesBottomSheet.js +85 -79
- data/solara/lib/core/dashboard/component/BrandOptionsBottomSheet.js +68 -67
- data/solara/lib/core/dashboard/component/ConfirmationDialog.js +66 -64
- data/solara/lib/core/dashboard/component/MessageBottomSheet.js +48 -48
- data/solara/lib/core/dashboard/component/OnboardBrandBottomSheet.js +128 -125
- data/solara/lib/core/dashboard/dashboard_server.rb +12 -5
- data/solara/lib/core/dashboard/handler/brand_alisases_handler.rb +1 -1
- data/solara/lib/core/dashboard/handler/brand_configurations_manager.rb +2 -2
- data/solara/lib/core/dashboard/handler/brand_icon_handler.rb +1 -1
- data/solara/lib/core/doctor/doctor_manager.rb +15 -1
- data/solara/lib/core/scripts/file_path.rb +9 -1
- data/solara/lib/core/scripts/solara_status_manager.rb +4 -0
- data/solara/lib/core/solara_configurator.rb +1 -1
- data/solara/lib/solara/version.rb +1 -1
- data/solara/lib/solara.rb +4 -2
- metadata +4 -5
- 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
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
<
|
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
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
<
|
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
|
-
|
140
|
-
|
139
|
+
</label>
|
140
|
+
<input type="text" id="brandName" name="brandName" required>
|
141
141
|
</div>
|
142
|
-
|
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
|
|
@@ -28,7 +28,7 @@ class DashboardServer
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def shutdown
|
31
|
-
Solara.logger.
|
31
|
+
Solara.logger.info("Shutting down server...")
|
32
32
|
@server.shutdown if @server
|
33
33
|
end
|
34
34
|
|
@@ -81,9 +81,10 @@ class DashboardServer
|
|
81
81
|
end
|
82
82
|
|
83
83
|
def print_server_info
|
84
|
-
Solara.logger.
|
85
|
-
Solara.logger.
|
86
|
-
Solara.logger.
|
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
|
+
Solara.logger.info("Serving files from: #{@root}")
|
87
|
+
Solara.logger.info("Press Ctrl+C to stop the server")
|
87
88
|
end
|
88
89
|
|
89
90
|
def start_server
|
@@ -104,7 +105,13 @@ class DashboardServer
|
|
104
105
|
when /darwin/
|
105
106
|
system "/usr/bin/open", url
|
106
107
|
when /linux/
|
107
|
-
|
108
|
+
# Check if we're in WSL
|
109
|
+
if File.exist?('/proc/version') && File.read('/proc/version').include?('Microsoft')
|
110
|
+
# Use the Windows start command to open in WSL
|
111
|
+
system "cmd.exe", "/c", "start", url
|
112
|
+
else
|
113
|
+
system "/usr/bin/xdg-open", url
|
114
|
+
end
|
108
115
|
when /mswin|mingw|cygwin/
|
109
116
|
system "start", url
|
110
117
|
end
|
@@ -24,7 +24,7 @@ class BrandConfigurationsManager
|
|
24
24
|
},
|
25
25
|
{
|
26
26
|
key: 'android_config.json',
|
27
|
-
name: 'Android
|
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
|
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.
|
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
|
-
|
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.
|
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
|
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
|
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.
|
4
|
+
version: 0.2.3
|
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-
|
11
|
+
date: 2024-09-26 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/
|
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:
|
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
|