Sha256: a38a323a2818c9cdb4c09a2eeb1e4b1077a1cfd719aa55e7aae1cef195b12d1e

Contents?: true

Size: 1.25 KB

Versions: 8

Compression:

Stored size: 1.25 KB

Contents

require "bundler/gem_tasks"

require 'rake/testtask'

task :default => :test

Rake::TestTask.new do |task|
  task.name = :test
  task.test_files = FileList['test/test*.rb']
end

task :cache, [:api_key] do |task, args|
  unless args.api_key
    puts('cache requires an api key, please call as `cache[api_key]`')
  else
    require "#{File.dirname(__FILE__)}/lib/heroku/api"
    heroku = Heroku::API.new(:api_key => args.api_key)

    addons = MultiJson.dump(heroku.get_addons.body)
    File.open("#{File.dirname(__FILE__)}/lib/heroku/api/mock/cache/get_addons.json", 'w') do |file|
      file.write(addons)
    end

    app_name = "heroku-api-#{Time.now.to_i}"
    app = heroku.post_app('name' => app_name)
    features = MultiJson.dump(heroku.get_features(app_name).body)
    File.open("#{File.dirname(__FILE__)}/lib/heroku/api/mock/cache/get_features.json", 'w') do |file|
      file.write(features)
    end
    heroku.delete_app(app_name)

    user = heroku.get_user.body
    user["api_key"] = "0123456789abcdef0123456789abcdef"
    user["email"] = "user@example.com"
    user["id"] = "123456@users.heroku.com"
    user = MultiJson.dump(user)
    File.open("#{File.dirname(__FILE__)}/lib/heroku/api/mock/cache/get_user.json", 'w') do |file|
      file.write(user)
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
heroku-api-0.4.3 Rakefile
heroku-api-0.4.2 Rakefile
heroku-api-0.4.1 Rakefile
heroku-api-0.4.0 Rakefile
heroku-api-0.3.23 Rakefile
heroku-api-0.3.22 Rakefile
heroku-api-0.3.21 Rakefile
heroku-api-0.3.20 Rakefile