vagrant-winrm-syncedfolders 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: 868b9258f8e103e9dc60e643f19788dab619c748
4
+ data.tar.gz: 82982f674a94cf23045f83e09966673ec3374882
5
+ SHA512:
6
+ metadata.gz: aafb45924e7bf8c69cfe4b77ac1ebe616c90be8ab32a498f42037a25aa926a66aac1d4cf04979c4517aa308c857685b2f7ce2549a89693fdce2e767ee3d6bd99
7
+ data.tar.gz: 504d785790e6a05c532f7d2ed07b97c0401622a339bf694278ba5f6a9cfd854eace513d7bf3d4c197ed90471529a35ddb690673b61535218e6148966ca4ab199
@@ -0,0 +1,17 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+
16
+ /.vagrant/
17
+ .DS_Store
@@ -0,0 +1,24 @@
1
+ AllCops:
2
+ Exclude:
3
+ - '*.gemspec'
4
+
5
+ Metrics/LineLength:
6
+ Max: 120
7
+
8
+ Metrics/ClassLength:
9
+ Max: 150
10
+
11
+ Style/Documentation:
12
+ Enabled: false
13
+
14
+ Metrics/MethodLength:
15
+ Max: 20
16
+
17
+ StringLiterals:
18
+ EnforcedStyle: double_quotes
19
+
20
+ Style/FileName:
21
+ Enabled: false
22
+
23
+ Metrics/AbcSize:
24
+ Max: 100
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in vagrant-orchestrate.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem "vagrant", git: "https://github.com/mitchellh/vagrant.git", ref: "v1.7.2"
8
+ end
9
+
10
+ group :plugins do
11
+ gem "vagrant-winrm-syncedfolders", path: "."
12
+ end
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2015 Cimpress
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
@@ -0,0 +1,32 @@
1
+ # vagrant-winrm-syncedfolders
2
+
3
+ Vagrant plugin that allows you to use WinRM as a folder synchronization mechanism.
4
+
5
+ *Limitations:* The WinRM communicator that is used to perform the folder synchronization is known to be slow for large numbers of files.
6
+
7
+ ## Installation
8
+
9
+ vagrant plugin install vagrant-winrm-syncedfolders
10
+
11
+ ## Usage
12
+
13
+ Upon installation of this plugin the priority order of synced folders for Windows guests will be as follows:
14
+
15
+ - SMB
16
+ - WinRM
17
+ - Rsync
18
+
19
+ It is also possible to force a synced folder to use the WinRM:
20
+
21
+ config.vm.synced_folder ".", "/vagrant", type: "winrm"
22
+
23
+ ## Contributing
24
+
25
+ In order to run this locally, the Vagrantfile is set to use the [boxcutter](https://github.com/boxcutter/windows)/eval-win7x86-enterprise box. If you don't already have this installed, here are some [instructions](https://github.com/tknerr/vagrant-managed-servers/pull/48).
26
+
27
+ 1. Fork it ( https://github.com/Cimpress-MCP/vagrant-winrm-syncedfolders/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Run the lint and build locally (`bundle exec rake build`)
31
+ 5. Push to the branch (`git push origin my-new-feature`)
32
+ 6. Create a new Pull Request
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rubocop/rake_task"
3
+
4
+ RuboCop::RakeTask.new
5
+
6
+ task build: ["rubocop:auto_correct"]
7
+ task default: :build
@@ -0,0 +1,8 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ Vagrant.configure("2") do |config|
5
+ config.vm.box = "boxcutter/eval-win7x86-enterprise"
6
+ config.vm.communicator = :winrm
7
+ config.vm.synced_folder ".", "/vagrant", type: "winrm"
8
+ end
@@ -0,0 +1,14 @@
1
+ require "pathname"
2
+
3
+ require "vagrant-winrm-syncedfolders/plugin"
4
+
5
+ module VagrantPlugins
6
+ module SyncedFolderWinRM
7
+ # This returns the path to the source of this plugin.
8
+ #
9
+ # @return [Pathname]
10
+ def self.source_root
11
+ @source_root ||= Pathname.new(File.expand_path("../../", __FILE__))
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,24 @@
1
+ require "vagrant"
2
+
3
+ module VagrantPlugins
4
+ module SyncedFolderWinRM
5
+ # This plugin implements WinRM synced folders.
6
+ class Plugin < Vagrant.plugin("2")
7
+ name "WinRM synced folders"
8
+ description <<-EOF
9
+ The WinRM synced folders plugin enables you to use WinRM as a mechanism
10
+ to transfer files to a guest machine. There are known limitations to this
11
+ mechanism, most notably that file tranfer is slow for large numbers of files.
12
+ EOF
13
+
14
+ synced_folder("winrm", 6) do
15
+ require_relative "synced_folder"
16
+ init!
17
+ SyncedFolder
18
+ end
19
+
20
+ def self.init!
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,46 @@
1
+ require "log4r"
2
+
3
+ require "vagrant/util/retryable"
4
+
5
+ module VagrantPlugins
6
+ module SyncedFolderWinRM
7
+ class SyncedFolder < Vagrant.plugin("2", :synced_folder)
8
+ include Vagrant::Util::Retryable
9
+
10
+ def initialize(*args)
11
+ super
12
+ @logger = Log4r::Logger.new("vagrant::synced_folders::winrm")
13
+ end
14
+
15
+ def usable?(machine, _raise_error = false)
16
+ machine.config.vm.communicator == :winrm
17
+ end
18
+
19
+ def prepare(_machine, _folders, _opts)
20
+ end
21
+
22
+ def enable(machine, folders, _nfsopts)
23
+ folders.each do |_id, data|
24
+ hostpath = File.expand_path(data[:hostpath], machine.env.root_path)
25
+ guestpath = data[:guestpath]
26
+
27
+ machine.ui.info("Uploading with WinRM: #{hostpath} => #{guestpath}")
28
+ machine.communicate.tap do |comm|
29
+ # When syncing many files, we've see SEC_E_INVALID_TOKEN errors
30
+ # that appear to be transient (try again and it goes away). Let's
31
+ # retry a few times to add some robustness.
32
+ attempts = 1
33
+ retryable(tries: 3, sleep: 1) do
34
+ @logger.debug("Attempting WinRM upload attempt number #{attempts}")
35
+ comm.upload(hostpath, guestpath)
36
+ attempts += 1
37
+ end
38
+ end
39
+ end
40
+ end
41
+
42
+ def cleanup(_machine, _opts)
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,5 @@
1
+ module VagrantPlugins
2
+ module SyncedFolderWinRM
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "vagrant-winrm-syncedfolders/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vagrant-winrm-syncedfolders"
8
+ spec.version = VagrantPlugins::SyncedFolderWinRM::VERSION
9
+ spec.authors = ["Christopher Baldauf"]
10
+ spec.email = ["cbaldauf@cimpress.com"]
11
+ spec.summary = %q{Use WinRM synced folders for Windows guests using the WinRM communcator}
12
+ spec.homepage = "https://github.com/Cimpress-MCP/vagrant-winrm-syncedfolders"
13
+ spec.license = "Apache 2.0"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.6"
21
+ spec.add_development_dependency "rake", "~> 10.0"
22
+ spec.add_development_dependency "rspec", "~> 2.14"
23
+ spec.add_development_dependency "rubocop", "~> 0.28"
24
+ end
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-winrm-syncedfolders
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Christopher Baldauf
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.14'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.14'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.28'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.28'
69
+ description:
70
+ email:
71
+ - cbaldauf@cimpress.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rubocop.yml"
78
+ - Gemfile
79
+ - LICENSE
80
+ - README.md
81
+ - Rakefile
82
+ - Vagrantfile
83
+ - lib/vagrant-winrm-syncedfolders.rb
84
+ - lib/vagrant-winrm-syncedfolders/plugin.rb
85
+ - lib/vagrant-winrm-syncedfolders/synced_folder.rb
86
+ - lib/vagrant-winrm-syncedfolders/version.rb
87
+ - vagrant-winrm-syncedfolders.gemspec
88
+ homepage: https://github.com/Cimpress-MCP/vagrant-winrm-syncedfolders
89
+ licenses:
90
+ - Apache 2.0
91
+ metadata: {}
92
+ post_install_message:
93
+ rdoc_options: []
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ requirements: []
107
+ rubyforge_project:
108
+ rubygems_version: 2.2.3
109
+ signing_key:
110
+ specification_version: 4
111
+ summary: Use WinRM synced folders for Windows guests using the WinRM communcator
112
+ test_files: []