Created
August 8, 2014 09:20
-
-
Save tsyber1an/6f456c014c6d496c1e8d to your computer and use it in GitHub Desktop.
Using shoes UI lib i build the app manager tool to control my custom development apps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "shoes" | |
Shoes.app do | |
@result = {} | |
[ | |
{name: "[r]abbitmq-server", start: '/usr/local/sbin/rabbitmq-server', stop: '/usr/local/sbin/rabbitmqctl stop'}, | |
{name: "[r]edis-server", start: '/usr/local/bin/redis-server', stop: "kill $(ps aux | grep '[r]edis-server' | awk '{print $2}')"}, | |
{name: 'mongodb', start: '/usr/local/bin/mongod --config /usr/local/etc/mongod.conf --fork', stop: "kill $(ps aux | grep '[m]ongod' | awk '{print $2}')"}, | |
{name: 'mysql', start: '/usr/local/bin/mysql.server start', stop: "/usr/local/bin/mysql.server stop"}, | |
{name: 'cassandra', start: '/usr/local/bin/cassandra', stop: "kill $(ps aux | grep '[c]assandra' | awk '{print $2}')"} | |
].each do |app| | |
flow do | |
para strong(app[:name]) | |
@start = button("Start"){ | |
system("#{app[:start]} </dev/null & >/dev/null &") | |
@result[app[:name]].replace("Status: started") | |
} | |
@stop = button("Stop"){ | |
system(app[:stop]) | |
@result[app[:name]].replace("Status: stoped") | |
} | |
end | |
@result[app[:name]] = para "Status:" | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment