Instantly share code, notes, and snippets.

What would you like to do?
Ember Exporter
#!/usr/bin/env ruby
# Input arguments
source_path = ARGV[0]
destinationPath = ARGV[1] || '~/Desktop/ember_backup'
# Creade destination directory if it doesn't exist
`mkdir -p #{destinationPath}`
# Find the embersnaps in the directory and count them
ember_snaps = Dir["#{source_path}/*.embersnap"]
ember_snaps_count = ember_snaps.count
number_of_files_successfully_copied = 0
files_not_copied = []
# Loop through the snaps, find the media file and copy it to the destination
ember_snaps.each_with_index do |file, index|
image_file = Dir["#{file}/*.{png,PNG,jpg,JPG,jpeg,psd,gif,mov,svg}"][0]
if image_file == nil
files_not_copied << file
print "Copying file #{index + 1}/#{ember_snaps_count}...\r"
`cp '#{image_file}' #{destinationPath}`
number_of_files_successfully_copied += 1
# Let the user know it's done!
puts "Done! #{number_of_files_successfully_copied} of #{ember_snaps_count} files copied."
# If there's been any errors, let the user know
if number_of_files_successfully_copied > 0
puts "\n#{files_not_copied.count} file#{'s' if files_not_copied.count > 1} could not be copied:"
files_not_copied.each do |file|
puts "- #{file}"

This comment has been minimized.

Copy link

vernalkick commented Feb 27, 2018

For the past few years I've been collecting design inspiration in Ember. Sadly, Realmac has stopped development of Ember without giving users a good way to export their Library from High Sierra where the app just crashes on launch. Thankfully, the folder structure of the Ember library is pretty straightforward and contains all of the original image files.

This script automates the process of exporting your library so you don't have to copy each file manually.

How it works

$ ruby ember_exporter.rb [ember_library_snaps_folder_path] [target_directory_path] (optional)

Here's an example of how it works in practice:

$ ruby ember_exporter.rb "~/Dropbox (Personal)/Apps/EmberApp/EmberLibrary/Snaps"

If you don't include a target path (as you see above), your images will be copied to a ember_backup folder on your desktop.


This comment has been minimized.

Copy link

squill commented Jun 16, 2018

I copied one of the .embersnap files, changed the format to .jpg, opened the folder and I can see the jpg.

Not sure what your script does. Is it the equivalent of doing what I just did, but as a batch processor?


This comment has been minimized.

Copy link

mavrck commented Aug 11, 2018

Super helpful! Thanks.


This comment has been minimized.

Copy link

nmercado commented Nov 21, 2018

Thanks to your script I could save a library that I had been saving for a decade! thank you!


This comment has been minimized.

Copy link

casekhor commented Dec 5, 2018

Thanks for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment