Sha256: 926f85bd2e3d59cb196036f72d07df5cd2be98e1127c7f88ab4b6914d5a4636a

Contents?: true

Size: 871 Bytes

Versions: 1

Compression:

Stored size: 871 Bytes

Contents

require "fileutils"

namespace :activestorage do
  desc "Copy over the migration needed to the application"
  task :install do
    FileUtils.mkdir_p Rails.root.join("storage")
    FileUtils.mkdir_p Rails.root.join("tmp/storage")
    puts "Made storage and tmp/storage directories for development and testing"

    FileUtils.cp  File.expand_path("../../active_storage/storage_services.yml", __FILE__), Rails.root.join("config")
    puts "Copied default configuration to config/storage_services.yml"

    migration_file_path = "db/migrate/#{Time.now.utc.strftime("%Y%m%d%H%M%S")}_active_storage_create_tables.rb"
    FileUtils.cp File.expand_path("../../active_storage/migration.rb", __FILE__), Rails.root.join(migration_file_path)
    puts "Copied migration to #{migration_file_path}"

    puts "Now run rails db:migrate to create the tables for Active Storage"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activestorage-0.1 lib/tasks/activestorage.rake