Class: Hoof::Cli
Instance Method Summary collapse
- #init(name = nil) ⇒ Object
- #restart ⇒ Object
- #route ⇒ Object
- #start ⇒ Object
- #status ⇒ Object
- #stop ⇒ Object
- #unroute ⇒ Object
Instance Method Details
#init(name = nil) ⇒ Object
33 34 35 36 37 |
# File 'lib/hoof/cli.rb', line 33 def init name = nil name ||= File.basename Dir.getwd create_link File.(File.join("~/.hoof", name)), '.' append_to_file 'Gemfile', "\ngem 'unicorn'" end |
#restart ⇒ Object
22 23 24 |
# File 'lib/hoof/cli.rb', line 22 def restart daemon 'restart' end |
#route ⇒ Object
45 46 47 48 49 50 |
# File 'lib/hoof/cli.rb', line 45 def route exec <<-E sudo iptables -t nat -I OUTPUT --source 0/0 --destination 127.0.0.1 -p tcp --dport 80 -j REDIRECT --to-ports #{Hoof.http_port} && sudo iptables -t nat -I OUTPUT --source 0/0 --destination 127.0.0.1 -p tcp --dport 443 -j REDIRECT --to-ports #{Hoof.https_port} E end |
#start ⇒ Object
12 13 14 |
# File 'lib/hoof/cli.rb', line 12 def start daemon 'start' end |
#status ⇒ Object
40 41 42 |
# File 'lib/hoof/cli.rb', line 40 def status control 'status' end |
#stop ⇒ Object
17 18 19 |
# File 'lib/hoof/cli.rb', line 17 def stop daemon 'stop' end |
#unroute ⇒ Object
53 54 55 56 57 58 |
# File 'lib/hoof/cli.rb', line 53 def unroute exec <<-E sudo iptables -t nat -D OUTPUT --source 0/0 --destination 127.0.0.1 -p tcp --dport 80 -j REDIRECT --to-ports #{Hoof.http_port} && sudo iptables -t nat -D OUTPUT --source 0/0 --destination 127.0.0.1 -p tcp --dport 443 -j REDIRECT --to-ports #{Hoof.https_port} E end |