strip blank lines from deny file, plus improve editing interface
This commit is contained in:
parent
6123b38a55
commit
ca026fd893
|
@ -4,7 +4,7 @@ require File.join(File.expand_path(File.dirname(__FILE__)), '..', 'lib', 'noproc
|
|||
|
||||
begin
|
||||
case ARGV.first
|
||||
when 'on'
|
||||
when 'on', 'reload'
|
||||
Noprocast.activate!
|
||||
when 'off'
|
||||
Noprocast.deactivate!
|
||||
|
@ -16,6 +16,11 @@ begin
|
|||
exit
|
||||
end
|
||||
Noprocast.edit!
|
||||
if Noprocast.active?
|
||||
puts "Saved. Now: noprocast reload"
|
||||
else
|
||||
puts "Saved. Now: noprocast on"
|
||||
end
|
||||
when 'help', '-h', '--help', nil
|
||||
puts "Usage: [sudo] noprocast [on|off|status|edit]"
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ class Noprocast
|
|||
|
||||
def current_hosts
|
||||
setup_deny_file_if_required!
|
||||
File.read(deny_file_path).split(/\n/).map(&:strip)
|
||||
File.read(deny_file_path).split(/\n/).select { |line| line.match(/[a-zA-Z0-9]/) }.map(&:strip)
|
||||
end
|
||||
|
||||
def hosts_file_content
|
||||
|
|
Loading…
Reference in New Issue