s3_sync 0.1.0 → 0.1.1

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: 21b7c36e704bf5137f2d5174392c866c6c40eca9
4
- data.tar.gz: 77b4b62cbb95ddfb9d4ed8770f59916ffbe8e08f
3
+ metadata.gz: cc3c1920c162355ad15e7b29de184b776ac52999
4
+ data.tar.gz: 564e722b8995182f5b129f5b550bc5c2d92d9d8a
5
5
  SHA512:
6
- metadata.gz: a97b9662e324210196b7ffe6422cdab8ace7377cb3835f2391a06ecdcbe1149960d59ae765e6e76da13d9261cc7c7a66d675efef1bbb43fa5a653d7449a92ffb
7
- data.tar.gz: af3c01969d935069f520f54270afa510d01dfb93e60a885687c17b309658313d58d6eb024b6f3a9823d4481db11929917f7ff1b3d2da8092ce2886226de4b5d5
6
+ metadata.gz: dfd1b6a2d0eab241969d67a66d8f28089664fb5f9b1f0251b2db5fcb9973589f34f7c6a1a217208f62ee1ff75256283cbe71438193d194ca658a7a627f117302
7
+ data.tar.gz: 0438f6981de67c83cf52c45625f81243be6fec49c69f3fca31f4d9cc527ea54f7145a049225019e6f14f624e0d03984addf861f8fdd3879260bde727bdd69b38
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # s3_sync
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/s3_sync.svg)](http://badge.fury.io/rb/s3_sync)
4
+
3
5
  Securely sync (upload and download) files with [Amazon Simple Storage Service (s3)](http://aws.amazon.com/s3).
4
6
 
5
7
  Specify credentials, file names, and other options during configuration.
@@ -20,39 +22,50 @@ Or install it yourself as:
20
22
 
21
23
  $ gem install s3_sync
22
24
 
25
+ ## Prerequisites
26
+
27
+ Create an [AWS Identity and Access Management (IAM)](http://aws.amazon.com/iam/) user.
28
+
29
+ > Note: the s3 user's *Access Key Id* and *Secret Access Key*
30
+
31
+ Create an AWS IAM policy with the permissions:
32
+
33
+ arn:aws:iam::aws:policy/AmazonS3FullAccess
34
+
35
+ Create an AWS IAM group, add the user to the group, and attach the policy to the group.
36
+
23
37
  ## Usage
24
38
 
25
39
  ### Configuring
26
40
 
27
- Configure the gem to use the same options when uploading and downloading.
41
+ Use the same options when uploading and downloading.
28
42
 
29
43
  ```` rb
30
44
  S3Sync.configure do |config|
31
45
  config.key_id = "mykey123"
32
- config.key_secret = "secret456"
46
+ config.key_secret = "mysecret456"
33
47
  config.region = "us-east-1"
34
- config.bucket = "my-backups"
35
- config.secret_phrase = "my-s3cr3t"
48
+ config.bucket = "s3-uploads"
49
+ config.secret_phrase = "supersecret"
36
50
  config.files = [
37
- File.join(Dir.home,".bash_profile"),
38
51
  File.join(Dir.home,".gitconfig"),
39
52
  File.join(Dir.home,".ssh","config")
40
53
  ]
41
- config.downloads_dir = File.join(Dir.home,"Desktop","my-s3-downloads")
54
+ config.downloads_dir = File.join(Dir.home,"Desktop","s3-downloads")
42
55
  end
43
56
  ````
44
57
 
45
58
  #### Configuration Options
46
59
 
47
- attribute name | description | default value
48
- --- | --- | ---
49
- `key_id` | The s3 user's *Access Key Id*. | N/A
50
- `key_secret` | The s3 user's *Access Key Secret*. | N/A
51
- `region` | The s3 region. | N/A
52
- `bucket` | The s3 bucket (top-level directory) name. | N/A
53
- `secret_phrase` | The phrase to use when encrypting and decrypting files. | N/A
54
- `files` | A list of local file paths to be synced. | N/A
55
- `downloads_dir` | A staging directory to house downloaded files. | `File.join(Dir.home,"Desktop","s3-downloads")`
60
+ attribute name | description
61
+ --- | ---
62
+ `key_id` | The s3 user's *Access Key Id*.
63
+ `key_secret` | The s3 user's *Access Key Secret*.
64
+ `region` | The s3 region.
65
+ `bucket` | The s3 bucket (top-level directory) name.
66
+ `secret_phrase` | The phrase to use when encrypting and decrypting files.
67
+ `files` | A list of local file paths to be synced.
68
+ `downloads_dir` | A staging directory to house downloaded files. Defaults to *~Desktop/s3-downloads*.
56
69
 
57
70
  ### Uploading
58
71
 
@@ -74,18 +87,6 @@ S3Sync::Download.new
74
87
 
75
88
  Files are downloaded to a staging directory, which can be configured with `config.downloads_dir`. The staging directory helps mitigate the risk of accidentally over-writing local files.
76
89
 
77
- ## Prerequisites
78
-
79
- Create an [AWS Identity and Access Management (IAM)](http://aws.amazon.com/iam/) user and obtain its *Access Key Id* and *Secret Access Key*.
80
-
81
- Create an AWS IAM group.
82
-
83
- Create an AWS IAM policy with the *arn:aws:iam::aws:policy/AmazonS3FullAccess* permission set.
84
-
85
- Attach the policy to the group.
86
-
87
- Add the user to the group.
88
-
89
90
  ## Contributing
90
91
 
91
92
  Browse [existing issues](https://github.com/s2t2/s3-sync-ruby/issues) or create a [new issue](https://github.com/s2t2/s3-sync-ruby/issues/new) to communicate bugs, desired features, etc.
@@ -19,10 +19,16 @@ module S3Sync
19
19
 
20
20
  object_keys = []
21
21
  objects = client.list_objects(:bucket => @bucket)
22
- while objects.last_page? == false
22
+
23
+ if objects.next_page?
24
+ while objects.last_page? == false
25
+ object_keys << objects.contents.map{|obj| obj.key}
26
+ objects = objects.next_page
27
+ end
28
+ else
23
29
  object_keys << objects.contents.map{|obj| obj.key}
24
- objects = objects.next_page
25
30
  end
31
+
26
32
  object_directories = object_keys.flatten.map{|str| str.split("/").first}.compact.uniq
27
33
  days = object_directories.map{|str| Date.parse(str) rescue nil}.compact
28
34
  latest_day = days.max.to_s
@@ -1,3 +1,3 @@
1
1
  module S3Sync
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - MJ Rossetti (@s2t2)
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-07-21 00:00:00.000000000 Z
11
+ date: 2015-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler