3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/capistrano-misc/misc/guard.rb', line 3
def self.load_into(configuration)
configuration.load do
set :guard_env, :production
namespace :misc do
desc 'Guard specified env from accidentally execution'
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)?: |
if res =~ /^(n|no)$/i
exit
elsif res !~ /^(y|yes)$/i
next
end
end
end
end
end
end
|