aws-rsync 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/.rspec +2 -0
- data/CHANGELOG.md +10 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +56 -0
- data/Guardfile +19 -0
- data/LICENSE.txt +22 -0
- data/README.md +48 -0
- data/Rakefile +6 -0
- data/aws-rsync.gemspec +30 -0
- data/exe/aws-rsync +14 -0
- data/lib/aws-rsync.rb +13 -0
- data/lib/aws_rsync/aws_services.rb +7 -0
- data/lib/aws_rsync/cli.rb +26 -0
- data/lib/aws_rsync/command.rb +46 -0
- data/lib/aws_rsync/help.rb +9 -0
- data/lib/aws_rsync/help/sync.md +11 -0
- data/lib/aws_rsync/host.rb +41 -0
- data/lib/aws_rsync/sync.rb +92 -0
- data/lib/aws_rsync/version.rb +3 -0
- data/lib/aws_rsync/watch.rb +22 -0
- data/spec/lib/cli_spec.rb +19 -0
- data/spec/spec_helper.rb +22 -0
- metadata +169 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 45ef533111eb698d4ad5dc531b5c4aeda473f8f20071ac16e96aab269619f55f
|
4
|
+
data.tar.gz: 11a0cfe34f59d1f15b2ad1c42e6c1fcd81d5bd50d868c16e7f499bd09992a069
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6dcd4ec76f9ddcea259941cc1749c78513ecefd7455a265654159fbc9224159aadcca477e5bb00cc40db577d2e83fdd8548cb7f22efd09ea364c1468b918f10e
|
7
|
+
data.tar.gz: 4a0d6d9717a75583b83f9ea9ac4c6182c42ef68986a2ffe73db1ae5b0e1352b81eafdee16e2ded50867aa7ed2249f45ff826fda32710357d67da076d142c588a
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
|
+
|
6
|
+
## [0.1.0]
|
7
|
+
- Initial release.
|
8
|
+
- initial aws-rsync sync command
|
9
|
+
- watch mode working
|
10
|
+
- AWS_RSYNC_EXCLUDE AWS_RSYNC_OPTIONS override abilities
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
aws-rsync (0.1.0)
|
5
|
+
colorize
|
6
|
+
filewatcher
|
7
|
+
hashie
|
8
|
+
thor
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
byebug (10.0.0)
|
14
|
+
codeclimate-test-reporter (0.4.4)
|
15
|
+
simplecov (>= 0.7.1, < 1.0.0)
|
16
|
+
colorize (0.8.1)
|
17
|
+
diff-lcs (1.2.5)
|
18
|
+
docile (1.1.5)
|
19
|
+
filewatcher (1.0.1)
|
20
|
+
trollop (~> 2.1, >= 2.1.2)
|
21
|
+
hashie (3.5.7)
|
22
|
+
multi_json (1.10.1)
|
23
|
+
rake (10.4.2)
|
24
|
+
rspec (3.1.0)
|
25
|
+
rspec-core (~> 3.1.0)
|
26
|
+
rspec-expectations (~> 3.1.0)
|
27
|
+
rspec-mocks (~> 3.1.0)
|
28
|
+
rspec-core (3.1.7)
|
29
|
+
rspec-support (~> 3.1.0)
|
30
|
+
rspec-expectations (3.1.2)
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
+
rspec-support (~> 3.1.0)
|
33
|
+
rspec-mocks (3.1.3)
|
34
|
+
rspec-support (~> 3.1.0)
|
35
|
+
rspec-support (3.1.2)
|
36
|
+
simplecov (0.9.1)
|
37
|
+
docile (~> 1.1.0)
|
38
|
+
multi_json (~> 1.0)
|
39
|
+
simplecov-html (~> 0.8.0)
|
40
|
+
simplecov-html (0.8.0)
|
41
|
+
thor (0.20.0)
|
42
|
+
trollop (2.1.2)
|
43
|
+
|
44
|
+
PLATFORMS
|
45
|
+
ruby
|
46
|
+
|
47
|
+
DEPENDENCIES
|
48
|
+
aws-rsync!
|
49
|
+
bundler
|
50
|
+
byebug
|
51
|
+
codeclimate-test-reporter
|
52
|
+
rake
|
53
|
+
rspec
|
54
|
+
|
55
|
+
BUNDLED WITH
|
56
|
+
1.16.1
|
data/Guardfile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
guard "bundler", cmd: "bundle" do
|
2
|
+
watch("Gemfile")
|
3
|
+
watch(/^.+\.gemspec/)
|
4
|
+
end
|
5
|
+
|
6
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
7
|
+
require "guard/rspec/dsl"
|
8
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
9
|
+
|
10
|
+
# RSpec files
|
11
|
+
rspec = dsl.rspec
|
12
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
13
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
14
|
+
watch(rspec.spec_files)
|
15
|
+
|
16
|
+
# Ruby files
|
17
|
+
ruby = dsl.ruby
|
18
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
19
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Tung Nguyen
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# AwsRsync
|
2
|
+
|
3
|
+
Rsync local files to an AWS EC2 instance for a faster development flow.
|
4
|
+
|
5
|
+
This tool is useful for working with single EC2 instances. It takes the instance's id as the main argument and uses it to look up the instance's IP address. It then rsyncs your local project folder to a folder on the specified EC2 instance.
|
6
|
+
|
7
|
+
Some convenient things the tool does:.
|
8
|
+
|
9
|
+
* rsync default options are provided.
|
10
|
+
* The rsync exclude option is derived from the `.gitignore` and `.dockerignore` files in the local folding being sync.
|
11
|
+
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
```sh
|
16
|
+
aws-rsync sync INSTANCE_ID
|
17
|
+
```
|
18
|
+
|
19
|
+
Examples:
|
20
|
+
|
21
|
+
```sh
|
22
|
+
aws-rsync sync i-123456789
|
23
|
+
aws-rsync sync i-123456789 --watch
|
24
|
+
aws-rsync sync i-123456789 --private-ip
|
25
|
+
aws-rsync sync i-123456789 --private-ip --watch
|
26
|
+
aws-rsync sync i-123456789 --noop
|
27
|
+
```
|
28
|
+
|
29
|
+
## Overriding the rsync command
|
30
|
+
|
31
|
+
You can override the rsync command that gets used with 2 environment variables:
|
32
|
+
|
33
|
+
* AWS_RSYNC_OPTIONS: Override the rsync main options used.
|
34
|
+
* AWS_RSYNC_EXCLUDE: Override the rsync exclude options used.
|
35
|
+
|
36
|
+
## Installation
|
37
|
+
|
38
|
+
```sh
|
39
|
+
$ gem install aws-rsync
|
40
|
+
```
|
41
|
+
|
42
|
+
## Contributing
|
43
|
+
|
44
|
+
1. Fork it
|
45
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
46
|
+
3. Commit your changes (`git commit -am "Add some feature"`)
|
47
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
48
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/aws-rsync.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "aws_rsync/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "aws-rsync"
|
8
|
+
spec.version = AwsRsync::VERSION
|
9
|
+
spec.authors = ["Tung Nguyen"]
|
10
|
+
spec.email = ["tongueroo@gmail.com"]
|
11
|
+
spec.description = %q{Tool rsyncs local files to AWS EC2 instance for a faster development flow}
|
12
|
+
spec.summary = %q{Tool rsyncs local files to AWS EC2 instance for a faster development flow}
|
13
|
+
spec.homepage = "https://github.com/tongueroo/aws-rsync"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency "thor"
|
23
|
+
spec.add_dependency "colorize"
|
24
|
+
spec.add_dependency "filewatcher"
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler"
|
27
|
+
spec.add_development_dependency "byebug"
|
28
|
+
spec.add_development_dependency "rake"
|
29
|
+
spec.add_development_dependency "rspec"
|
30
|
+
end
|
data/exe/aws-rsync
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Trap ^C
|
4
|
+
Signal.trap("INT") {
|
5
|
+
puts "\nCtrl-C detected. Exiting..."
|
6
|
+
sleep 1
|
7
|
+
exit
|
8
|
+
}
|
9
|
+
|
10
|
+
$:.unshift(File.expand_path("../../lib", __FILE__))
|
11
|
+
require "aws-rsync"
|
12
|
+
require "aws_rsync/cli"
|
13
|
+
|
14
|
+
AwsRsync::CLI.start(ARGV)
|
data/lib/aws-rsync.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
$:.unshift(File.expand_path("../", __FILE__))
|
2
|
+
require "aws_rsync/version"
|
3
|
+
require "colorize"
|
4
|
+
|
5
|
+
module AwsRsync
|
6
|
+
autoload :Help, "aws_rsync/help"
|
7
|
+
autoload :Command, "aws_rsync/command"
|
8
|
+
autoload :CLI, "aws_rsync/cli"
|
9
|
+
autoload :AwsServices, "aws_rsync/aws_services"
|
10
|
+
autoload :Sync, "aws_rsync/sync"
|
11
|
+
autoload :Host, "aws_rsync/host"
|
12
|
+
autoload :Watch, "aws_rsync/watch"
|
13
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module AwsRsync
|
2
|
+
class CLI < Command
|
3
|
+
class_option :noop, type: :boolean
|
4
|
+
|
5
|
+
desc "sync INSTANCE_ID", "rsync files on your local machine to a server"
|
6
|
+
long_desc Help.text(:sync)
|
7
|
+
option :watch, type: :boolean, desc: "watches your folder for changes and re-runs sync"
|
8
|
+
option :private_ip, type: :boolean, desc: "whether to use the private or public ip address"
|
9
|
+
option :folder, default: File.basename(Dir.pwd), desc: "the destination folder"
|
10
|
+
option :user, default: "ec2-user", desc: "user to use to connect to server"
|
11
|
+
option :cwd, default: ".", desc: "The local directory to sync"
|
12
|
+
def sync(instance_id)
|
13
|
+
merged_options = options.merge(instance_id: instance_id)
|
14
|
+
if @options[:watch]
|
15
|
+
Watch.new(merged_options).run
|
16
|
+
else
|
17
|
+
Sync.new(merged_options).run
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "version", "prints version"
|
22
|
+
def version
|
23
|
+
puts AwsRsync::VERSION
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require "thor"
|
2
|
+
|
3
|
+
# Override thor's long_desc identation behavior
|
4
|
+
# https://github.com/erikhuda/thor/issues/398
|
5
|
+
class Thor
|
6
|
+
module Shell
|
7
|
+
class Basic
|
8
|
+
def print_wrapped(message, options = {})
|
9
|
+
message = "\n#{message}" unless message[0] == "\n"
|
10
|
+
stdout.puts message
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
module AwsRsync
|
17
|
+
class Command < Thor
|
18
|
+
class << self
|
19
|
+
def dispatch(m, args, options, config)
|
20
|
+
# Allow calling for help via:
|
21
|
+
# aws_rsync command help
|
22
|
+
# aws_rsync command -h
|
23
|
+
# aws_rsync command --help
|
24
|
+
# aws_rsync command -D
|
25
|
+
#
|
26
|
+
# as well thor's normal way:
|
27
|
+
#
|
28
|
+
# aws_rsync help command
|
29
|
+
help_flags = Thor::HELP_MAPPINGS + ["help"]
|
30
|
+
if args.length > 1 && !(args & help_flags).empty?
|
31
|
+
args -= help_flags
|
32
|
+
args.insert(-2, "help")
|
33
|
+
end
|
34
|
+
|
35
|
+
# aws_rsync --version
|
36
|
+
# aws_rsync -v
|
37
|
+
version_flags = ["-v", "--version"]
|
38
|
+
if args.length == 1 && !(args & version_flags).empty?
|
39
|
+
args = ["version"]
|
40
|
+
end
|
41
|
+
|
42
|
+
super
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Rsync local folder to an EC2 instance so you can quickly develop and test. Example:
|
2
|
+
|
3
|
+
$ aws-rsync sync i-123456789
|
4
|
+
|
5
|
+
To watch changed files and re-run rsync automatically, use the --watch flag. Example:
|
6
|
+
|
7
|
+
$ aws-rsync sync i-123456789 --watch
|
8
|
+
|
9
|
+
By default, the public ip address of the ec2 instance is used. If you would like to use the private ip address instead, use the --private-ip flag. Example:
|
10
|
+
|
11
|
+
$ aws-rsync sync i-123456789 --private-ip
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module AwsRsync
|
2
|
+
class Host
|
3
|
+
include AwsServices
|
4
|
+
|
5
|
+
def initialize(options={})
|
6
|
+
@options = options
|
7
|
+
@instance_id = options[:instance_id]
|
8
|
+
end
|
9
|
+
|
10
|
+
def instance
|
11
|
+
instance = find_instance
|
12
|
+
unless instance
|
13
|
+
puts "ERROR: unable to find instance '#{@instance_id}' in this aws account and region: #{region}"
|
14
|
+
exit 1
|
15
|
+
end
|
16
|
+
instance
|
17
|
+
end
|
18
|
+
|
19
|
+
def find_instance
|
20
|
+
instances = ec2.describe_instances(instance_ids: [@instance_id]).
|
21
|
+
reservations.first["instances"] || []
|
22
|
+
instance = instances.first
|
23
|
+
rescue Aws::EC2::Errors::ServiceError => e
|
24
|
+
puts "ERROR: Could not find the instance #{@instance_id}".colorize(:red)
|
25
|
+
puts e.message
|
26
|
+
puts "For the full internal backtrace re-run the command with DEBUG=1" unless ENV['DEBUG']
|
27
|
+
puts e.backtrace if ENV['DEBUG']
|
28
|
+
exit 1
|
29
|
+
end
|
30
|
+
|
31
|
+
def region
|
32
|
+
`aws configure get region`.strip rescue 'us-east-1'
|
33
|
+
end
|
34
|
+
|
35
|
+
def ip
|
36
|
+
@options[:private_ip] ?
|
37
|
+
instance.private_ip_address :
|
38
|
+
instance.public_ip_address
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
module AwsRsync
|
2
|
+
class Sync
|
3
|
+
def initialize(options)
|
4
|
+
@options = options
|
5
|
+
end
|
6
|
+
|
7
|
+
def run
|
8
|
+
puts "=> #{command}".colorize(:green)
|
9
|
+
return if @options[:noop]
|
10
|
+
success = system(command)
|
11
|
+
unless success
|
12
|
+
puts "ERROR: rsync command failed".colorize(:red)
|
13
|
+
exit 1
|
14
|
+
end
|
15
|
+
note_time
|
16
|
+
end
|
17
|
+
|
18
|
+
def command
|
19
|
+
main_options = build_main_options
|
20
|
+
exclude = build_exclude_options
|
21
|
+
options = "#{main_options} #{exclude}"
|
22
|
+
dest = "#{user}@#{host.ip}:#{folder}"
|
23
|
+
|
24
|
+
"rsync #{options} #{src} #{dest}"
|
25
|
+
end
|
26
|
+
|
27
|
+
# A default set of options is provided.
|
28
|
+
# You can override this with the environment variable AWS_RSYNC_OPTIONS.
|
29
|
+
#
|
30
|
+
def build_main_options
|
31
|
+
return ENV['AWS_RSYNC_OPTIONS'] if ENV['AWS_RSYNC_OPTIONS']
|
32
|
+
|
33
|
+
# --numeric-ids don't map uid/gid values by user/group name
|
34
|
+
# --safe-links ignore symlinks that point outside the tree
|
35
|
+
# -a, --archive recursion and preserve almost everything (-rlptgoD)
|
36
|
+
# -x, --one-file-system don't cross filesystem boundaries
|
37
|
+
# -z, --compress compress file data during the transfer
|
38
|
+
# -S, --sparse handle sparse files efficiently
|
39
|
+
# -v, --verbose verbose
|
40
|
+
# --delete delete extraneous files from destination dirs
|
41
|
+
#
|
42
|
+
"--delete --numeric-ids --safe-links -axzSv"
|
43
|
+
end
|
44
|
+
|
45
|
+
# The rsync exclude options are automatically calculated and added with some
|
46
|
+
# sane defaults. You can override the options with the environment variable
|
47
|
+
# AWS_RSYNC_EXCLUDE. To have no exclude options at all use a blank string:
|
48
|
+
# AWS_RSYNC_EXCLUDE=''
|
49
|
+
def build_exclude_options
|
50
|
+
return ENV['AWS_RSYNC_EXCLUDE'] if ENV['AWS_RSYNC_EXCLUDE']
|
51
|
+
|
52
|
+
exclude = %w/.git tmp log/ # default values
|
53
|
+
exclude += get_excludes('.gitignore')
|
54
|
+
exclude += get_excludes('.dockerignore')
|
55
|
+
exclude = exclude.uniq.map{|path| "--exclude='#{path}'"}.join(' ')
|
56
|
+
exclude
|
57
|
+
end
|
58
|
+
|
59
|
+
def user
|
60
|
+
@options[:user] || "ec2-user"
|
61
|
+
end
|
62
|
+
|
63
|
+
def host
|
64
|
+
@host ||= Host.new(@options)
|
65
|
+
end
|
66
|
+
|
67
|
+
# destination folder
|
68
|
+
def folder
|
69
|
+
src = src == '.' ? Dir.pwd : src
|
70
|
+
@options[:folder] || File.basename(src)
|
71
|
+
end
|
72
|
+
|
73
|
+
def src
|
74
|
+
src = @options[:cwd] || Dir.pwd
|
75
|
+
src[-1] == '/' ? src : "#{src}/" # ensure trailing /
|
76
|
+
end
|
77
|
+
|
78
|
+
def get_excludes(file)
|
79
|
+
exclude = []
|
80
|
+
path = "#{@options[:cwd]}/#{file}"
|
81
|
+
if File.exist?(path)
|
82
|
+
exclude = File.read(path).split("\n")
|
83
|
+
end
|
84
|
+
result = exclude.map {|i| i.strip}.reject {|i| i =~ /^#/ || i.empty?}
|
85
|
+
result
|
86
|
+
end
|
87
|
+
|
88
|
+
def note_time
|
89
|
+
puts "Last synced at: #{Time.now}".colorize(:green)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'filewatcher'
|
2
|
+
|
3
|
+
module AwsRsync
|
4
|
+
class Watch
|
5
|
+
def initialize(options)
|
6
|
+
@options = options
|
7
|
+
end
|
8
|
+
|
9
|
+
def run
|
10
|
+
Dir.chdir(@options[:cwd]) do
|
11
|
+
puts "Watching dir #{@options[:cwd]}"
|
12
|
+
ignore = %w[. .. .git log tmp] # TODO: dynamically look up ignores
|
13
|
+
files = Dir.glob(['.*','*']) - ignore
|
14
|
+
return false if @options[:noop]
|
15
|
+
Sync.new(@options).run
|
16
|
+
Filewatcher.new(files).watch() do |filename, event|
|
17
|
+
Sync.new(@options).run
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
# to run specs with what"s remembered from vcr
|
4
|
+
# $ rake
|
5
|
+
#
|
6
|
+
# to run specs with new fresh data from aws api calls
|
7
|
+
# $ rake clean:vcr ; time rake
|
8
|
+
describe AwsRsync::CLI do
|
9
|
+
before(:all) do
|
10
|
+
@args = "--from Tung"
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "aws-rsync" do
|
14
|
+
it "should hello world" do
|
15
|
+
out = execute("exe/aws-rsync hello world #{@args}")
|
16
|
+
expect(out).to include("from: Tung\nHello world")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
ENV["TEST"] = "1"
|
2
|
+
|
3
|
+
# require "simplecov"
|
4
|
+
# SimpleCov.start
|
5
|
+
|
6
|
+
require "pp"
|
7
|
+
|
8
|
+
root = File.expand_path("../../", __FILE__)
|
9
|
+
require "#{root}/lib/aws-rsync"
|
10
|
+
|
11
|
+
module Helpers
|
12
|
+
def execute(cmd)
|
13
|
+
puts "Running: #{cmd}" if ENV["DEBUG"]
|
14
|
+
out = `#{cmd}`
|
15
|
+
puts out if ENV["DEBUG"]
|
16
|
+
out
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
RSpec.configure do |c|
|
21
|
+
c.include Helpers
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,169 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: aws-rsync
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tung Nguyen
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-02-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: colorize
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: filewatcher
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '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'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: byebug
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Tool rsyncs local files to AWS EC2 instance for a faster development
|
112
|
+
flow
|
113
|
+
email:
|
114
|
+
- tongueroo@gmail.com
|
115
|
+
executables:
|
116
|
+
- aws-rsync
|
117
|
+
extensions: []
|
118
|
+
extra_rdoc_files: []
|
119
|
+
files:
|
120
|
+
- ".gitignore"
|
121
|
+
- ".rspec"
|
122
|
+
- CHANGELOG.md
|
123
|
+
- Gemfile
|
124
|
+
- Gemfile.lock
|
125
|
+
- Guardfile
|
126
|
+
- LICENSE.txt
|
127
|
+
- README.md
|
128
|
+
- Rakefile
|
129
|
+
- aws-rsync.gemspec
|
130
|
+
- exe/aws-rsync
|
131
|
+
- lib/aws-rsync.rb
|
132
|
+
- lib/aws_rsync/aws_services.rb
|
133
|
+
- lib/aws_rsync/cli.rb
|
134
|
+
- lib/aws_rsync/command.rb
|
135
|
+
- lib/aws_rsync/help.rb
|
136
|
+
- lib/aws_rsync/help/sync.md
|
137
|
+
- lib/aws_rsync/host.rb
|
138
|
+
- lib/aws_rsync/sync.rb
|
139
|
+
- lib/aws_rsync/version.rb
|
140
|
+
- lib/aws_rsync/watch.rb
|
141
|
+
- spec/lib/cli_spec.rb
|
142
|
+
- spec/spec_helper.rb
|
143
|
+
homepage: https://github.com/tongueroo/aws-rsync
|
144
|
+
licenses:
|
145
|
+
- MIT
|
146
|
+
metadata: {}
|
147
|
+
post_install_message:
|
148
|
+
rdoc_options: []
|
149
|
+
require_paths:
|
150
|
+
- lib
|
151
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
156
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
requirements: []
|
162
|
+
rubyforge_project:
|
163
|
+
rubygems_version: 2.7.3
|
164
|
+
signing_key:
|
165
|
+
specification_version: 4
|
166
|
+
summary: Tool rsyncs local files to AWS EC2 instance for a faster development flow
|
167
|
+
test_files:
|
168
|
+
- spec/lib/cli_spec.rb
|
169
|
+
- spec/spec_helper.rb
|