class RailsPwnerer::Executor
Public Instance Methods
run(args)
click to toggle source
standalone runner
# File lib/rails_pwnerer/executor.rb 7 def run(args) 8 case args[0] 9 when 'scaffold', 'den00b' 10 case args[1] 11 when 'config' 12 Config.go 13 when 'dirs' 14 Dirs.go 15 when 'dirs2' 16 DirPermissions.go 17 when 'gems' 18 Gems.go 19 when 'daemon' 20 HookDaemon.go 21 when 'mysql' 22 MysqlConfig.go 23 when 'packages' 24 Packages.go 25 when 'rubygems' 26 RubyGems.pre_go 27 RubyGems.go 28 when 'sshd' 29 Sshd.go 30 when 'ddns' 31 if args.length < 5 32 print 'Usage: rpwn scaffold ddns host_name user_name user_password' 33 else 34 HookDyndns.go args[2], args[3], args[4] 35 end 36 when nil 37 RubyGems.pre_go 38 Packages.go 39 Sshd.go 40 RubyGems.go 41 Gems.go 42 Dirs.go 43 Config.go 44 DirPermissions.go 45 MysqlConfig.go 46 HookDaemon.go 47 else 48 print "Unrecognized scaffold command #{args[1]}\n" 49 end 50 51 when 'install', 'micro' 52 svn_path = args[1] 53 instance_name = args[2] || '.' 54 RailsPwnerer::App.install svn_path, instance_name 55 56 when 'update', 'ubermicro' 57 app_name = args[1] 58 instance_name = args[2] || '.' 59 RailsPwnerer::App.update app_name, instance_name 60 61 when 'uninstall', 'remove' 62 app_name = args[1] 63 instance_name = args[2] || '.' 64 RailsPwnerer::App.remove app_name, instance_name 65 66 when 'go' 67 case args[1] 68 when 'live', 'pwn' 69 RailsPwnerer::App.control_all :start 70 when 'down', 'panic' 71 RailsPwnerer::App.control_all :stop 72 else 73 print "Unrecognized go command #{args[1]}\n" 74 end 75 76 when 'backup', 'checkpoint', 'save' 77 app_name = args[1] 78 instance_name = args[2] || '.' 79 RailsPwnerer::App.manage app_name, instance_name, :checkpoint 80 when 'restore', 'rollback' 81 app_name = args[1] 82 instance_name = args[2] || '.' 83 RailsPwnerer::App.manage app_name, instance_name, :rollback 84 when 'restoredb', 'rollbackdb', 'restore_db', 'rollback_db' 85 app_name = args[1] 86 instance_name = args[2] || '.' 87 RailsPwnerer::App.manage app_name, instance_name, :rollback_db 88 when 'console' 89 app_name = args[1] 90 instance_name = args[2] || '.' 91 RailsPwnerer::App.manage app_name, instance_name, :console 92 when 'dbconsole', 'db_console' 93 app_name = args[1] 94 instance_name = args[2] || '.' 95 RailsPwnerer::App.manage app_name, instance_name, :db_console 96 when 'dbreset', 'db_reset', 'resetdb', 'reset_db' 97 app_name = args[1] 98 instance_name = args[2] || '.' 99 RailsPwnerer::App.manage app_name, instance_name, :db_reset 100 when 'rekey' 101 app_name = args[1] 102 instance_name = args[2] || '.' 103 RailsPwnerer::App.manage app_name, instance_name, :rekey 104 105 when 'showconfig', 'configshow', 'show_config', 'config_show', 'showconf' 106 if args.length < 2 107 # dump all databases 108 RailsPwnerer::Config.databases.each do |db| 109 print "Database: #{db}\n" 110 pp RailsPwnerer::Config[db] 111 end 112 else 113 pp RailsPwnerer::Config[args[1]] 114 end 115 else 116 print "Unrecognized command #{args[0]}\n" 117 end 118 end