Windows 上的 Rake - 将目录复制到另一台服务器
我想使用 rake 将 .net 网站部署到 Windows 服务器...有点新,并且陷入了非常简单的东西...
我如何将目录从本地文件夹复制到不同的 Windows 服务器?
目前我有:
task :default => :CWS_Web_application
desc 'Depoly CWS Web application to preview environment'
task :CWS_Web_application do
sh "echo Depoly CWS Web application to preview environment"
mv('MyDirectory', '//servername/c$/foldername', :verbose => true)
end
这显然不起作用 - 我相信问题出在服务器路径:'//servername/c$/foldername'
任何人都可以指出我正确的方向吗?
I want to use rake to deploy a .net website to a windows server... Bit new at this and getting stuck with the very simple stuff...
How would I copy a directory from a local folder to a different windows server?
At the moment I have:
task :default => :CWS_Web_application
desc 'Depoly CWS Web application to preview environment'
task :CWS_Web_application do
sh "echo Depoly CWS Web application to preview environment"
mv('MyDirectory', '//servername/c$/foldername', :verbose => true)
end
This obviously doesn't work - I believe the problem being the server path: '//servername/c$/foldername'
Can anyone point me in the right direction?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是 ruby 与 Windows 的混合,有多种方法可以做到这一点,但这是我通过将内容传输到 cmd.exe 所做的事情:
您还可以执行以下操作:
如果这是首选,则可能允许您输入用户名和密码如果需要的话也可以。运行 rake 脚本的帐户显然需要对域/目录等进行适当的权限。
可能还有其他方法可以绕过 \ 的转义,但我只是选择了对我有用的第一件事。
This being ruby mixed with windows there's going to be multiple ways to do this, but here's what I've done by piping stuff to cmd.exe:
You can also do stuff like:
if that's preferred which potentially lets you put in username and passwords as well if required. The account running the rake script will obviously need appropriate permissions on the domain / directories etc. etc.
There's probably other ways of getting around escaping the \'s but I just went with the first thing that worked for me.