Sha256: bd1595fa97d414dea480a91fcf5f9cbb3cffa9794c89d1227d73a232719f272a
Contents?: true
Size: 905 Bytes
Versions: 6
Compression:
Stored size: 905 Bytes
Contents
module FirewallHelper def self.port BrokerConfig.current_adapter_port end COMMANDS = { darwin: { setup: [ "lunchy stop rabbit" ], teardown: [ "lunchy start rabbit" ] }, linux: { setup: [ "sudo service rabbitmq-server stop" ], teardown: [ "sudo service rabbitmq-server start" ] } } def block_broker_port run_commands(:setup) @firewall_rule_set = true end def unblock_broker_port run_commands(:teardown) if @firewall_rule_set @firewall_rule_set = false end def run_commands(step) COMMANDS[os][step].each do |cmd| result = system(cmd) raise "command `#{cmd}` failed!" unless result end end def os if darwin? :darwin else :linux end end def darwin? system("uname | grep Darwin") end end World(FirewallHelper)
Version data entries
6 entries across 6 versions & 1 rubygems