Sha256: 8069a354264cebdcec264af96854bf730ccca9f43286827568d0c82ecbfb6396

Contents?: true

Size: 619 Bytes

Versions: 4

Compression:

Stored size: 619 Bytes

Contents

class LookForDirectAssetLinks < ActiveRecord::Migration
  def change
    Smithy::Content.where("content LIKE '%s3.amazonaws.com%' OR content LIKE '%/uploads/assets/%'").each do |content|
      content.page_contents.each do |page_content|
        say "[WARNING] Direct Link found in the Page: #{page_content.page.title} - #{page_content.page.url}"
        say "Content Block(s): #{page_content.label}", true
        say content.content.scan(/(?:[^\s]*s3\.amazonaws\.com|\/uploads\/assets)[^\s]*/).join('/n'), true
        say "You can find the new asset url on the smithy/assets page", true
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
smithycms-0.6.3 db/migrate/20160127160513_look_for_direct_asset_links.rb
smithycms-0.6.2 db/migrate/20160127160513_look_for_direct_asset_links.rb
smithycms-0.6.1 db/migrate/20160127160513_look_for_direct_asset_links.rb
smithycms-0.6.0 db/migrate/20160127160513_look_for_direct_asset_links.rb