Skip to content

Instantly share code, notes, and snippets.

@jstorimer
Created December 6, 2009 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jstorimer/250269 to your computer and use it in GitHub Desktop.
Save jstorimer/250269 to your computer and use it in GitHub Desktop.
require 'active_resource'
require 'shopify_api'
$KCODE = 'u' # for #parameterize
ActiveResource::Base.site = 'https://API_KEY:PASSWORD@jstorimer.myshopify.com/admin'
# I only had one blog
ShopifyAPI::Blog.find(:first).articles.select {|a| a.published_at.present?}.each do |article|
File.open("_posts/#{article.published_at.year}-#{article.published_at.month}-#{article.published_at.day}-#{article.title.parameterize}.textile", 'w') do |f|
f.write(article.body)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment