strip blank lines from deny file, plus improve editing interface

This commit is contained in:
Rob Watson 2010-11-10 15:36:12 +00:00
parent 6123b38a55
commit ca026fd893
2 changed files with 7 additions and 2 deletions

View File

@ -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

View File

@ -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