extract methods to separate files

cache methods to cache.rb
say_error_and_exit to common.rb
upload.rb
connection.rb