vagrant-lxss-plugin 0.0.1 → 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 +4 -4
- data/.gitignore +1 -1
- data/Gemfile +1 -0
- data/README.MD +39 -0
- data/lib/vagrant-lxss-plugin.rb +1 -0
- data/lib/vagrant-lxss-plugin/command.rb +6 -19
- data/lib/vagrant-lxss-plugin/errors.rb +18 -0
- data/lib/vagrant-lxss-plugin/plugin.rb +1 -1
- data/lib/vagrant-lxss-plugin/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35abb438782703a15fc982c8fcc260f039c9cbce
|
4
|
+
data.tar.gz: 7a11713022ebaf95cf70250fdf41671292e8234b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97371b5ce681258c0836b669a13244b2b1d3b2dadac16350e33270fa31dee3e4b0e6ca8f3c647e15ff89162e3de9a23d4bd4385505d6a79393b1caada6afbde8
|
7
|
+
data.tar.gz: bb90c6e691f9a1737619138f05178be6f8f0f6f492253d4b5b5006950f9e053c941a53c4a902b31a4abcb853335a2b3eae5d473af9c51308a7de7a8cbfdf63f6
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/README.MD
CHANGED
@@ -1,4 +1,43 @@
|
|
1
1
|
vagrant-lxss-plugin
|
2
2
|
===================
|
3
3
|
|
4
|
+
[](https://rubygems.org/gems/vagrant-lxss-plugin)
|
5
|
+
[](https://rubygems.org/gems/vagrant-lxss-plugin)
|
6
|
+
[](https://raw.githubusercontent.com/csh/vagrant-lxss-plugin/master/LICENSE)
|
7
|
+
[](https://github.com/csh/vagrant-lxss-plugin/issues)
|
8
|
+
|
4
9
|
Simple plugin to enable you to SSH into Vagrant machines using Bash on Ubuntu on Windows.
|
10
|
+
|
11
|
+
_This serves as a way of getting me back into Ruby, so there may be some silly bugs._
|
12
|
+
|
13
|
+
### Installation
|
14
|
+
|
15
|
+
Obviously to make use of this plugin you must have Bash on Ubuntu on Windows installed,
|
16
|
+
I won't cover that here so here's [a nice article][install_bash] on how to do it.
|
17
|
+
|
18
|
+
Install the plugin from RubyGems using the following command:
|
19
|
+
|
20
|
+
```
|
21
|
+
vagrant plugin install vagrant-lxss-plugin
|
22
|
+
```
|
23
|
+
|
24
|
+
Alternatively if you feel like the `master` branch is more up-to-date than the
|
25
|
+
released version then you may run the following commands to install the latest
|
26
|
+
version:
|
27
|
+
|
28
|
+
```
|
29
|
+
git clone https://github.com/csh/vagrant-lxss-plugin.git
|
30
|
+
cd vagrant-lxss-plugin
|
31
|
+
rake build
|
32
|
+
vagrant plugin install pkg/vagrant-lxss-plugin-x.x.x.gem
|
33
|
+
```
|
34
|
+
|
35
|
+
### Usage
|
36
|
+
|
37
|
+
Once the plugin is installed you simply use `bash` instead of `ssh` when connecting to a VM.
|
38
|
+
|
39
|
+
```
|
40
|
+
vagrant bash homestead-7
|
41
|
+
```
|
42
|
+
|
43
|
+
[install_bash]: http://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/
|
data/lib/vagrant-lxss-plugin.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require_relative 'errors'
|
1
2
|
require 'optparse'
|
2
3
|
|
3
4
|
module VagrantLxss
|
@@ -7,8 +8,7 @@ module VagrantLxss
|
|
7
8
|
end
|
8
9
|
|
9
10
|
def execute
|
10
|
-
raise
|
11
|
-
raise Vagrant::Errors::CapabilityNotFound unless is_bash_installed?
|
11
|
+
raise VagrantLxss::RequiredProcessNotFound unless is_bash_installed?
|
12
12
|
|
13
13
|
options = {
|
14
14
|
:help => false
|
@@ -38,7 +38,7 @@ module VagrantLxss
|
|
38
38
|
ssh_options = ["#{ssh_info[:username]}@#{ssh_info[:host]}"]
|
39
39
|
ssh_options += ["-p #{ssh_info[:port]}"] if ssh_info[:port] != 22
|
40
40
|
ssh_options += ["-A"] if ssh_info[:forward_agent]
|
41
|
-
ssh_options += ["-v"]
|
41
|
+
# ssh_options += ["-v"]
|
42
42
|
|
43
43
|
key_file = nil
|
44
44
|
dir = nil
|
@@ -58,27 +58,14 @@ module VagrantLxss
|
|
58
58
|
end
|
59
59
|
|
60
60
|
command = "C:\\Windows\\system32\\bash.exe -c 'ssh #{ssh_options.join(' ')}'"
|
61
|
-
@logger.
|
62
|
-
|
63
|
-
@logger.info("Output: #{output}")
|
61
|
+
@logger.debug("Full command: \"#{command}\"")
|
62
|
+
system(command)
|
64
63
|
return 0
|
65
64
|
end
|
66
65
|
end
|
67
66
|
|
68
67
|
def is_bash_installed?
|
69
|
-
system("C:\\Windows\\system32\\bash.exe -c '
|
70
|
-
end
|
71
|
-
|
72
|
-
def is_win_x?
|
73
|
-
false unless Gem.win_platform?
|
74
|
-
result = `cmd /C ver`
|
75
|
-
return result =~ /\[Version 10.*\]/
|
76
|
-
end
|
77
|
-
|
78
|
-
def convert_path (path)
|
79
|
-
path = path.gsub '\\', '/'
|
80
|
-
path = path.gsub (/^([A-Z])\:\//i) { '/mnt/' << $1.downcase << '/' }
|
81
|
-
return path
|
68
|
+
return system("C:\\Windows\\system32\\bash.exe -c 'printf \"\n\"'")
|
82
69
|
end
|
83
70
|
end
|
84
71
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module VagrantLxss
|
2
|
+
class RequiredProcessNotFound < Vagrant::Errors::VagrantError
|
3
|
+
error_message <<-EOF
|
4
|
+
Could not find Bash installed on your system.
|
5
|
+
Please follow the guide here to enable it:
|
6
|
+
http://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/
|
7
|
+
|
8
|
+
If you are not using Windows 10 then you won't be able to make use of this
|
9
|
+
plugin out of the box. You may work around this by placing a valid bash
|
10
|
+
executable in the following directory:
|
11
|
+
C:\\Windows\\system32\\
|
12
|
+
|
13
|
+
The executable path is hardcoded to prevent potential blunders where some
|
14
|
+
powerusers may have other bash executables in their %PATH%. You will not
|
15
|
+
receive any support if you use a third party executable.
|
16
|
+
EOF
|
17
|
+
end
|
18
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-lxss-plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Connor Spencer Harries
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,7 @@ files:
|
|
52
52
|
- Rakefile
|
53
53
|
- lib/vagrant-lxss-plugin.rb
|
54
54
|
- lib/vagrant-lxss-plugin/command.rb
|
55
|
+
- lib/vagrant-lxss-plugin/errors.rb
|
55
56
|
- lib/vagrant-lxss-plugin/plugin.rb
|
56
57
|
- lib/vagrant-lxss-plugin/version.rb
|
57
58
|
- vagrant-lxss-plugin.gemspec
|