Sha256: ea004cb9a721aa2e5455db2c4dbe26f7ad76f533c2a395d0978a830a2ca4b1f8
Contents?: true
Size: 1.14 KB
Versions: 4
Compression:
Stored size: 1.14 KB
Contents
#!/usr/bin/env ruby require 'rmega' require 'rmega/cli' include Rmega::CLI::Helpers if ARGV.empty? ARGV << '--help' else cli_options[:path] = ARGV[0] end OptionParser.new do |opts| opts.banner = "Usage:\n" opts.banner << "\t#{File.basename(__FILE__)} path [options]\n" opts.banner << "Examples:\n" opts.banner << "\t#{File.basename(__FILE__)} /local/file.txt -u email@localhost -r /remote/docs\n" opts.banner << "Options:" opts.on("-r PATH", "--remote-path", "Remote path") { |path| cli_options[:remote_path] = path } apply_opt_parser_options(opts) end.parse! cli_rescue do raise("File not found - #{cli_options[:path]}") unless File.exists?(cli_options[:path]) user = cli_options[:user] || raise("User email is required") session = Rmega::Session.new.login(user, cli_options[:pass] ||= cli_prompt_password) root = session.storage.root node = traverse_storage(root, cli_options[:remote_path].to_s.dup, :only_folders => true) raise("Node not found - #{cli_options[:remote_path]}") unless node raise("Node cannot be a file - #{cli_options[:remote_path]}") if node.type == :file node.upload(cli_options[:path]) end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rmega-0.2.5 | bin/rmega-up |
rmega-0.2.4 | bin/rmega-up |
rmega-0.2.2 | bin/rmega-up |
rmega-0.2.1 | bin/rmega-up |