vagrant-sudo-rsync 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a07e77bbe856b76663eccc5dd6975afb8e2c1a07
4
+ data.tar.gz: 8c9fd12c29bb032f2fa563e7320e48f73cf341fa
5
+ SHA512:
6
+ metadata.gz: 68ed8f8b4471a642698fc44c8e616d807f1d077a75fb7881cebedea866a9e62f5ad0a12ae19e19d319ae3d73a897a4010ac01e8ed1b78eda442b4f33c3b3a922
7
+ data.tar.gz: 46463b184bf48e87e6ecaad73ea9d4b1ca85611c57295d7d4f463485160de3365e45127a6c009e0382e7e176da4102eec68b8b24ef9dbccbc2fe0acf2b1feebc
@@ -0,0 +1,2 @@
1
+ unreleased=true
2
+ future-release=0.1.0
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ .rbenv-gemsets
12
+ .ruby-version
13
+
14
+ .rubocop-http*
@@ -0,0 +1,2 @@
1
+ inherit_from:
2
+ - https://raw.githubusercontent.com/rails/rails/master/.rubocop.yml
@@ -0,0 +1,12 @@
1
+ # Change Log
2
+
3
+ ## [0.1.0](https://github.com/TypistTech/vagrant-sudo-rsync/tree/0.1.0) (2017-09-12)
4
+ **Merged pull requests:**
5
+
6
+ - Add rubocop [\#3](https://github.com/TypistTech/vagrant-sudo-rsync/pull/3) ([TangRufus](https://github.com/TangRufus))
7
+ - Add changelog [\#2](https://github.com/TypistTech/vagrant-sudo-rsync/pull/2) ([TangRufus](https://github.com/TangRufus))
8
+ - First release [\#1](https://github.com/TypistTech/vagrant-sudo-rsync/pull/1) ([TangRufus](https://github.com/TangRufus))
9
+
10
+
11
+
12
+ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
@@ -0,0 +1,46 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ ## Our Standards
8
+
9
+ Examples of behavior that contributes to creating a positive environment include:
10
+
11
+ * Using welcoming and inclusive language
12
+ * Being respectful of differing viewpoints and experiences
13
+ * Gracefully accepting constructive criticism
14
+ * Focusing on what is best for the community
15
+ * Showing empathy towards other community members
16
+
17
+ Examples of unacceptable behavior by participants include:
18
+
19
+ * The use of sexualized language or imagery and unwelcome sexual attention or advances
20
+ * Trolling, insulting/derogatory comments, and personal or political attacks
21
+ * Public or private harassment
22
+ * Publishing others' private information, such as a physical or electronic address, without explicit permission
23
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
24
+
25
+ ## Our Responsibilities
26
+
27
+ Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28
+
29
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30
+
31
+ ## Scope
32
+
33
+ This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34
+
35
+ ## Enforcement
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at vagrant-sudo-rsync@typist.tech. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38
+
39
+ Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40
+
41
+ ## Attribution
42
+
43
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44
+
45
+ [homepage]: http://contributor-covenant.org
46
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ group :development do
8
+ gem "bundler", "~> 1.15"
9
+ gem "rake", "~> 12.1"
10
+ gem "rubocop", "~> 0.49"
11
+ end
12
+
13
+ group :plugins do
14
+ gem "vagrant-sudo-rsync", path: "."
15
+ end
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Tang Rufus
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,112 @@
1
+ # Vagrant Sudo Rsync
2
+
3
+ [![Gem](https://img.shields.io/gem/v/vagrant-sudo-rsync.svg)](https://rubygems.org/gems/vagrant-sudo-rsync)
4
+ [![Gem](https://img.shields.io/gem/dt/vagrant-sudo-rsync.svg)](https://rubygems.org/gems/vagrant-sudo-rsync)
5
+ [![Dependency Status](https://gemnasium.com/badges/github.com/TypistTech/vagrant-sudo-rsync.svg)](https://gemnasium.com/github.com/TypistTech/vagrant-sudo-rsync)
6
+ [![license](https://img.shields.io/github/license/TypistTech/vagrant-sudo-rsync.svg)](https://github.com/TypistTech/vagrant-sudo-rsync/blob/master/LICENSE)
7
+ [![Donate via PayPal](https://img.shields.io/badge/Donate-PayPal-blue.svg)](https://www.typist.tech/donate/sunny/)
8
+ [![Hire Typist Tech](https://img.shields.io/badge/Hire-Typist%20Tech-ff69b4.svg)](https://www.typist.tech/contact/)
9
+
10
+ Copy files from/to a Vagrant VM with sudo and necessary SSH config
11
+
12
+ <!-- START doctoc generated TOC please keep comment here to allow auto update -->
13
+ <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
14
+
15
+
16
+ - [Installation](#installation)
17
+ - [Usage](#usage)
18
+ - [Support!](#support)
19
+ - [Donate via PayPal *](#donate-via-paypal-)
20
+ - [Why don't you hire me?](#why-dont-you-hire-me)
21
+ - [Want to help in other way? Want to be a sponsor?](#want-to-help-in-other-way-want-to-be-a-sponsor)
22
+ - [Feedback](#feedback)
23
+ - [Change log](#change-log)
24
+ - [Author Information](#author-information)
25
+ - [Contributing](#contributing)
26
+ - [License](#license)
27
+
28
+ <!-- END doctoc generated TOC please keep comment here to allow auto update -->
29
+
30
+ ## Installation
31
+
32
+ ```bash
33
+ $ vagrant plugin install vagrant-sudo-rsync
34
+ ```
35
+
36
+ ## Usage
37
+
38
+ ```bash
39
+ # General
40
+ ## This is equivalent to $ rsync --rsh=<automatically determined> --rsync-path='sudo rsync' [OPTION] SRC DEST
41
+ $ vagrant sudo-rsync [OPTION] SRC [DEST]
42
+
43
+ ## Synchronizing from local to remote
44
+ $ vagrant sudo-rsync [OPTION] <some_local_file_or_dir> :<somewhere_on_the_vm>
45
+
46
+ ## Synchronizing from remote to local
47
+ $ vagrant sudo-rsync [OPTION] :<somewhere_on_the_vm> <some_local_file_or_dir>
48
+
49
+ # Real life example
50
+
51
+ ## Listing all files under /etc/nginx/ssl on remote
52
+ $ vagrant sudo-rsync :/etc/nginx/ssl/
53
+ drwx------ 4,096 2017/09/12 00:32:17 .
54
+ -rw-r--r-- 424 2017/09/12 00:30:48 dhparams.pem
55
+ -rw-r--r-- 1,054 2017/09/12 00:32:17 www.example.cert
56
+ -rw-r--r-- 1,708 2017/09/12 00:32:17 www.example.key
57
+
58
+ ## Pulling /etc/nginx/ssl from remote to local desktop
59
+ $ vagrant sudo-rsync -av --delete --info=NAME :/etc/nginx/ssl ~/Desktop
60
+ receiving incremental file list
61
+ ssl/
62
+ ssl/dhparams.pem
63
+ ssl/www.example.com.cert
64
+ ssl/www.example.com.key
65
+
66
+ sent 85 bytes received 3,469 bytes 7,108.00 bytes/sec
67
+ total size is 3,186 speedup is 0.90
68
+ ```
69
+
70
+ - Prefix remote paths with colon (`:`)
71
+ - `--rsh` (or `-e`) is automatically determined by `$ vagrant ssh-config` automatically
72
+ - `--rsync-path` is set to `sudo rsync`
73
+ - Anything after `$ vagrant sudo-rsync` is passed to `$ rsync`
74
+ - Never specific `--rsh`, `-e` or `--rsync-path`
75
+
76
+ ## Support!
77
+
78
+ ### Donate via PayPal [![Donate via PayPal](https://img.shields.io/badge/Donate-PayPal-blue.svg)](https://www.typist.tech/donate/vagrant-sudo-rsync/)
79
+
80
+ Love Vagrant Sudo Rsync? Help me maintain it, a [donation here](https://www.typist.tech/donate/vagrant-sudo-rsync/) can help with it.
81
+
82
+ ### Why don't you hire me?
83
+
84
+ Ready to take freelance WordPress jobs. Contact me via the contact form [here](https://www.typist.tech/contact/) or, via email [info@typist.tech](mailto:info@typist.tech)
85
+
86
+ ### Want to help in other way? Want to be a sponsor?
87
+
88
+ Contact: [Tang Rufus](mailto:tangrufus@gmail.com)
89
+
90
+ ## Feedback
91
+
92
+ **Please provide feedback!** We want to make this library useful in as many projects as possible.
93
+ Please submit an [issue](https://github.com/TypistTech/vagrant-sudo-rsync/issues/new) and point out what you do and don't like, or fork the project and make suggestions.
94
+ **No issue is too small.**
95
+
96
+ ## Change log
97
+
98
+ Please see [CHANGELOG](./CHANGELOG.md) for more information on what has changed recently.
99
+
100
+ ## Author Information
101
+
102
+ [Vagrant Sudo Rsync](https://github.com/TypistTech/vagrant-sudo-rsync) is a [Typist Tech](https://www.typist.tech) project and maintained by [Tang Rufus](https://twitter.com/Tangrufus), freelance developer for [hire](https://www.typist.tech/contact/).
103
+
104
+ Full list of contributors can be found [here](https://github.com/TypistTech/vagrant-sudo-rsync/graphs/contributors).
105
+
106
+ ## Contributing
107
+
108
+ Please see [CODE_OF_CONDUCT](./CODE_OF_CONDUCT.md) for details.
109
+
110
+ ## License
111
+
112
+ [Vagrant Sudo Rsync](https://github.com/TypistTech/vagrant-sudo-rsync) is released under the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "vagrant_sudo_rsync/identity"
4
+ require "vagrant_sudo_rsync/plugin"
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "open3"
4
+
5
+ module VagrantSudoRsync
6
+ class Command < Vagrant.plugin("2", :command)
7
+ def self.synopsis
8
+ "run rsync command with sudo and necessary SSH config"
9
+ end
10
+
11
+ def execute
12
+ ARGV.shift
13
+
14
+ command = [
15
+ "rsync",
16
+ "--rsh='#{rsh}'",
17
+ "--rsync-path='sudo rsync'",
18
+ ARGV
19
+ ].join(" ")
20
+
21
+ system(command)
22
+ end
23
+
24
+ def rsh
25
+ "ssh " + capture("echo '#{vagrant_ssh_config_without_host}' | awk -v ORS=' ' 'NF {print \"-o \" $1 \"=\" $2}'")
26
+ end
27
+
28
+ def vagrant_ssh_config_without_host
29
+ capture("echo '#{vagrant_ssh_config}' | grep -v '^Host '")
30
+ end
31
+
32
+ def vagrant_ssh_config
33
+ capture("vagrant ssh-config")
34
+ end
35
+
36
+ def capture(command)
37
+ stdout, stderr, status = Open3.capture3(command)
38
+
39
+ unless status.success?
40
+ @env.ui.error(stderr)
41
+ raise CLIInvalidUsage
42
+ end
43
+
44
+ stdout
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VagrantSudoRsync
4
+ # Gem identity information.
5
+ module Identity
6
+ def self.name
7
+ "vagrant-sudo-rsync"
8
+ end
9
+
10
+ def self.version
11
+ "0.1.0"
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VagrantSudoRsync
4
+ class Plugin < Vagrant.plugin("2")
5
+ name Identity.name
6
+
7
+ command "sudo-rsync" do
8
+ require_relative "command"
9
+ Command
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ lib = File.expand_path("../lib", __FILE__)
5
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
+ require "vagrant_sudo_rsync/identity"
7
+
8
+ Gem::Specification.new do |spec|
9
+ spec.name = VagrantSudoRsync::Identity.name
10
+ spec.version = VagrantSudoRsync::Identity.version
11
+ spec.authors = ["Tang Rufus", "Typist Tech"]
12
+ spec.email = ["tangrufus@gmail.com", "vagrant-sudo-rsync@typist.tech"]
13
+
14
+ spec.summary = "Copy files from/to a Vagrant VM with sudo and necessary SSH config"
15
+ spec.homepage = "https://www.typist.tech/projects/vagrant-sudo-rsync"
16
+ spec.license = "MIT"
17
+
18
+
19
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
20
+ f.match(%r{^(test|spec|features)/})
21
+ end
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.required_ruby_version = "~> 2.2", "< 2.4"
27
+ spec.required_rubygems_version = ">= 1.3.6"
28
+
29
+ spec.add_development_dependency "bundler", "~> 1.15"
30
+ spec.add_development_dependency "rake", "~> 12.1"
31
+ spec.add_development_dependency "rubocop", "~> 0.49"
32
+ end
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-sudo-rsync
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Tang Rufus
8
+ - Typist Tech
9
+ autorequire:
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 2017-09-11 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '1.15'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '1.15'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rake
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '12.1'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '12.1'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rubocop
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '0.49'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '0.49'
56
+ description:
57
+ email:
58
+ - tangrufus@gmail.com
59
+ - vagrant-sudo-rsync@typist.tech
60
+ executables: []
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - ".github_changelog_generator"
65
+ - ".gitignore"
66
+ - ".rubocop.yml"
67
+ - CHANGELOG.md
68
+ - CODE_OF_CONDUCT.md
69
+ - Gemfile
70
+ - LICENSE.txt
71
+ - README.md
72
+ - Rakefile
73
+ - lib/vagrant-sudo-rsync.rb
74
+ - lib/vagrant_sudo_rsync/command.rb
75
+ - lib/vagrant_sudo_rsync/identity.rb
76
+ - lib/vagrant_sudo_rsync/plugin.rb
77
+ - vagrant-sudo-rsync.gemspec
78
+ homepage: https://www.typist.tech/projects/vagrant-sudo-rsync
79
+ licenses:
80
+ - MIT
81
+ metadata: {}
82
+ post_install_message:
83
+ rdoc_options: []
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '2.2'
91
+ - - "<"
92
+ - !ruby/object:Gem::Version
93
+ version: '2.4'
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: 1.3.6
99
+ requirements: []
100
+ rubyforge_project:
101
+ rubygems_version: 2.5.2
102
+ signing_key:
103
+ specification_version: 4
104
+ summary: Copy files from/to a Vagrant VM with sudo and necessary SSH config
105
+ test_files: []