share_cli 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/share +13 -1
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ac6d64827a6d0be54f38565e308798e2d5ea0a0
4
- data.tar.gz: bfb64c9019ae5a199499608fce4e513c53ecd2af
3
+ metadata.gz: 4aba7beb080d377ab4adef41a0e501f36b931060
4
+ data.tar.gz: 8837eb57162ba04c2ca58cbc61b4bfa55bb2acec
5
5
  SHA512:
6
- metadata.gz: ad02ddc18bc4229eeac0a6ecc09c764a16a8b9bfa5c4b9d91f7e3bbe7d04f33d5278a3f9ceaea762cb04e274062a3130be35e7ecee9797356cddda6da7089167
7
- data.tar.gz: 87933aae43b8f3ab3c34bfa5942b65aba2381cbb35d9b4fbaa95b6b9003e9a8c0f309c74937d75e6ac95e9296fd40ba02446758f03e4dd1f596de4af267cebcf
6
+ metadata.gz: d264791fca1cbeb1a8805280c599ae93097fa13b8b635a1c42ff2ea2ef30ea8d33771c0369d05a2e817bf288fdbba3d82e2232fb77c9af23aec036aa72974c50
7
+ data.tar.gz: eb6d01bc5cbc7732ebaf30806535fc7d57e2c66659df41fc4dc81e665621bf645bf899ba271c9dcd63aa06049a7f2feb4488bc796d913533d5cee60ca6628fde
data/bin/share CHANGED
@@ -7,7 +7,7 @@ require 'digest/sha1'
7
7
 
8
8
  class Share < Thor
9
9
 
10
- desc "get FILE", "Post file to S3"
10
+ desc "get FILE", "Download file from S3"
11
11
  def get(file)
12
12
  sha = Digest::SHA1.hexdigest(file)
13
13
  command = "aws s3 cp s3://xnh/public/#{sha}/#{file} #{file} && echo '#{file}'"
@@ -26,6 +26,18 @@ class Share < Thor
26
26
  end
27
27
  default_task :post
28
28
 
29
+ desc "delete FILE", "Delete file from S3"
30
+ def delete(file = nil)
31
+ unless File.exists? file
32
+ puts "Error! Can't find \"#{file}\""
33
+ end
34
+ location = "#{Dir.pwd}/#{file}"
35
+ sha = Digest::SHA1.hexdigest(file)
36
+ command = "aws s3 rm s3://xnh/public/#{sha}/#{file} && echo 'DELETED: https://s3.amazonaws.com/xnh/public/#{sha}/#{file}'"
37
+ exec(command)
38
+ end
39
+
40
+
29
41
  end
30
42
 
31
43
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: share_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick McConlogue