8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/paperclip-migrator/command.rb', line 8
def execute
warn "This is a dry run, no changes will be made to the actual files." if dry_run?
begin
request_class.tap do |klass|
request_attachment(klass).tap do |attachment|
request_old_layout(klass, attachment).tap do |old_layout|
with_progress_bar(klass, attachment) do |progress_bar|
PaperclipMover.new(klass, attachment, old_layout, dry_run?).each_attachment do |attachment_instance|
begin
attachment_instance.migrate!
rescue
complain($!)
end
progress_bar.try(:inc)
end
end
end
end
end
rescue Interrupt
error "Control-C, Quitting"
rescue
error $!
end
end
|