3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/capistrano-misc/misc/guard.rb', line 3
def self.load_into(configuration)
configuration.load do
set :guard_env, :production
namespace :misc do
task :guard do
env = self.rails_env.to_s
guard = case
when guard_env.is_a?(Regexp)
env =~ guard_env
else
[guard_env].flatten.map(&:to_sym).include?(rails_env.to_sym)
end
if guard
res = Capistrano::CLI.ui.ask %Q|Do you realy want to deploy to #{rails_env}, yes/no(no)?: |
exit unless res =~ /y(es)?/i
end
end
end
end
end
|