share_cli 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/share +8 -4
- 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: 93463b0b247405a7daddb3ae1ba517f47ea263ef
|
4
|
+
data.tar.gz: e05d66ff567a8dfcef8fb7c501bb0c7117a501ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f77574e17d862d2f2f578931bac9c90e2cdb711290108383fb83f977fceed04800328299c6764246f1d1117b777cab8edc28197e9a7ac73fb059801f0e9180d
|
7
|
+
data.tar.gz: 3a1d888a5633060ba67c791ba1398ff2379733342c79def5bf9fdd161273c84bd7bdc00e9736a0be67e6d3ed5aa2a597d270c872b551a0d76dabac0021c25112
|
data/bin/share
CHANGED
@@ -9,7 +9,8 @@ class Share < Thor
|
|
9
9
|
|
10
10
|
desc "get FILE", "Download file from S3"
|
11
11
|
def get(file)
|
12
|
-
file = file.
|
12
|
+
file = file.strip
|
13
|
+
file.gsub!(" ","_")
|
13
14
|
sha = Digest::SHA1.hexdigest(file+"037605")
|
14
15
|
command = "aws s3 cp s3://xnh/public/#{sha}/#{file} #{file} && echo '#{file}'"
|
15
16
|
exec(command)
|
@@ -17,10 +18,11 @@ class Share < Thor
|
|
17
18
|
|
18
19
|
desc "post FILE", "Post file to S3"
|
19
20
|
def post(file = nil)
|
20
|
-
file = file.
|
21
|
+
file = file.strip
|
21
22
|
unless File.exists? file
|
22
23
|
puts "Error! Can't find \"#{file}\""
|
23
24
|
end
|
25
|
+
file.gsub!(" ","_")
|
24
26
|
location = "#{Dir.pwd}/#{file}"
|
25
27
|
sha = Digest::SHA1.hexdigest(file+"037605")
|
26
28
|
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}'"
|
@@ -30,7 +32,8 @@ class Share < Thor
|
|
30
32
|
|
31
33
|
desc "delete FILE", "Delete file from S3"
|
32
34
|
def delete(file = nil)
|
33
|
-
file = file.
|
35
|
+
file = file.strip
|
36
|
+
file.gsub!(" ","_")
|
34
37
|
unless File.exists? file
|
35
38
|
puts "Error! Can't find \"#{file}\""
|
36
39
|
end
|
@@ -42,10 +45,11 @@ class Share < Thor
|
|
42
45
|
|
43
46
|
desc "glacier FILE", "Post file to S3 bucket which automatically stores data in AWS Glacier."
|
44
47
|
def glacier(file = nil)
|
45
|
-
file = file.
|
48
|
+
file = file.strip
|
46
49
|
unless File.exists? file
|
47
50
|
puts "Error! Can't find \"#{file}\""
|
48
51
|
end
|
52
|
+
file.gsub!(" ","_")
|
49
53
|
location = "#{Dir.pwd}/#{file}"
|
50
54
|
sha = Time.now.strftime('%F')
|
51
55
|
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}'"
|