开发者

Using haddock with Capistrano

First of all.. I'm new to Ruby and Capistrano.

I have a deployment task where I need to come up with a random password, so I found Haddock, which does the trick for me.

https://github.com/stephencelis/haddock

I installed the gem, and made a sample script just to make sure the gem was working fine. The script is as follows..

require "rubygems"
require "haddock"
include Haddock


newpass = Password.generate

print newpass

This does what I expected, it prints a random string.

Now when I i开发者_如何转开发nclude the two require and include lines in my Capfile, I get the following error.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/capistrano-2.5.2/lib/capistrano/configuration/variables.rb:122:in method_missing': undefined methodinclude' for # (NoMethodError) from Capfile:21:in `load'

It looks like Ruby is failing on a simple "include" now..


Capistrano doesn't run deploy.rb like any other Ruby script, it will load (or eval, not sure which off the top of my head) it inside a specific context to make it's DSL work properly. This means that a few things you'd expect to work will not. One of those things is, apparently include. Try removing it and change Password.generate to Haddock::Password.generate.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜