From ca026fd893292454be64e377b904af58ccda4e7a Mon Sep 17 00:00:00 2001 From: Rob Watson Date: Wed, 10 Nov 2010 15:36:12 +0000 Subject: [PATCH] strip blank lines from deny file, plus improve editing interface --- bin/noprocast | 7 ++++++- lib/noprocast.rb | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/noprocast b/bin/noprocast index 58e0b95..f549de7 100644 --- a/bin/noprocast +++ b/bin/noprocast @@ -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 diff --git a/lib/noprocast.rb b/lib/noprocast.rb index 2be04b9..16ac85f 100644 --- a/lib/noprocast.rb +++ b/lib/noprocast.rb @@ -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