lib/invoker/power/setup.rb in invoker-1.0.4 vs lib/invoker/power/setup.rb in invoker-1.1.0
- old
+ new
@@ -1,6 +1,6 @@
-require "highline/import"
+require "eventmachine"
module Invoker
module Power
class Setup
RESOLVER_FILE = "/etc/resolver/dev"
@@ -40,11 +40,11 @@
end
self
end
def uninstall_invoker
- uninstall_invoker_flag = agree("Are you sure you want to uninstall firewall rules created by setup (y/n) : ")
+ uninstall_invoker_flag = Invoker::CLI::Question.agree("Are you sure you want to uninstall firewall rules created by setup (y/n) : ")
if uninstall_invoker_flag
remove_resolver_file
unload_firewall_rule(true)
flush_dns_rules
@@ -60,10 +60,11 @@
def flush_dns_rules
system("dscacheutil -flushcache")
end
def create_config_file
+ Invoker.setup_config_location
Invoker::Power::Config.create(
dns_port: port_finder.dns_port,
http_port: port_finder.http_port
)
end
@@ -160,26 +161,27 @@
"that you uninstall pow and rerun this setup.".color(:red)
Invoker::Logger.puts "If you have already uninstalled Pow, proceed with installation"\
" by pressing y/n."
- replace_resolver_flag = agree("Replace Pow configuration (y/n) : ")
+ replace_resolver_flag = Invoker::CLI::Question.agree("Replace Pow configuration (y/n) : ")
if replace_resolver_flag
Invoker::Logger.puts "Invoker has overwritten one or more files created by Pow. "\
"If .dev domains still don't resolve locally. Try turning off the wi-fi"\
" and turning it on. It will force OSX to reload network configuration".color(:green)
end
replace_resolver_flag
end
private
+
def open_resolver_for_write
FileUtils.mkdir(RESOLVER_DIR) unless Dir.exists?(RESOLVER_DIR)
fl = File.open(RESOLVER_FILE, "w")
yield fl
ensure
- fl && fl.close()
+ fl && fl.close
end
end
end
end