Class: RCS::Common::WinFirewall::Advfirewall
- Inherits:
-
Object
- Object
- RCS::Common::WinFirewall::Advfirewall
- Extended by:
- Tracer
- Defined in:
- lib/rcs-common/winfirewall.rb
Constant Summary
Constants included from Tracer
Class Method Summary collapse
- .call(command, read: false) ⇒ Object
-
.exists? ⇒ Boolean
Return true if the current os is Windows.
Methods included from Tracer
thread_name, trace, trace_ensure_log_folders, trace_init, trace_named_put, trace_named_remove, trace_nested_pop, trace_nested_push, trace_setup
Class Method Details
.call(command, read: false) ⇒ Object
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/rcs-common/winfirewall.rb', line 155 def self.call(command, read: false) command = "netsh advfirewall #{command.strip}" unless exists? raise "The Windows Firewall is missing. You cannot call the command #{command.inspect} on this OS." end #trace(:debug, "[Advfirewall] #{command}") if read resp = AdvfirewallResponse.new(`#{command}`) trace(:debug, "[Advfirewall] #{resp}") unless resp.ok? resp else resp = AdvfirewallResponse.new resp.ok = system(command) resp end end |
.exists? ⇒ Boolean
Return true if the current os is Windows
151 152 153 |
# File 'lib/rcs-common/winfirewall.rb', line 151 def self.exists? @firewall_exists ||= (RbConfig::CONFIG['host_os'] =~ /mingw/i) end |