awss3sync 0.0.0 → 1.0.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: 7a9bb1b26ea2feca591b9608b283ee2e76f177c9
4
- data.tar.gz: 5e3b780c3e21536df9afda4a96c75330869f5331
3
+ metadata.gz: 43091e8a5c0f2758bc68e63cfdc2e1c036fa832f
4
+ data.tar.gz: 812c3b5bffd902b96bdc9d427ca72343e0dcb93c
5
5
  SHA512:
6
- metadata.gz: dc5e09439826fcaf78a826736f7cef91cff92da6c8182eeb9c0d7714eab79c42b2f7e411b5b12f5bae0d320040e97ad59fa3977be3bf81d933b5b299a0bdd36f
7
- data.tar.gz: 20bfd16f6d6713596616a74af1a3ffcfe4e477d61c365c763d8e5f14fe8e35142f2610a43d4c1b340caa0d2b87c5601449c68298b4275ba714bb831282f6a36e
6
+ metadata.gz: 8bb8d3d6db277c8ff97e988714be34d54722ad5f5d9be1c6c9093b025743471d56f7dbfb63714c8f321fe8871f0b0d9b56897ffdb9a58916e256e45ca86b8b2b
7
+ data.tar.gz: 918eaf0ad2ff34ef8de35f7eef96dbe6ac76f8dbfca951f44052753d2b005d03784ae322d85153b46686bd8402b89e0f42028d5717d05ecb4aab951ba50d3790
data/README.md CHANGED
@@ -1,8 +1,29 @@
1
1
  # Awss3sync
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/awss3sync`. To experiment with that code, run `bin/console` for an interactive prompt.
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.
4
5
 
5
- TODO: Delete this and the text above, and describe your gem
6
+ ## Disclaimer
7
+
8
+ `use at your own risk!` I am not held responsible for the use of this gem. If you are not sure it will work for you, install it on a vagrant vm and give it a try there. The Vagrantfile in this repo can to take care of configuring a useable vm.
9
+
10
+ ## Usage
11
+
12
+ `awss3sync` - view the help menu
13
+
14
+ `awss3sync list` - to list all directories
15
+
16
+ `awss3ync list -f some/directory` - to list the contents of a given directory
17
+
18
+ `awss3sync sync -f some/directory -t some/directory` - sync contents `from` one directory `to` another directory
19
+
20
+ `-f` and `--from` operate the same
21
+
22
+ `-t` and `--to` operate the same
23
+
24
+ When syncing folders the output should look something like this:
25
+
26
+ `Syncing From: directory1 To: directory2`
6
27
 
7
28
  ## Installation
8
29
 
@@ -20,16 +41,28 @@ Or install it yourself as:
20
41
 
21
42
  $ gem install awss3sync
22
43
 
23
- ## Usage
24
-
25
- TODO: Write usage instructions here
26
-
27
44
  ## Development
28
45
 
29
46
  After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
47
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
48
+ To install this gem onto your local machine, run `bundle exec rake install`.
49
+
50
+ ## Releasing
51
+ To release a new version,
52
+
53
+ * update the version number in `version.rb`
54
+ * tag the the code `git tag v*.*.*`
55
+ * push the tag `git push --tags`
56
+ * then run `bundle exec rake build`
57
+ * `gem push pkg/awss3sync-version`
58
+
59
+ Which will push the `.gem` file to [rubygems.org](https://rubygems.org).
32
60
 
33
61
  ## Contributing
34
62
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/awss3sync.
63
+ Bug reports and pull requests are welcome on GitHub at https://github.com/vmcilwain/awss3sync. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
64
+
65
+
66
+ ## License
67
+
68
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/awss3sync.gemspec CHANGED
@@ -7,11 +7,12 @@ Gem::Specification.new do |spec|
7
7
  spec.name = "awss3sync"
8
8
  spec.version = Awss3sync::VERSION
9
9
  spec.authors = ["Vell"]
10
- spec.email = ["vmcilwain@me.com"]
10
+ spec.email = ["lovell.mcilwain@gmail.com"]
11
11
 
12
12
  spec.summary = %q{Sync AWS S3 Directories}
13
13
  spec.description = %q{Sync AWS S3 directories. Requires AWS CLI to be installed and configured before use.}
14
14
  spec.homepage = "https://www.github.com/vmcilwain/awss3sync"
15
+ spec.license = "MIT"
15
16
 
16
17
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
18
  # to allow pushing to a single host or delete this section to allow pushing to any host.
@@ -22,13 +23,13 @@ Gem::Specification.new do |spec|
22
23
  "public gem pushes."
23
24
  end
24
25
 
25
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
26
- f.match(%r{^(test|spec|features)/})
27
- end
28
- spec.bindir = "exe"
29
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
+ spec.files = Dir["{bin,lib}/**/*", "LICENSE.txt", "README.md", 'Rakefile', 'Gemfile', 'awss3sync.gemspec']
27
+ spec.test_files = Dir["spec/**/*"]
28
+ spec.bindir = "bin"
29
+ spec.executables = ['awss3sync']
30
30
  spec.require_paths = ["lib"]
31
31
 
32
32
  spec.add_development_dependency "bundler", "~> 1.15"
33
33
  spec.add_development_dependency "rake", "~> 10.0"
34
+ spec.add_dependency 'thor', '~> 0.20.0'
34
35
  end
data/bin/awss3sync ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/awss3sync'
data/lib/awss3sync.rb CHANGED
@@ -1,5 +1,67 @@
1
- require "awss3sync/version"
1
+ require_relative "awss3sync/version"
2
+ require 'thor'
2
3
 
3
4
  module Awss3sync
4
- # Your code goes here...
5
+ class Awss3sync < Thor
6
+ include Thor::Actions
7
+
8
+ no_commands do
9
+ def aws?
10
+ raise 'Requires AWS CLI Installation' if %x{which aws}.empty?
11
+ end
12
+
13
+ def list_contents
14
+ %x{aws s3 ls #{prefix}#{options[:from]}/}.gsub(/\s+PRE/, '').split("\s")
15
+ end
16
+
17
+ def prefix
18
+ 's3://'
19
+ end
20
+ end
21
+
22
+ method_option :from, type: :string, aliases: :f
23
+ desc 'list', 'List S3 directories'
24
+ long_desc <<-LONGDESC
25
+ -f --from
26
+ Directory to view contents
27
+ LONGDESC
28
+ def list
29
+ aws?
30
+ say list_contents
31
+ end
32
+
33
+ method_option :from, type: :string, required: true, aliases: :f
34
+ method_option :to, type: :string, required: true, aliases: :t
35
+ desc 'sync', 'Sync all contents from one s3 bucket to another'
36
+ long_desc <<-LONGDESC
37
+ -f --from
38
+ Directory to sync from
39
+ -t --to
40
+ Directory to sync to
41
+ LONGDESC
42
+ def sync
43
+ aws?
44
+ list_contents.reject{|directory| directory == 'backups/'}.each do |dir|
45
+ say "Syncing: #{dir} From: #{options[:from]} To: #{options[:to]}"
46
+ %x{aws s3 sync #{prefix}#{options[:from]}/#{dir} #{prefix}#{options[:to]}/#{dir}}
47
+ end
48
+ 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
+ end
5
65
  end
66
+
67
+ Awss3sync::Awss3sync.start(ARGV)
@@ -1,3 +1,3 @@
1
1
  module Awss3sync
2
- VERSION = "0.0.0"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awss3sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vell
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2017-09-13 00:00:00.000000000 Z
12
12
  dependencies:
@@ -38,25 +38,41 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: thor
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.20.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.20.0
41
55
  description: Sync AWS S3 directories. Requires AWS CLI to be installed and configured
42
56
  before use.
43
57
  email:
44
- - vmcilwain@me.com
45
- executables: []
58
+ - lovell.mcilwain@gmail.com
59
+ executables:
60
+ - awss3sync
46
61
  extensions: []
47
62
  extra_rdoc_files: []
48
63
  files:
49
- - ".gitignore"
50
64
  - Gemfile
51
65
  - README.md
52
66
  - Rakefile
53
67
  - awss3sync.gemspec
68
+ - bin/awss3sync
54
69
  - bin/console
55
70
  - bin/setup
56
71
  - lib/awss3sync.rb
57
72
  - lib/awss3sync/version.rb
58
73
  homepage: https://www.github.com/vmcilwain/awss3sync
59
- licenses: []
74
+ licenses:
75
+ - MIT
60
76
  metadata:
61
77
  allowed_push_host: https://rubygems.org
62
78
  post_install_message:
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/