Sha256: 6c817fcee4d9c2c4b91a6d20c7f877ba3fa0d6d4b1a56f3c0bd87cfe75cd625d
Contents?: true
Size: 734 Bytes
Versions: 1
Compression:
Stored size: 734 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 fetch(:token_servers) do info generate_token(fetch(:token_length)) end end desc 'Upload random token as a file on remote server' task :upload do on fetch(:token_servers) 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 set :token_servers, -> { release_roles(fetch(:token_roles)) } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mascherano-1.2.0 | lib/mascherano/tasks/token.cap |