blob: e51a4861c62db7a30cf6dbfc03edda5a3bfa8001 (
plain) (
tree)
|
|
# :mode=ruby:
require 'securerandom'
namespace :deploy do
desc 'Generate secret token if not already set'
task :generate_secret_token do
target_file = File.join(shared_path, 'config', 'initializers', 'secret_token.rb')
on roles(:app) do
unless test "[ -f #{target_file} ]"
result = %Q{ BetaWebApp::Application.config.secret_token = "#{SecureRandom.hex(64)}" }
upload!(StringIO.new(result), target_file)
end
end
end
before 'deploy:check:linked_files', 'deploy:generate_secret_token'
end
|