Sha256: 9c7e2b8a1c64b36edf4af2a08294b94ea3973208da2b7cc95d771d481be98431
Contents?: true
Size: 1.8 KB
Versions: 3
Compression:
Stored size: 1.8 KB
Contents
class EcoRake module Lib module People # The top level task that organizes all the people sync class SyncProcess < EcoRake::Lib::People::SyncRely attr_const :do_decrypt, default: false attr_const :target_task attr_const :target_enviro, required: true option_reopen :enviro, default_lookup: :target_enviro attr_const :local_folder, default: '.' attr_const :mail_to option_reopen :folder, default_lookup: :local_folder def task(*_args) upsert_local_dir(options[:folder]) sh_continue rake_sftp_get if do_decrypt failed_decryption_notify unless 0 == sh_continue(rake_decrypt) end sh_continue rake_sync_command return if options[:simulate] sh_continue rake_sftp_archive sh_continue rake_files_purge('cache') sh_continue rake_files_purge('requests') end private def rake_sftp_get rake_command('csv:sftp', *forward_options(:enviro, :folder), '-t') end def rake_sftp_archive rake_command('csv:sftp', *forward_options(:enviro, :folder), '-a') end def rake_decrypt array_cmd('rake csv:decrypt', '--', forward_option(:folder)).join(" ") end def rake_files_purge(folder, operation: '--remove') rake_command('logs:purge', *forward_options(:enviro), "-d #{folder}", operation) end def failed_decryption_notify msg = 'File decryption failed' puts msg exit 1 if options[:simulate] exit 1 unless inbox = mail_to email(enviro: target_enviro, to: inbox, subject: msg, body: msg) exit 1 end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
eco-rake-0.1.4 | lib/eco-rake/lib/people/sync_process.rb |
eco-rake-0.1.3 | lib/eco-rake/lib/people/sync_process.rb |
eco-rake-0.1.2 | lib/eco-rake/lib/people/sync_process.rb |