Skip to content

Commit

Permalink
[#2180] Empty skeleton for pj transfer cleanup task
Browse files Browse the repository at this point in the history
Might not actually be necessary (we don't really have
a delete feature), but just in case
  • Loading branch information
fredZen committed Dec 3, 2018
1 parent c195ad2 commit 1071286
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions lib/tasks/2018_12_03_finish_piece_jointe_transfer.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
namespace :'2018_12_03_finish_piece_jointe_transfer' do
task run: :environment do
Class.new do
def run
check_env
notify_dry_run
notify_dry_run
end

def check_env
if !ActiveStorage::Blob.service.respond_to?(:change_content_type)
fail "Not running on openstack"
end
end

def notify_dry_run
if !force?
rake_puts "Dry run, run with FORCE=1 to actually perform changes"
end
end

def force?
if !defined? @force
@force = (ENV['FORCE'].presence || '0').to_i != 0
end

@force
end

def verbose?
if !defined? @verbose
@verbose = (ENV['VERBOSE'].presence || '0').to_i != 0
end

@verbose
end
end.new.run
end
end

0 comments on commit 1071286

Please sign in to comment.