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.
- checksums.yaml +4 -4
- data/bin/share +13 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4aba7beb080d377ab4adef41a0e501f36b931060
|
4
|
+
data.tar.gz: 8837eb57162ba04c2ca58cbc61b4bfa55bb2acec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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", "
|
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
|
|