class Share
Public Instance Methods
delete(file = nil)
click to toggle source
# File bin/share, line 36 def delete(file = nil) file = file.strip file.gsub!(" ","_") location = "#{Dir.pwd}/#{file}" sha = Digest::SHA1.hexdigest(file+"037605") command = "aws s3 rm s3://xnh/public/#{sha}/#{file} && echo 'DELETED: https://s3.amazonaws.com/xnh/public/#{sha}/#{file}'" exec(command) end
get(file)
click to toggle source
# File bin/share, line 11 def get(file) original_file = file file = file.strip file.gsub!(" ","_") sha = Digest::SHA1.hexdigest(file+"037605") command = "aws s3 cp s3://xnh/public/#{sha}/#{file} #{original_file} && echo '#{original_file}'" exec(command) end
glacier(file = nil)
click to toggle source
# File bin/share, line 46 def glacier(file = nil) file = file.strip unless File.exists? file puts "Error! Can't find \"#{file}\"" end file.gsub!(" ","_") location = "#{Dir.pwd}/#{file}" sha = Time.now.strftime('%F') command = "aws s3 cp #{location} s3://xodus-glacier/#{sha}/#{file} && echo 'https://s3.amazonaws.com/xodus-glacier/#{sha}/#{file}' | pbcopy && echo 'https://s3.amazonaws.com/xodus-glacier/#{sha}/#{file}'" exec(command) end
post(file = nil)
click to toggle source
# File bin/share, line 21 def post(file = nil) original_file = file file = file.strip unless File.exists? original_file puts "Error! Can't find \"#{original_file}\"" end file.gsub!(" ","_") location = "#{Dir.pwd}/#{original_file}" sha = Digest::SHA1.hexdigest(file+"037605") command = "aws s3 cp #{location} s3://xnh/public/#{sha}/#{file} --acl public-read && echo 'https://s3.amazonaws.com/xnh/public/#{sha}/#{file}' | pbcopy && echo 'https://s3.amazonaws.com/xnh/public/#{sha}/#{file}'" exec(command) end