Create a gist now

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
next
end
print "Copying file #{index + 1}/#{ember_snaps_count}...\r"
`cp '#{image_file}' #{destinationPath}`
number_of_files_successfully_copied += 1
end
# 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}"
end
end
@vernalkick

This comment has been minimized.

Show comment Hide comment
@vernalkick

vernalkick 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.

Owner

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.

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