vagrant-darwin-smb 0.1.2

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a651792e9af051045ad0b727578213a350ef1fb8
4
+ data.tar.gz: 80cc48c1096a3abc41c8fef5523f00c7ef28ae78
5
+ SHA512:
6
+ metadata.gz: 2ffcc582def29a394925e20b36297fa4322d260ebfd1580e3e93d2ae95ca09403c543b2de7d5167a610f89e42129f4ec5ce7292f3fe7b56135f27b7e722b9185
7
+ data.tar.gz: 57277439f16e9f6ecbdcada8c414db7e6c4bc9e1840e269a6375a898465663ce28edf31240c49a25326f3cd70ee2a210828f42cfdf0b041cb4c378f587e0b2ee
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ # Bundler/Rubygems
2
+ *.gem
3
+ Gemfile.lock
4
+ /.bundle/
5
+ /pkg/
6
+
7
+ # RVM files for gemset/ruby setting
8
+ .ruby-*
9
+ .rvmrc
10
+
11
+ # Vagrant
12
+ .vagrant
13
+ Vagrantfile
14
+
15
+ # OS-specific
16
+ .DS_Store
17
+
18
+ # editors
19
+ *.swp
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source "https://rubygems.org"
2
+
3
+ group :development do
4
+ gem "vagrant", git: "https://github.com/mitchellh/vagrant.git"
5
+ end
6
+
7
+ group :plugins do
8
+ gem "vagrant-darwin-smb", path: "."
9
+ end
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2015 alh84001 https://github.com/alh84001
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.
22
+
data/README.md ADDED
@@ -0,0 +1,14 @@
1
+ # vagrant-darwin-smb plugin
2
+ This plugin provides capability to add SMB synced folders to Darwin (OS X) guests. It is a simple wrapper/proxy to [mount_smbfs](http://linux.die.net/man/8/smbmount) command.
3
+
4
+ ## Installation
5
+ $ vagrant plugin install vagrant-darwin-smb
6
+
7
+ ## Usage
8
+ Define SMB synced folders in your Vagrantfile as usual. It should just work. If you need custom options you can pass an array of strings as `mount_options` parameter.
9
+
10
+ ## Caveats
11
+ Currently, there is no ability to pass -f, -d or -N parameters to mount_smbfs.
12
+
13
+ ## Acknowledgments
14
+ This plugin steals shamelessly from core Vagrant Darwin NFS and Linux SMB capabilities. All credit goes to Vagrant guys.
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,17 @@
1
+ module VagrantDarwinSMB
2
+ module Cap
3
+ class ChooseAddressableIpAddr
4
+ def self.choose_addressable_ip_addr(machine, possible)
5
+ machine.communicate.tap do |comm|
6
+ possible.each do |ip|
7
+ command = "ping -c1 -t1 #{ip}"
8
+ if comm.test(command)
9
+ return ip
10
+ end
11
+ end
12
+ end
13
+ nil
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,32 @@
1
+ require "shellwords"
2
+
3
+ module VagrantDarwinSMB
4
+ module Errors
5
+ class DarwinMountFailed < Vagrant::Errors::VagrantError
6
+ error_key(:darwin_mount_failed)
7
+ end
8
+ end
9
+
10
+ module Cap
11
+ class MountSMBSharedFolder
12
+ extend Vagrant::Util::Retryable
13
+ def self.mount_smb_shared_folder(machine, name, guestpath, options)
14
+ expanded_guest_path = machine.guest.capability(:shell_expand_guest_path, guestpath)
15
+ # create the guest path if it doesn't exist
16
+ machine.communicate.execute("mkdir -p #{expanded_guest_path}")
17
+
18
+ smb_password = Shellwords.shellescape(options[:smb_password])
19
+ mount_opts = options[:mount_options];
20
+ mount_command = "mount -t smbfs " +
21
+ (mount_opts ? "-o '#{mount_opts.join(",")}' " : "") +
22
+ "'//#{options[:smb_username]}:#{smb_password}@#{options[:smb_host]}/#{name}' " +
23
+ "#{expanded_guest_path}"
24
+ retryable(on: Errors::DarwinMountFailed, tries: 10, sleep: 5) do
25
+ machine.communicate.execute(
26
+ mount_command,
27
+ error_class: Errors::DarwinMountFailed)
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,29 @@
1
+ begin
2
+ require 'vagrant'
3
+ rescue LoadError
4
+ raise "The Vagrant Darwin SMB plugin must be run within Vagrant."
5
+ end
6
+
7
+ if Vagrant::VERSION < "1.5.0"
8
+ raise "The Vagrant Darwin SMB plugin is only compatible with Vagrant 1.5.0+"
9
+ end
10
+
11
+ module VagrantDarwinSMB
12
+ class Plugin < Vagrant.plugin('2')
13
+ name 'DarwinSMB'
14
+
15
+ description <<-DESC
16
+ This plugin adds SMB share support in Darwin for Vagrant.
17
+ DESC
18
+
19
+ guest_capability("darwin", "mount_smb_shared_folder") do
20
+ require_relative "cap/mount_smb_shared_folder"
21
+ Cap::MountSMBSharedFolder
22
+ end
23
+
24
+ guest_capability("darwin", "choose_addressable_ip_addr") do
25
+ require_relative "cap/choose_addressable_ip_addr"
26
+ Cap::ChooseAddressableIpAddr
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,3 @@
1
+ module VagrantDarwinSMB
2
+ VERSION = "0.1.2"
3
+ end
@@ -0,0 +1,4 @@
1
+ module VagrantDarwinSMB
2
+ require 'vagrant-darwin-smb/version'
3
+ require 'vagrant-darwin-smb/plugin'
4
+ end
@@ -0,0 +1,20 @@
1
+ # coding: utf-8
2
+ $:.unshift File.expand_path("../lib", __FILE__)
3
+ require 'vagrant-darwin-smb/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "vagrant-darwin-smb"
7
+ spec.version = VagrantDarwinSMB::VERSION
8
+ spec.authors = ["alh84001"]
9
+ spec.email = ["alh84001.hr@hotmail.com"]
10
+
11
+ spec.summary = %q{Adds SMB synced folder capability to a Darwin guest.}
12
+ spec.homepage = "https://github.com/alh84001/vagrant-darwin-smb"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.require_path = 'lib'
17
+
18
+ spec.add_development_dependency "bundler", "~> 1.7"
19
+ spec.add_development_dependency "rake", "~> 10.0"
20
+ end
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-darwin-smb
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ platform: ruby
6
+ authors:
7
+ - alh84001
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-24 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.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
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
+ description:
42
+ email:
43
+ - alh84001.hr@hotmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - LICENSE
51
+ - README.md
52
+ - Rakefile
53
+ - lib/vagrant-darwin-smb.rb
54
+ - lib/vagrant-darwin-smb/cap/choose_addressable_ip_addr.rb
55
+ - lib/vagrant-darwin-smb/cap/mount_smb_shared_folder.rb
56
+ - lib/vagrant-darwin-smb/plugin.rb
57
+ - lib/vagrant-darwin-smb/version.rb
58
+ - vagrant-darwin-smb.gemspec
59
+ homepage: https://github.com/alh84001/vagrant-darwin-smb
60
+ licenses:
61
+ - MIT
62
+ metadata: {}
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 2.2.3
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: Adds SMB synced folder capability to a Darwin guest.
83
+ test_files: []