找不到 cap 命令 [Cygwin + Capistrano]

cap command not found [Cygwin + Capistrano]

我已经通过 Cygwin 安装程序安装了 ruby、rubygems 和 rails。 然后我安装了 gem:
gem install capistrano --verbose

这里没问题。但是当我尝试 运行 cap 命令时,Cygwin 告诉我:
cap: command not found

当我在 ./bin/cap 中执行时,它起作用了:
$ ./bin/cap Stage not set, please call something such as 'cap production deploy', where production is a stage you have defined.

这是我的 gem environment:
$ gem environment RubyGems Environment: - RUBYGEMS VERSION: 2.4.1 - RUBY VERSION: 2.0.0 (2014-11-13 patchlevel 598) [i386-cygwin] - INSTALLATION DIRECTORY: /home/Moretti/.gem/ruby - RUBY EXECUTABLE: /usr/bin/ruby.exe - EXECUTABLE DIRECTORY: /home/Moretti/bin - SPEC CACHE DIRECTORY: /home/Moretti/.gem/specs - SYSTEM CONFIGURATION DIRECTORY: /etc - RUBYGEMS PLATFORMS: - ruby - x86-cygwin - GEM PATHS: - /home/Moretti/.gem/ruby - /usr/share/gems - /usr/local/share/gems - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :backtrace => false - :bulk_threshold => 1000 - REMOTE SOURCES: - https://rubygems.org/ - SHELL PATH: - /usr/local/bin - /usr/bin - /cygdrive/c/Program Files (x86)/Intel/iCLS Client - /cygdrive/c/Program Files/Intel/iCLS Client - /cygdrive/c/WINDOWS/system32 - /cygdrive/c/WINDOWS - /cygdrive/c/WINDOWS/System32/Wbem - /cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0 - /cygdrive/c/Program Files/Intel/Intel(R) Management Engine Components/DAL - /cygdrive/c/Program Files/Intel/Intel(R) Management Engine Components/IPT - /cygdrive/c/Program Files (x86)/Intel/Intel(R) Management Engine Componen ts/DAL - /cygdrive/c/Program Files (x86)/Intel/Intel(R) Management Engine Componen ts/IPT - /usr/bin

EXECUTABLE DIRECTORY 是正确的,但二进制文件在 ~/bin/ 之外无法工作。

我能做什么?

我在 /usr/local/bin/ 中创建了一个 cap 文件并使其可执行。

$ cat /usr/local/bin/cap
#!/bin/bash
ruby ~/.gem/ruby/gems/capistrano-3.3.5/bin/cap "$@"

可以使用 gem which capistrano.

找到 capistrano gem 文件的位置

我个人不知道这是否是最好的方法,但我昨天才设置好它并设法让它适用于我的用例