I ran into a similar need yesterday. I wanted to have a Heroku cron
task create a bundle of my app, to get a daily DB backup.
Here is my task:
task :cron => :environment do
require 'heroku'
heroku_username = ENV['HEROKU_USERNAME']
heroku_password = ENV['HEROKU_PASSWORD']
if heroku_username.nil? || heroku_password.nil?
raise "Missing heroku username and/or password"
end
puts "Capturing bundle..."
heroku = Heroku::Client.new( heroku_username, heroku_password )
bundle_name = heroku.bundle_capture "bagnolia-production"
puts "Finished initiating capture of bundle '#{bundle_name}'"
end
--------------------------------------------------
1. Add the heroku gem to your .gems file or vendor it, so its
available to your app. Require the heroku gem.
2. create a new install of Herkou::Client, which needs your username
and password. I put mine into the app's config to keep it out of
source control.
3. call an instance method on the client object. It looks like you'll
want to use add_domain(). You can see all the methods here:
http://github.com/heroku/heroku/blob/master/lib/heroku/client.rb
--
You received this message because you are subscribed to the Google Groups
"Heroku" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/heroku?hl=en.