Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Peak
peak
Commits
ddbd0dca
Commit
ddbd0dca
authored
Oct 05, 2016
by
Jeffrey Phillips Freeman
💥
Browse files
Added some error output for when configuration fails.
parent
ea50af5f
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/peak.rb
View file @
ddbd0dca
...
...
@@ -6,7 +6,16 @@ module Peak
def
self
.
main
config
=
find_config
(
true
)
unless
config
echo_colorized_error
(
'Could not find a valid configuration file in any of the default locations'
)
return
end
port_map
=
init_port_map
(
config
)
unless
port_map
echo_colorized_error
(
'Configuration could not be loaded, format was invalid.'
)
return
end
active_plugins
=
{}
plugins
=
load_plugins
...
...
lib/peak/config_loader.rb
View file @
ddbd0dca
...
...
@@ -41,7 +41,7 @@ module Peak
tnc_name
=
section_name
.
strip
.
split
(
' '
)[
1
].
strip
if
tnc_name
==
'IGATE'
echo_colorized_error
(
'IGATE was used as the name for a TNC in the configuration, this name is reserved'
)
return
false
return
nil
end
kiss_tnc
=
nil
...
...
@@ -50,7 +50,7 @@ module Peak
baud
=
section_content
[
'baud'
]
kiss_tnc
=
Apex
::
AprsKiss
.
new
(
Kiss
::
KissSerial
.
new
(
com_port
,
baud
))
else
return
false
return
nil
end
if
section_content
.
key?
(
'kiss_init'
)
...
...
@@ -63,14 +63,14 @@ module Peak
kiss_tnc
.
connect
else
echo_colorized_error
(
'Invalid configuration, value assigned to kiss_init was not recognized: '
+
kiss_init_string
)
return
false
return
nil
end
else
kiss_tnc
.
connect
end
unless
config_lookup_enforce
(
section_content
,
'port_count'
)
return
false
return
nil
end
port_count
=
section_content
[
'port_count'
]
...
...
@@ -80,22 +80,22 @@ module Peak
port_section_name
=
'PORT '
+
port_name
unless
config_lookup_enforce
(
config
,
port_section_name
)
return
false
return
nil
end
port_section
=
config
[
port_section_name
]
unless
config_lookup_enforce
(
port_section
,
'identifier'
)
return
false
return
nil
end
port_identifier
=
port_section
[
'identifier'
]
unless
config_lookup_enforce
(
port_section
,
'net'
)
return
false
return
nil
end
port_net
=
port_section
[
'net'
]
unless
config_lookup_enforce
(
port_section
,
'tnc_port'
)
return
false
return
nil
end
tnc_port
=
port_section
[
'tnc_port'
]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment