Skip to content
This repository has been archived by the owner on Nov 9, 2020. It is now read-only.

Commit

Permalink
strip blank lines from deny file, plus improve editing interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Watson committed Nov 10, 2010
1 parent 6123b38 commit ca026fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion bin/noprocast
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/noprocast.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def deny_file_path

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
Expand Down

0 comments on commit ca026fd

Please sign in to comment.