vagrant-sshfs 0.0.6 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c91c4d0b5c14a9aa152ee7aeb65858d5bac9d84b
4
- data.tar.gz: edc3eb21abb620de264de82c30c0027b7f4aa8f1
3
+ metadata.gz: 40c211084d6df40b60293757b4dcc3775534d680
4
+ data.tar.gz: 512170ebed792cdfaa5874d8b00bd0c36e418b0f
5
5
  SHA512:
6
- metadata.gz: 985d4973184f6c796efc6e6cd2ee4dfa2bac5f37f1f4eaa2fac3afa990d2f79ac10df299500f2b3f893ff65b1e4a6dcda362139407a2f2d2558d233142ac9ae6
7
- data.tar.gz: 536cd4c49ccae0b37fdc2875e39bf884e246101b519b2c0481868fd876accf611c937d5dbab0a1cefd26e6e537249adba1b75bff83f907e60734c78a879ea74a
6
+ metadata.gz: 60fb794de0eb03d139ab3c6369809b186640c02c0067f36087fe844f4cfff9ebcfc6ab5a8ef3960eba9567c1956ff2fcf5d2f1bb5454034628c40b4d33b1fb87
7
+ data.tar.gz: 6b180c7cc99ae728491220c39eb4ac7ae91eabff27ae6d05c1fb3ca95633989340393d9b53f425636ddd426292c3e20abca9b9e490f5a86926f95823c77632b9
data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  mountpoint
3
3
  .vagrant
4
4
  *.gem
5
+ .idea
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## vagrant-sshfs 0.0.8 (Jun 2, 2015) ##
2
+
3
+ * Fixed unicode character issue
4
+
5
+ *seasick*
6
+
7
+ ## vagrant-sshfs 0.0.7 (Dec 8, 2014) ##
8
+
9
+ * Smooth folders creation.
10
+ * Unmount on machine Destroy/Halt/Suspend
11
+ * Remount on machine Resume/Provision/Suspend
12
+
13
+ *dmatora*
14
+
1
15
  ## vagrant-sshfs 0.0.6 (Oct 14, 2014) ##
2
16
 
3
17
  * Avoids StrictHostKeyChecking by default.
data/Gemfile.lock CHANGED
@@ -14,7 +14,7 @@ GIT
14
14
  PATH
15
15
  remote: .
16
16
  specs:
17
- vagrant-sshfs (0.0.5)
17
+ vagrant-sshfs (0.0.6)
18
18
 
19
19
  GEM
20
20
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -26,6 +26,14 @@ The plugin is enabled by default, so it will run everytime the machine starts. I
26
26
 
27
27
  `config.sshfs.enabled = false`
28
28
 
29
+ The plugin creates missing folder by default, if you want to be prompted, you can disable it with the following configuration:
30
+
31
+ `config.sshfs.prompt_create_folders = false`
32
+
33
+ The plugin is creating folders using sudo by default, In case that is not desired, you can disable that with the following configuration:
34
+
35
+ `config.sshfs.sudo = false`
36
+
29
37
  To manually run it, you can use the `sshfs` command. Please check `vagrant -h`.
30
38
 
31
39
  ## Issues
@@ -5,15 +5,11 @@ require 'vagrant-sshfs/builders/guest'
5
5
  module Vagrant
6
6
  module SshFS
7
7
  module Actions
8
- class Up
8
+ class Base
9
9
  def initialize(app, env)
10
10
  @machine = env[:machine]
11
11
  end
12
12
 
13
- def call(env)
14
- get_builder(env).mount! if @machine.config.sshfs.enabled
15
- end
16
-
17
13
  private
18
14
 
19
15
  def get_builder(env)
@@ -25,7 +21,23 @@ module Vagrant
25
21
  end
26
22
  end
27
23
 
24
+ class Up < Base
25
+ def call(env)
26
+ get_builder(env).mount! if @machine.config.sshfs.enabled
27
+ end
28
+ end
29
+
30
+ class Destroy < Base
31
+ def call(env)
32
+ get_builder(env).unmount! if @machine.config.sshfs.enabled
33
+ end
34
+ end
35
+
28
36
  class Reload < Up; end
37
+ class Provision < Up; end
38
+ class Suspend < Destroy; end
39
+ class Resume < Up; end
40
+ class Halt < Destroy; end
29
41
  end
30
42
  end
31
43
  end
@@ -9,14 +9,21 @@ module Vagrant
9
9
  end
10
10
 
11
11
  def mount!
12
+ unmount!
13
+
12
14
  paths.each do |src, target|
13
- info("unmounting", src: target)
14
- unmount(target)
15
15
  info("mounting", src: src, target: target)
16
16
  mount(src, target)
17
17
  end
18
18
  end
19
19
 
20
+ def unmount!
21
+ paths.each do |src, target|
22
+ info("unmounting", src: target)
23
+ unmount(target)
24
+ end
25
+ end
26
+
20
27
  def mount
21
28
  raise NotImplementedError
22
29
  end
@@ -8,7 +8,8 @@ module Vagrant
8
8
 
9
9
  def unmount(target)
10
10
  if `which fusermount`.empty?
11
- `umount #{target}`
11
+ `killall -9 sshfs 2>/dev/null`
12
+ `umount -f #{target}`
12
13
  else
13
14
  `fusermount -u -q #{target}`
14
15
  end
@@ -50,8 +51,12 @@ module Vagrant
50
51
 
51
52
  def check_src!(src)
52
53
  unless machine.communicate.test("test -d #{src}")
53
- if ask("create_src", src: src) == "y"
54
- machine.communicate.execute("mkdir -p #{src}")
54
+ if machine.config.sshfs.prompt_create_folders == false || ask("create_src", src: src) == "y"
55
+ if machine.config.sshfs.sudo
56
+ machine.communicate.execute("sudo su -c 'mkdir -p #{src}'")
57
+ else
58
+ machine.communicate.execute("mkdir -p #{src}")
59
+ end
55
60
  info("created_src", src: src)
56
61
  else
57
62
  error("not_created_src", src: src)
@@ -68,7 +73,7 @@ module Vagrant
68
73
  if File.exist?(folder) && Dir.entries(folder).size > 2
69
74
  error("non_empty_target", target: folder)
70
75
  elsif !File.exist?(folder)
71
- if ask("create_target", target: folder) == "y"
76
+ if machine.config.sshfs.prompt_create_folders == false || ask("create_target", target: folder) == "y"
72
77
  FileUtils.mkdir_p(folder)
73
78
  info("created_target", target: folder)
74
79
  else
@@ -4,6 +4,8 @@ module Vagrant
4
4
  attr_accessor :paths
5
5
  attr_accessor :username
6
6
  attr_accessor :enabled
7
+ attr_accessor :prompt_create_folders
8
+ attr_accessor :sudo
7
9
  attr_accessor :mount_on_guest
8
10
  attr_accessor :host_addr
9
11
 
@@ -11,6 +13,8 @@ module Vagrant
11
13
  @paths = {}
12
14
  @username = nil
13
15
  @enabled = true
16
+ @prompt_create_folders = false
17
+ @sudo = true
14
18
  end
15
19
 
16
20
  def merge(other)
@@ -17,6 +17,26 @@ module Vagrant
17
17
  hook.append(Vagrant::SshFS::Actions::Reload)
18
18
  end
19
19
 
20
+ action_hook(:sshfs, :machine_action_provision) do |hook|
21
+ hook.append(Vagrant::SshFS::Actions::Provision)
22
+ end
23
+
24
+ action_hook(:sshfs, :machine_action_suspend) do |hook|
25
+ hook.append(Vagrant::SshFS::Actions::Suspend)
26
+ end
27
+
28
+ action_hook(:sshfs, :machine_action_resume) do |hook|
29
+ hook.append(Vagrant::SshFS::Actions::Resume)
30
+ end
31
+
32
+ action_hook(:sshfs, :machine_action_halt) do |hook|
33
+ hook.append(Vagrant::SshFS::Actions::Halt)
34
+ end
35
+
36
+ action_hook(:sshfs, :machine_action_destroy) do |hook|
37
+ hook.append(Vagrant::SshFS::Actions::Destroy)
38
+ end
39
+
20
40
  command "sshfs" do
21
41
  Vagrant::SshFS::Command
22
42
  end
@@ -1,5 +1,5 @@
1
1
  module Vagrant
2
2
  module SshFS
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.8"
4
4
  end
5
5
  end
data/locales/en.yml CHANGED
@@ -9,8 +9,8 @@ en:
9
9
  created_src: "Created src `%{src}`"
10
10
  created_target: "Created target `%{target}`"
11
11
  ask:
12
- create_src: "Source folder `%{src}` does not exist, create?"
13
- create_target: "Target folder `%{target}` does not exist, create?"
12
+ create_src: "Source folder `%{src}` does not exist, create? (y/n)"
13
+ create_target: "Target folder `%{target}` does not exist, create? (y/n)"
14
14
  pass: "Password for `%{user}`:"
15
15
  error:
16
16
  base: "vagrant-sshfs failed and couldn't proceed"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-sshfs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - fabiokr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-15 00:00:00.000000000 Z
11
+ date: 2015-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  version: '0'
85
85
  requirements: []
86
86
  rubyforge_project:
87
- rubygems_version: 2.2.2
87
+ rubygems_version: 2.2.3
88
88
  signing_key:
89
89
  specification_version: 4
90
90
  summary: A Vagrant plugin that mounts folders with sshfs in the host machine.