share_cli 0.0.6 → 0.0.7

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 +8 -4
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de7c0e8282088247879435d117adc87cf3118cd0
4
- data.tar.gz: bdb95ca1d43329f2894c1d40a60cd303e613c088
3
+ metadata.gz: 93463b0b247405a7daddb3ae1ba517f47ea263ef
4
+ data.tar.gz: e05d66ff567a8dfcef8fb7c501bb0c7117a501ef
5
5
  SHA512:
6
- metadata.gz: dceabd78bec8f98e63c8fd45f7f2c4f5329c766a10b4132cec9a495c2d8ab5b3c3e6bae89ac5e12d64262121e36928644517b1e39b98d58615811625cb8eac32
7
- data.tar.gz: b1acc8e07c044cbc11491a1d74c5e0a8d50df00105e752c86ece980dfdb3b4a6e8cda8b4f2b1ccbd09edbde7b5d0dd0c5114ef5e96cbbb81c6c0f112af94e022
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.gsub(/\s+/, "")
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.gsub(/\s+/, "")
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.gsub(/\s+/, "")
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.gsub(/\s+/, "")
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}'"
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.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick McConlogue