crossing 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/bin/crossing +1 -1
- data/lib/crossing.rb +13 -11
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTRlZDliNWZmMmM1YWI2NDk2NTMxN2Y4ZWQxNTM1N2NlMzAxZTE2MA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZWIwN2UyZTM5YWEzMzQzNzRiOGRiNGQ2Y2QzNmE4ZWZhZTRiNjlhMA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjAwZjVmNjNkMTg2OGI2ZDE4N2VhNWZhN2FkYmIwY2JhNWE1OTc1Y2U0NzIy
|
10
|
+
YjBiMmEyYmRiYTUyZWJiM2I3NWQ0MWFlZjlhMmQ0YjQzODUzZWE1ZmU2YWZj
|
11
|
+
NjMyYTc0MGQ4ODI5ZWYwNjkyYjIyOTA3ZmE1Yzk4MWY3Mjc3OGE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZjU0OGFmM2YxODJkZmY5NGJmZGE2YTc5ZGU1NDg0YjUxODY3YWI1Njk0YWQy
|
14
|
+
ZDhkZmJiNTRhYTBmMWU3N2ZmZjE5Zjg3ODgxNzZlZTI2OThhMTU0YmMyYTQz
|
15
|
+
YTA3OGRjMzAyMWIxY2FjNzFiZjRlMTg0ODRiYTY0ZGE3YTcxMzk=
|
data/bin/crossing
CHANGED
data/lib/crossing.rb
CHANGED
@@ -9,26 +9,28 @@ class Crossing
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def put(bucket, filename)
|
12
|
-
|
13
|
-
|
14
|
-
rescue
|
15
|
-
raise CrossingFileNotFoundException, "File not found: #{filename}"
|
12
|
+
File.open(filename, 'r') do |file|
|
13
|
+
put_content(bucket, File.basename(filename), file.read)
|
16
14
|
end
|
17
|
-
|
18
|
-
|
15
|
+
rescue Errno::ENOENT
|
16
|
+
raise CrossingFileNotFoundException, "File not found: #{filename}"
|
19
17
|
end
|
20
18
|
|
21
19
|
def put_content(bucket, filename, content)
|
22
|
-
@s3_client.put_object(bucket: bucket,
|
20
|
+
@s3_client.put_object(bucket: bucket,
|
21
|
+
key: File.basename(filename),
|
22
|
+
body: content)
|
23
23
|
end
|
24
24
|
|
25
|
-
def get(
|
26
|
-
if
|
27
|
-
raise
|
25
|
+
def get(bucket, file)
|
26
|
+
if File.exist?(file)
|
27
|
+
raise(CrossingFileExistsException,
|
28
|
+
"File #{file} already exists, will not overwrite.")
|
28
29
|
end
|
29
30
|
|
30
31
|
content = get_content(bucket, file)
|
31
|
-
|
32
|
+
|
33
|
+
File.open(file, 'wb') { |f| f.write(content) }
|
32
34
|
end
|
33
35
|
|
34
36
|
def get_content(bucket, file)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crossing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Ulick
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-02
|
13
|
+
date: 2017-06-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: aws-sdk
|