awss3sync 1.0.0 → 1.1.0
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/README.md +10 -5
- data/lib/awss3sync.rb +7 -19
- data/lib/awss3sync/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96991e06a025a03aff2c25d314fb50c5fb728de9
|
4
|
+
data.tar.gz: b208d8c963f9c58607f4b25cdb060ddb75aa22bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a10ad554c81d5c70f55792ec7ada38a2de16032b2ae70eb743641eb0d5c5e3568c82154da6c81a3342d902e1c4c3389041dd63eb50da807faba9b22d50e563c0
|
7
|
+
data.tar.gz: f390766ea570474a742287c5b31ba92043ad58d9d116cd6b44b3773f06f6ad5ef2e36e4e5bcb5b1206fc2c5a67284f778e73b80fa564b017f8aedf0b8e7374a9
|
data/README.md
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# Awss3sync
|
2
2
|
|
3
|
-
A wrapper for the AWS S3 cli.
|
4
|
-
|
3
|
+
A wrapper for the AWS S3 cli.
|
4
|
+
|
5
|
+
##### This gem does not copy files locally.
|
5
6
|
|
6
7
|
## Disclaimer
|
7
8
|
|
@@ -15,11 +16,15 @@ A wrapper for the AWS S3 cli. It is ONLY for syncing folders from one directory
|
|
15
16
|
|
16
17
|
`awss3ync list -f some/directory` - to list the contents of a given directory
|
17
18
|
|
18
|
-
`awss3sync sync -f some/directory -t some/directory` - sync contents `from` one directory `to`
|
19
|
+
`awss3sync sync -f some/directory -t some/directory` - sync contents `from` one directory `to` another directory
|
20
|
+
|
21
|
+
> Alias:
|
22
|
+
|
23
|
+
>`-f` = `--from`
|
19
24
|
|
20
|
-
|
25
|
+
>`-t` = `--to`
|
21
26
|
|
22
|
-
|
27
|
+
>`p` = `--protocol` default is s3://
|
23
28
|
|
24
29
|
When syncing folders the output should look something like this:
|
25
30
|
|
data/lib/awss3sync.rb
CHANGED
@@ -11,11 +11,11 @@ module Awss3sync
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def list_contents
|
14
|
-
%x{aws s3 ls #{
|
14
|
+
%x{aws s3 ls #{options[:from]}/}.split("\n").map{|str| string_to_array(str).last}
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
18
|
-
|
17
|
+
def string_to_array(str)
|
18
|
+
str.split("\s")
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -32,35 +32,23 @@ module Awss3sync
|
|
32
32
|
|
33
33
|
method_option :from, type: :string, required: true, aliases: :f
|
34
34
|
method_option :to, type: :string, required: true, aliases: :t
|
35
|
+
method_option :protocol, type: :string, aliases: :p, default: 's3://'
|
35
36
|
desc 'sync', 'Sync all contents from one s3 bucket to another'
|
36
37
|
long_desc <<-LONGDESC
|
37
38
|
-f --from
|
38
39
|
Directory to sync from
|
39
40
|
-t --to
|
40
41
|
Directory to sync to
|
42
|
+
-p --protocol
|
43
|
+
The protocol example: 's3://'
|
41
44
|
LONGDESC
|
42
45
|
def sync
|
43
46
|
aws?
|
44
47
|
list_contents.reject{|directory| directory == 'backups/'}.each do |dir|
|
45
48
|
say "Syncing: #{dir} From: #{options[:from]} To: #{options[:to]}"
|
46
|
-
%x{aws s3 sync #{
|
49
|
+
%x{aws s3 sync #{options[:protocol]}#{options[:from]}/#{dir} #{options[:protocol]}#{options[:to]}/#{dir}}
|
47
50
|
end
|
48
51
|
end
|
49
|
-
|
50
|
-
method_option :from, type: :string, required: true, aliases: :f
|
51
|
-
method_option :to, type: :string, required: true, aliases: :t
|
52
|
-
desc 'dir', 'Sync contents of a specific directory in an s3 bucket to another'
|
53
|
-
long_desc <<-LONGDESC
|
54
|
-
-f --from
|
55
|
-
Directory to sync from
|
56
|
-
-t --to
|
57
|
-
Directory to sync to
|
58
|
-
LONGDESC
|
59
|
-
def dir
|
60
|
-
aws?
|
61
|
-
say "Syncing From: #{options[:from]} To: #{options[:to]}"
|
62
|
-
%x{aws s3 sync #{prefix}#{options[:from]}/ #{prefix}#{options[:to]}/}
|
63
|
-
end
|
64
52
|
end
|
65
53
|
end
|
66
54
|
|
data/lib/awss3sync/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awss3sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|