Cleanup whitespace and comments in WinRM command filters

This commit is contained in:
Shawn Neal 2014-04-24 07:49:19 -07:00
parent 702347c47e
commit d5d9918e48
9 changed files with 7 additions and 39 deletions

View File

@ -12,7 +12,7 @@ module VagrantPlugins
"rm", "rm",
"test", "test",
"uname", "uname",
"which" "which",
] ]
# Filter the given Vagrant command to ensure compatibility with Windows # Filter the given Vagrant command to ensure compatibility with Windows

View File

@ -1,10 +1,8 @@
module VagrantPlugins module VagrantPlugins
module CommunicatorWinRM module CommunicatorWinRM
module CommandFilters module CommandFilters
# Handles the special case of determining the guest OS using cat # Handles the special case of determining the guest OS using cat
class Cat class Cat
def filter(command) def filter(command)
# cat /etc/release | grep -i OmniOS # cat /etc/release | grep -i OmniOS
# cat /etc/redhat-release # cat /etc/redhat-release
@ -19,9 +17,7 @@ module VagrantPlugins
# grep command # grep command
command.start_with?('cat /etc/') command.start_with?('cat /etc/')
end end
end end
end end
end end
end end

View File

@ -1,21 +1,17 @@
module VagrantPlugins module VagrantPlugins
module CommunicatorWinRM module CommunicatorWinRM
module CommandFilters module CommandFilters
# Converts a *nix 'chmod' command to a PowerShell equivalent (none)
# Converts a *nix 'chmod' command to a PowerShell equivalent
class Chmod class Chmod
def filter(command) def filter(command)
# Not support on Windows, the communicator will skip this command # Not supported on Windows, the communicator should skip this command
'' ''
end end
def accept?(command) def accept?(command)
command.start_with?('chmod ') command.start_with?('chmod ')
end end
end end
end end
end end
end end

View File

@ -1,21 +1,17 @@
module VagrantPlugins module VagrantPlugins
module CommunicatorWinRM module CommunicatorWinRM
module CommandFilters module CommandFilters
# Converts a *nix 'chown' command to a PowerShell equivalent (none)
# Converts a *nix 'chown' command to a PowerShell equivalent
class Chown class Chown
def filter(command) def filter(command)
# Not support on Windows, the communicator will skip this command # Not supported on Windows, the communicator should skip this command
'' ''
end end
def accept?(command) def accept?(command)
command.start_with?('chown ') command.start_with?('chown ')
end end
end end
end end
end end
end end

View File

@ -1,8 +1,7 @@
module VagrantPlugins module VagrantPlugins
module CommunicatorWinRM module CommunicatorWinRM
module CommandFilters module CommandFilters
# Converts a *nix 'grep' command to a PowerShell equivalent (none)
# Converts a *nix 'grep' command to a PowerShell equivalent
class Grep class Grep
def filter(command) def filter(command)
@ -18,9 +17,7 @@ module VagrantPlugins
def accept?(command) def accept?(command)
command.start_with?('grep ') command.start_with?('grep ')
end end
end end
end end
end end
end end

View File

@ -1,10 +1,8 @@
module VagrantPlugins module VagrantPlugins
module CommunicatorWinRM module CommunicatorWinRM
module CommandFilters module CommandFilters
# Converts a *nix 'rm' command to a PowerShell equivalent # Converts a *nix 'rm' command to a PowerShell equivalent
class Rm class Rm
def filter(command) def filter(command)
# rm -Rf /some/dir # rm -Rf /some/dir
# rm /some/dir # rm /some/dir
@ -20,9 +18,7 @@ module VagrantPlugins
def accept?(command) def accept?(command)
command.start_with?('rm ') command.start_with?('rm ')
end end
end end
end end
end end
end end

View File

@ -1,10 +1,8 @@
module VagrantPlugins module VagrantPlugins
module CommunicatorWinRM module CommunicatorWinRM
module CommandFilters module CommandFilters
# Converts a *nix 'test' command to a PowerShell equivalent # Converts a *nix 'test' command to a PowerShell equivalent
class Test class Test
def filter(command) def filter(command)
# test -d /tmp/dir # test -d /tmp/dir
# test -f /tmp/afile # test -f /tmp/afile
@ -28,7 +26,6 @@ module VagrantPlugins
command.start_with?("test ") command.start_with?("test ")
end end
private private
def check_for_directory(path) def check_for_directory(path)
@ -60,9 +57,7 @@ module VagrantPlugins
exit 1 exit 1
EOH EOH
end end
end end
end end
end end
end end

View File

@ -1,10 +1,8 @@
module VagrantPlugins module VagrantPlugins
module CommunicatorWinRM module CommunicatorWinRM
module CommandFilters module CommandFilters
# Converts a *nix 'uname' command to a PowerShell equivalent (none)
# Converts a *nix 'uname' command to a PowerShell equivalent
class Uname class Uname
def filter(command) def filter(command)
# uname -s | grep 'Darwin' # uname -s | grep 'Darwin'
# uname -s | grep VMkernel # uname -s | grep VMkernel
@ -23,9 +21,7 @@ module VagrantPlugins
def accept?(command) def accept?(command)
command.start_with?('uname ') command.start_with?('uname ')
end end
end end
end end
end end
end end

View File

@ -1,10 +1,8 @@
module VagrantPlugins module VagrantPlugins
module CommunicatorWinRM module CommunicatorWinRM
module CommandFilters module CommandFilters
# Converts a *nix 'which' command to a PowerShell equivalent # Converts a *nix 'which' command to a PowerShell equivalent
class Which class Which
def filter(command) def filter(command)
executable = command.strip.split(/\s+/)[1] executable = command.strip.split(/\s+/)[1]
return <<-EOH return <<-EOH
@ -18,9 +16,7 @@ module VagrantPlugins
def accept?(command) def accept?(command)
command.start_with?('which ') command.start_with?('which ')
end end
end end
end end
end end
end end