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
# Returns an array of subfolders for a given path | |
def folders(path = '/') | |
objs = [] | |
next_marker = nil | |
loop do | |
response = Aws::S3::Client.new.list_objects( | |
bucket: 'bucket', | |
delimiter: "/", | |
encoding_type: "url", | |
marker: next_marker, |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'aws-sdk' | |
class S3FolderUpload | |
attr_reader :folder_path, :total_files, :s3_bucket, :include_folder | |
attr_accessor :files | |
# Initialize the upload class |
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
namespace :attachments do | |
task migrate_to_s3: :environment do | |
require 'aws-sdk' | |
# Define Paperclip models (change with your own) | |
models = [ | |
[Model1, :data], | |
[Model2, :logo] | |
] |
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
#!/bin/bash | |
source "$HOME/.rvm/scripts/rvm" && | |
rvm use 2.1.2 | |
# Use bash, not sh on first line |