-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#2180] Empty skeleton for pj transfer cleanup task
Might not actually be necessary (we don't really have a delete feature), but just in case
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |