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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 43091e8a5c0f2758bc68e63cfdc2e1c036fa832f
4
- data.tar.gz: 812c3b5bffd902b96bdc9d427ca72343e0dcb93c
3
+ metadata.gz: 96991e06a025a03aff2c25d314fb50c5fb728de9
4
+ data.tar.gz: b208d8c963f9c58607f4b25cdb060ddb75aa22bd
5
5
  SHA512:
6
- metadata.gz: 8bb8d3d6db277c8ff97e988714be34d54722ad5f5d9be1c6c9093b025743471d56f7dbfb63714c8f321fe8871f0b0d9b56897ffdb9a58916e256e45ca86b8b2b
7
- data.tar.gz: 918eaf0ad2ff34ef8de35f7eef96dbe6ac76f8dbfca951f44052753d2b005d03784ae322d85153b46686bd8402b89e0f42028d5717d05ecb4aab951ba50d3790
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. It is ONLY for syncing folders from one directory to another.
4
- #####This gem does not copy files locally.
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` another directory
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
- `-f` and `--from` operate the same
25
+ >`-t` = `--to`
21
26
 
22
- `-t` and `--to` operate the same
27
+ >`p` = `--protocol` default is s3://
23
28
 
24
29
  When syncing folders the output should look something like this:
25
30
 
@@ -11,11 +11,11 @@ module Awss3sync
11
11
  end
12
12
 
13
13
  def list_contents
14
- %x{aws s3 ls #{prefix}#{options[:from]}/}.gsub(/\s+PRE/, '').split("\s")
14
+ %x{aws s3 ls #{options[:from]}/}.split("\n").map{|str| string_to_array(str).last}
15
15
  end
16
16
 
17
- def prefix
18
- 's3://'
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 #{prefix}#{options[:from]}/#{dir} #{prefix}#{options[:to]}/#{dir}}
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
 
@@ -1,3 +1,3 @@
1
1
  module Awss3sync
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
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.0.0
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-13 00:00:00.000000000 Z
11
+ date: 2017-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler