Sha256: 77693c22c6e7fe2ba687352d5929984a7017526649f67d5f48409db7dd0161db
Contents?: true
Size: 677 Bytes
Versions: 4
Compression:
Stored size: 677 Bytes
Contents
require 'securerandom' require 'stringio' def generate_token(n) SecureRandom.hex(n) end namespace :token do desc 'Generate random token' task :generate do on roles(fetch(:token_roles)) do info generate_token(fetch(:token_length)) end end desc 'Upload random token as a file on remote server' task :upload do on roles(fetch(:token_roles)) do token = generate_token(fetch(:token_length)) io = StringIO.new(token) upload! io, fetch(:token_target) end end end namespace :load do task :defaults do set :token_length, 64 set :token_target, -> { shared_path.join('.token') } set :token_roles, :app end end
Version data entries
4 entries across 4 versions & 1 rubygems