solara 0.2.2 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf4626fe23d16f245e1e77267bf23f3b368cd4bb2fd286cb038a73f52f7f6b65
4
- data.tar.gz: a4bbc04dfe9844532227f16283c4c3b7cf86450a21a75b01a479a88be8021c82
3
+ metadata.gz: 3569c89fbad4ec23d107130f47962dc637776fd22eddea41671ce884b4ec0f84
4
+ data.tar.gz: f02d2e5812438e81be770a3a45851b631dd9e1bcd2a190a7a0c36ad7d539cfc9
5
5
  SHA512:
6
- metadata.gz: c490881fbbcf873cb1fae33bcad4f25989cff5196ff70d0494238e2640cd39d68089512fe940590863d633494528755ee6dd4024d05d58f379c503cdd499b3ac
7
- data.tar.gz: bcebb36d901d66ea8f184f480fcceb3c8472d35424432ea43d0a42b153409ff500f968626c32f507011f012194b5277f2defab8ce52c25064730ae2cccdc07eb
6
+ metadata.gz: a877b5a58528e138d5b1f40958eb1fc015c2c0ecddc2d4f7a5c2db26e781e5a49aa065e9dd4c475d2ce14211399592dc3400c92f6fe50704d2b1e26c7b0cfc73
7
+ data.tar.gz: 39bfd976632d87ef961de7a51f4cf12440a6e39900025bf3287efe7f302f9628967477743fabbb9398caf3b29c23b74d2305c4fdba5baed917af59ce0d9b505e
data/bin/solara CHANGED
@@ -3,8 +3,8 @@
3
3
 
4
4
  require 'solara'
5
5
 
6
- if RUBY_VERSION < '2.0.0'
7
- abort("Solara requires Ruby 2.0.0 or higher")
6
+ if RUBY_VERSION < '3.0.0'
7
+ abort("Solara requires Ruby 3.0.0 or higher")
8
8
  end
9
9
 
10
10
  Dir.glob("#{__dir__}/core/scripts/*.rb").each { |file| require file }
@@ -1,63 +1,199 @@
1
1
  Dir[File.expand_path('../scripts/*.rb', __dir__)].each { |file| require_relative file }
2
+
2
3
  require 'json'
4
+ require 'rbconfig'
3
5
 
4
- class AliasGenerator
6
+ class AliasManager
5
7
  def initialize
6
- @output_file = FilePath.solara_aliases_sh
7
- FileManager.create_file_if_not_exist(@output_file)
8
+ case RbConfig::CONFIG['host_os']
9
+ when /mswin|mingw|cygwin/
10
+ @generator = WindowsAliasGenerator.new
11
+ when /darwin|mac os|linux/
12
+ @generator = UnixAliasGenerator.new
13
+ else
14
+ Solara.logger.fatal("Unsupported operating system. Aliases can't be generated.")
15
+ end
16
+ end
8
17
 
9
- @readme_file = FilePath.solara_aliases_readme
10
- FileManager.create_file_if_not_exist(@readme_file)
18
+ def start
19
+ Solara.logger.start_step("Generate terminal command aliases")
20
+ add_brand_aliases(BrandsManager.instance.brands_list)
11
21
 
12
- @json_file = FilePath.solara_aliases_json
13
- FileManager.create_file_if_not_exist(@json_file)
22
+ common_aliases =
23
+ [
24
+ ["solara_dashboard", "bundle exec solara dashboard"],
25
+ ["solara_doctor", "bundle exec solara doctor"],
26
+ ["solara_status", "bundle exec solara status"],
27
+ ]
28
+ add_common_aliases(common_aliases)
14
29
 
30
+ generate
31
+ save_aliases_to_json
32
+ generate_readme
33
+
34
+ TerminalSetup.new.run
35
+
36
+ Solara.logger.end_step("Generate terminal command aliases")
37
+ end
38
+
39
+ private
40
+
41
+ def add_brand_aliases(brands)
42
+ @generator.add_brand_aliases(brands)
43
+ end
44
+
45
+ def add_common_aliases(common_aliases)
46
+ @generator.add_common_aliases(common_aliases)
47
+ end
48
+
49
+ def generate
50
+ @generator.generate
51
+ end
52
+
53
+ def generate_readme
54
+ @generator.generate_readme
55
+ end
56
+
57
+ def save_aliases_to_json
58
+ @generator.save_aliases_to_json
59
+ end
60
+
61
+ def self.aliases_json
62
+ path = FilePath.solara_aliases_json
63
+ JSON.parse(File.read(path))
64
+ end
65
+
66
+ private
67
+
68
+ def windows?
69
+
70
+ # Check for Windows OS
71
+ !!(RUBY_PLATFORM =~ /mingw|mswin/)
72
+ end
73
+ end
74
+
75
+ class AliasGenerator
76
+ def initialize
15
77
  @brand_aliases = {}
16
78
  @common_aliases = []
17
79
  end
18
80
 
19
81
  def add_brand_aliases(brands)
20
82
  alias_templates = [
21
- "solara_export_{brand_key}='solara export --brand_keys {brand_key}'",
22
- "solara_offboard_{brand_key}='solara offboard -k {brand_key}'",
23
- "solara_switch_{brand_key}='solara switch -k {brand_key}'",
24
- "solara_doctor_{brand_key}='solara doctor -k {brand_key}'",
25
- "solara_dashboard_{brand_key}='solara dashboard -k {brand_key}'"
83
+ ["solara_export_{brand_key}", "bundle exec solara export --brand_keys {brand_key}"],
84
+ ["solara_offboard_{brand_key}", "bundle exec solara offboard -k {brand_key}"],
85
+ ["solara_switch_{brand_key}", "bundle exec solara switch -k {brand_key}"],
86
+ ["solara_doctor_{brand_key}", "bundle exec solara doctor -k {brand_key}"],
87
+ ["solara_dashboard_{brand_key}", "bundle exec solara dashboard -k {brand_key}"]
26
88
  ]
27
89
 
28
90
  brands.each do |app|
29
91
  brand_key = app['key']
30
92
  @brand_aliases[brand_key] = []
31
- alias_templates.each do |template|
32
- alias_line = template.gsub('{brand_key}', brand_key)
33
- @brand_aliases[brand_key] << "alias #{alias_line}"
93
+ alias_templates.each do |alias_name, command|
94
+ alias_name = alias_name.gsub('{brand_key}', brand_key)
95
+ command = command.gsub('{brand_key}', brand_key)
96
+ @brand_aliases[brand_key] << [alias_name, command]
34
97
  end
35
98
  end
36
99
  end
37
100
 
38
101
  def add_common_aliases(common_aliases)
39
- @common_aliases = common_aliases.map { |alias_line| "alias #{alias_line}" }
102
+ @common_aliases = common_aliases
103
+ end
104
+
105
+ def generate_readme
106
+ File.open(@readme_file, 'w') do |file|
107
+ file.puts "# Aliases"
108
+ file.puts
109
+ file.puts "This document provides an overview of all available aliases."
110
+ file.puts
111
+
112
+ if @common_aliases.any?
113
+ file.puts "## Common Aliases"
114
+ file.puts
115
+ @common_aliases.each do |value|
116
+ file.puts "- `#{value[0]}`: `#{value[1]}`"
117
+ end
118
+ end
119
+
120
+ file.puts
121
+
122
+ @brand_aliases.each do |brand_name, brand_aliases|
123
+ file.puts "## #{brand_name}"
124
+ file.puts
125
+ brand_aliases.each do |alias_name, command|
126
+ file.puts "- `#{alias_name}`: `#{command}`"
127
+ end
128
+ file.puts
129
+ end
130
+ end
131
+ Solara.logger.debug("README.md has been generated in #{@readme_file}")
132
+ end
133
+
134
+ def save_aliases_to_json
135
+ json_data = {
136
+ "common_aliases" => @common_aliases,
137
+ "brand_aliases" => @brand_aliases
138
+ }
139
+
140
+ File.open(@json_file, 'w') do |file|
141
+ file.puts JSON.pretty_generate(json_data)
142
+ end
143
+ Solara.logger.debug("Aliases have been saved in JSON format in #{@json_file}")
144
+ end
145
+ end
146
+
147
+ class UnixAliasGenerator < AliasGenerator
148
+ def initialize
149
+ super()
150
+ @output_file = FilePath.solara_generated_aliases_unix
151
+ @readme_file = FilePath.solara_aliases_readme
152
+ @json_file = FilePath.solara_aliases_json
153
+ FileManager.create_file_if_not_exist(@output_file)
154
+ FileManager.create_file_if_not_exist(@readme_file)
155
+ FileManager.create_file_if_not_exist(@json_file)
40
156
  end
41
157
 
42
- def generate_shell_file
158
+ def generate
43
159
  existing_content = File.exist?(@output_file) ? File.read(@output_file) : ""
44
160
  new_content = []
45
161
 
46
162
  new_content << "#!/bin/bash" if existing_content.empty?
47
163
 
164
+ add_common_aliases_to_file(existing_content, new_content)
165
+ add_brand_aliases_to_file(existing_content, new_content)
166
+
167
+ if new_content.any? && !(new_content.size == 1 && new_content.first == "#!/bin/bash")
168
+ File.open(@output_file, 'a') do |file|
169
+ file.puts new_content
170
+ end
171
+ Solara.logger.debug("Unix aliases have been appended to #{@output_file}")
172
+ else
173
+ Solara.logger.debug("No new Unix aliases to add to #{@output_file}")
174
+ end
175
+ end
176
+
177
+ private
178
+
179
+ def add_common_aliases_to_file(existing_content, new_content)
48
180
  common_aliases_added = false
49
- @common_aliases.each do |alias_line|
181
+ @common_aliases.each do |value|
182
+ alias_line = "alias #{value[0]}='#{value[1]}'"
50
183
  unless existing_content.include?(alias_line)
51
184
  new_content << "# Common Aliases" unless common_aliases_added
52
185
  common_aliases_added = true
53
186
  new_content << alias_line
54
187
  end
55
188
  end
189
+ end
56
190
 
191
+ def add_brand_aliases_to_file(existing_content, new_content)
57
192
  brand_aliases_added = false
58
193
  @brand_aliases.each do |brand_name, brand_aliases|
59
194
  brand_aliases_for_this_brand_added = false
60
- brand_aliases.each do |alias_line|
195
+ brand_aliases.each do |alias_name, command|
196
+ alias_line = "alias #{alias_name}='#{command}'"
61
197
  unless existing_content.include?(alias_line)
62
198
  unless brand_aliases_added
63
199
  brand_aliases_added = true
@@ -71,59 +207,97 @@ class AliasGenerator
71
207
  end
72
208
  end
73
209
  end
74
-
75
210
  new_content.reject!(&:empty?) if new_content.size == 1
211
+ end
212
+ end
76
213
 
77
- if new_content.any? && !(new_content.size == 1 && new_content.first == "#!/bin/bash")
78
- File.open(@output_file, 'a') do |file|
214
+ class WindowsAliasGenerator < AliasGenerator
215
+ def initialize
216
+ super()
217
+ @cmd_output_file = FilePath.solara_generated_aliases_windows_command_prompt
218
+ @ps_output_file = FilePath.solara_generated_aliases_powershell
219
+ @readme_file = FilePath.solara_aliases_readme
220
+ @json_file = FilePath.solara_aliases_json
221
+ FileManager.create_file_if_not_exist(@cmd_output_file)
222
+ FileManager.create_file_if_not_exist(@ps_output_file)
223
+ FileManager.create_file_if_not_exist(@readme_file)
224
+ FileManager.create_file_if_not_exist(@json_file)
225
+ end
226
+
227
+ def generate
228
+ generate_cmd_file
229
+ generate_powershell_file
230
+ end
231
+
232
+ private
233
+
234
+ def generate_cmd_file
235
+ existing_content = File.exist?(@cmd_output_file) ? File.read(@cmd_output_file) : ""
236
+ new_content = []
237
+
238
+ new_content << "@echo off" if existing_content.empty?
239
+
240
+ add_common_aliases_to_file(existing_content, new_content, :cmd)
241
+ add_brand_aliases_to_file(existing_content, new_content, :cmd)
242
+
243
+ if new_content.any? && !(new_content.size == 1 && new_content.first == "@echo off")
244
+ File.open(@cmd_output_file, 'a') do |file|
79
245
  file.puts new_content
80
246
  end
81
- Solara.logger.debug("Aliases have been appended to #{@output_file}")
247
+ Solara.logger.debug("Windows Command Prompt aliases have been appended to #{@cmd_output_file}")
82
248
  else
83
- Solara.logger.debug("No new aliases to add to #{@output_file}")
249
+ Solara.logger.debug("No new Windows Command Prompt aliases to add to #{@cmd_output_file}")
84
250
  end
85
251
  end
86
252
 
87
- def generate_readme
88
- File.open(@readme_file, 'w') do |file|
89
- file.puts "# Aliases"
90
- file.puts
91
- file.puts "This document provides an overview of all available aliases."
92
- file.puts
93
-
94
- if @common_aliases.any?
95
- file.puts "## Common Aliases"
96
- file.puts
97
- @common_aliases.each do |alias_line|
98
- alias_name = alias_line.split('=').first.strip.gsub('alias ', '')
99
- file.puts "- `#{alias_name}`"
100
- end
101
- end
253
+ def generate_powershell_file
254
+ existing_content = File.exist?(@ps_output_file) ? File.read(@ps_output_file) : ""
255
+ new_content = []
102
256
 
103
- file.puts
257
+ add_common_aliases_to_file(existing_content, new_content, :powershell)
258
+ add_brand_aliases_to_file(existing_content, new_content, :powershell)
104
259
 
105
- file.puts
106
- @brand_aliases.each do |brand_name, brand_aliases|
107
- file.puts "## #{brand_name}"
108
- file.puts
109
- brand_aliases.each do |alias_line|
110
- alias_name = alias_line.split('=').first.strip.gsub('alias ', '')
111
- file.puts "- `#{alias_name}`"
112
- end
260
+ if new_content.any?
261
+ File.open(@ps_output_file, 'a') do |file|
262
+ file.puts new_content
113
263
  end
264
+ Solara.logger.debug("PowerShell aliases have been appended to #{@ps_output_file}")
265
+ else
266
+ Solara.logger.debug("No new PowerShell aliases to add to #{@ps_output_file}")
114
267
  end
115
- Solara.logger.debug("README.md has been generated in #{@readme_file}")
116
268
  end
117
269
 
118
- def save_aliases_to_json
119
- json_data = {
120
- "common_aliases" => @common_aliases,
121
- "brand_aliases" => @brand_aliases
122
- }
270
+ def add_common_aliases_to_file(existing_content, new_content, shell_type)
271
+ common_aliases_added = false
272
+ @common_aliases.each do |alias_name, command|
273
+ alias_line = shell_type == :cmd ? "doskey #{alias_name}=#{command} $*" : "function #{alias_name} { & #{command} }"
274
+ unless existing_content.include?(alias_line)
275
+ new_content << (shell_type == :cmd ? "REM Common Aliases" : "# Common Aliases") unless common_aliases_added
276
+ common_aliases_added = true
277
+ new_content << alias_line
278
+ end
279
+ end
280
+ end
123
281
 
124
- File.open(@json_file, 'w') do |file|
125
- file.puts JSON.pretty_generate(json_data)
282
+ def add_brand_aliases_to_file(existing_content, new_content, shell_type)
283
+ brand_aliases_added = false
284
+ @brand_aliases.each do |brand_name, brand_aliases|
285
+ brand_aliases_for_this_brand_added = false
286
+ brand_aliases.each do |alias_name, command|
287
+ alias_line = shell_type == :cmd ? "doskey #{alias_name}=#{command} $*" : "function #{alias_name} { & #{command} }"
288
+ unless existing_content.include?(alias_line)
289
+ unless brand_aliases_added
290
+ brand_aliases_added = true
291
+ end
292
+ unless brand_aliases_for_this_brand_added
293
+ new_content << "" # Add a new line before each brand name
294
+ new_content << (shell_type == :cmd ? "REM #{brand_name}" : "# #{brand_name}")
295
+ brand_aliases_for_this_brand_added = true
296
+ end
297
+ new_content << alias_line
298
+ end
299
+ end
126
300
  end
127
- Solara.logger.debug("Aliases have been saved in JSON format in #{@json_file}")
301
+ new_content.reject!(&:empty?) if new_content.size == 1
128
302
  end
129
303
  end
@@ -5,26 +5,21 @@ Dir.glob("../scripts/*.rb").each { |file| require file }
5
5
  require 'fileutils'
6
6
  require 'rbconfig'
7
7
 
8
- class SolaraSetup
8
+ class TerminalSetup
9
9
  def initialize
10
- @aliases_file = FilePath.solara_aliases_sh
11
10
  @setup_dir = File.join(ENV['HOME'], '.solara')
12
- @unix_setup_file = File.join(@setup_dir, 'setup.sh')
13
- @windows_setup_file = File.join(@setup_dir, 'setup.bat')
14
11
  end
15
12
 
16
13
  def run
17
14
  create_setup_directory
18
- create_unix_setup_script
19
- create_windows_setup_script
20
-
15
+
21
16
  case RbConfig::CONFIG['host_os']
22
17
  when /mswin|mingw|cygwin/
23
- setup_windows
18
+ WindowsTerminalSetup.new(@setup_dir).run
24
19
  when /darwin|mac os|linux/
25
- setup_unix
20
+ UnixTerminalSetup.new(@setup_dir).run
26
21
  else
27
- Solara.logger.fatal("Unsupported operating system. Please set up manually.")
22
+ Solara.logger.fatal("Unsupported operating system. Please set up the terminal manually.")
28
23
  end
29
24
  end
30
25
 
@@ -33,26 +28,31 @@ class SolaraSetup
33
28
  def create_setup_directory
34
29
  FileUtils.mkdir_p(@setup_dir)
35
30
  end
31
+ end
32
+
33
+ class UnixTerminalSetup
34
+ def initialize(setup_dir)
35
+ @aliases_file_unix = FilePath.solara_generated_aliases_unix
36
+ @unix_setup_file = File.join(setup_dir, 'setup.sh')
37
+ end
38
+
39
+ def run
40
+ create_unix_setup_script
41
+ setup_unix
42
+ end
43
+
44
+ private
36
45
 
37
46
  def create_unix_setup_script
38
47
  File.open(@unix_setup_file, 'w') do |file|
39
48
  file.puts <<~SCRIPT
40
49
  #!/bin/bash
41
- source "#{@aliases_file}"
50
+ source "#{@aliases_file_unix}"
42
51
  SCRIPT
43
52
  end
44
53
  FileUtils.chmod(0755, @unix_setup_file)
45
54
  end
46
55
 
47
- def create_windows_setup_script
48
- File.open(@windows_setup_file, 'w') do |file|
49
- file.puts <<~SCRIPT
50
- @echo off
51
- call "#{@aliases_file.gsub('/', '\\')}"
52
- SCRIPT
53
- end
54
- end
55
-
56
56
  def setup_unix
57
57
  shell_config_file = determine_shell_config_file
58
58
  setup_line = "source #{@unix_setup_file}"
@@ -75,29 +75,64 @@ class SolaraSetup
75
75
  end
76
76
  end
77
77
 
78
- def setup_windows
78
+ def determine_shell_config_file
79
+ if ENV['SHELL'] =~ /zsh/
80
+ File.expand_path('~/.zshrc')
81
+ elsif ENV['SHELL'] =~ /bash/
82
+ File.expand_path('~/.bashrc')
83
+ else
84
+ File.expand_path('~/.profile')
85
+ end
86
+ end
87
+ end
88
+
89
+ class WindowsTerminalSetup
90
+ def initialize(setup_dir)
91
+ end
92
+
93
+ def run
94
+ setup_command_prompt
95
+ setup_powershell
96
+ end
97
+
98
+ private
99
+
100
+ def setup_command_prompt
79
101
  require 'win32/registry'
102
+ setup_file = FilePath.solara_generated_aliases_windows_command_prompt
80
103
 
81
104
  begin
82
105
  Win32::Registry::HKEY_CURRENT_USER.create('Software\Microsoft\Command Processor') do |reg|
83
- reg['AutoRun', Win32::Registry::REG_EXPAND_SZ] = @windows_setup_file
106
+ reg['AutoRun', Win32::Registry::REG_EXPAND_SZ] = setup_file
84
107
  end
85
- Solara.logger.success("Windows AutoRun registry key set up successfully.")
86
- Solara.logger.warn("Please restart your Command Prompt to apply changes.")
108
+ Solara.logger.debug("Windows AutoRun registry key set up successfully.")
109
+ Solara.logger.debug("Please restart your Command Prompt to apply changes.")
87
110
  rescue Win32::Registry::Error => e
88
- Solara.logger.failure("Failed to set up Windows registry: #{e.message}")
111
+ Solara.logger.failure("Failed to set up Windows registry: #{e.class} - #{e.message}")
89
112
  Solara.logger.failure("Please add the following file path to your AutoRun registry key manually:")
90
- Solara.logger.failure(@windows_setup_file)
113
+ Solara.logger.failure(setup_file)
91
114
  end
92
115
  end
93
116
 
94
- def determine_shell_config_file
95
- if ENV['SHELL'] =~ /zsh/
96
- File.expand_path('~/.zshrc')
97
- elsif ENV['SHELL'] =~ /bash/
98
- File.expand_path('~/.bashrc')
99
- else
100
- File.expand_path('~/.profile')
117
+ def setup_powershell_
118
+ require 'win32/registry'
119
+ setup_file = FilePath.solara_generated_aliases_powershell
120
+
121
+ begin
122
+ # This path targets all versions of PowerShell
123
+ Win32::Registry::HKEY_CURRENT_USER.create('Software\Microsoft\PowerShell\PowerShellEngine') do |reg|
124
+ reg['AutoRun', Win32::Registry::REG_EXPAND_SZ] = setup_file
125
+ end
126
+ Solara.logger.debug("PowerShell AutoRun registry key set up successfully.")
127
+ Solara.logger.debug("Please restart your PowerShell to apply changes.")
128
+ rescue Win32::Registry::Error => e
129
+ Solara.logger.failure("Failed to set up PowerShell registry: #{e.class} - #{e.message}")
130
+ Solara.logger.failure("Please add the following file path to your PowerShell AutoRun registry key manually:")
131
+ Solara.logger.failure(setup_file)
101
132
  end
102
133
  end
103
- end
134
+
135
+ def setup_powershell
136
+ # Not supported at the moment
137
+ end
138
+ end
@@ -55,11 +55,23 @@ class BrandsManager
55
55
  end
56
56
  end
57
57
 
58
+ def has_current_brand
59
+ value = File.exist?(FilePath.current_brand)
60
+ Solara.logger.debug("No current brand!") unless value
61
+ value
62
+ end
63
+
58
64
  def current_brand
65
+ unless has_current_brand
66
+ return nil
67
+ end
59
68
  JSON.parse(File.read(FilePath.current_brand))
60
69
  end
61
70
 
62
71
  def set_current_brand_content_changed(brand_key, changed)
72
+ unless has_current_brand
73
+ return nil
74
+ end
63
75
  unless is_current_brand(brand_key)
64
76
  return false
65
77
  end
@@ -71,6 +83,9 @@ class BrandsManager
71
83
  end
72
84
 
73
85
  def is_current_brand(brand_key)
86
+ unless has_current_brand
87
+ return false
88
+ end
74
89
  current_brand['key'] == brand_key
75
90
  end
76
91
 
@@ -237,6 +237,7 @@ class BrandDetailView {
237
237
  showApplyChangesButton() {
238
238
  const applyChangesButton = document.getElementById('applyChangesButton');
239
239
  applyChangesButton.style.display = 'block';
240
+ this.header.style.backgroundColor = '#ff4136';
240
241
  }
241
242
 
242
243
  showSwitchButton() {