mina-deploy / mina

Blazing fast deployer and server automation tool
https://rubygems.org/gems/mina
Other
4.34k stars 491 forks source link

Mina fails miserably on Windows #660

Open abhijitnandy opened 4 years ago

abhijitnandy commented 4 years ago

Huge number of issues on Windows with this library, while running on Windows.

Considering that Windows is now a viable development environment even with it's own OpenSSH, I feel some of these issues should be fixed.

  1. ssh user doesn't get picked up from config

in the following file ignoring the entered config and instead picking up the ENV config value

\lib\mina\configuration.rb

    def fetch(key, default = nil)
      # value = ENV[key.to_s] || variables.fetch(key, default)
      value = variables.fetch(key, default) || ENV[key.to_s]
      value.respond_to?(:call) ? value.call : value
    end
  1. ssh shell command not quoted correctly

in the following file, the shell command needs to be in escaped double quotes

\tasks\mina\default.rb

desc 'Open an ssh session to the server and cd to deploy_to folder'
task :ssh do
  # exec %{#{Mina::Backend::Remote.new(nil).ssh} 'cd #{fetch(:deploy_to)} && exec $SHELL'}
  exec %{#{Mina::Backend::Remote.new(nil).ssh} \"cd #{fetch(:deploy_to)} && exec $SHELL\"}
end

Could not proceed after this as no other commands worked.

This gives a blank output -

mina setup

And this command -

mina deploy

gives some weird output like this -

mina aborted!
TypeError: no implicit conversion of nil into String

I can't believe that there is no proper error rescue even. So giving up and trying some other alternative.