Sha256: a9e250d96eca6ba7ca4001577d0216e3ae9ce42af77f147081f1f515e586d007

Contents?: true

Size: 1.23 KB

Versions: 31

Compression:

Stored size: 1.23 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 = Heroku::API::OkJson.encode(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 = Heroku::API::OkJson.encode(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["email"] = "user@example.com"
    user["id"] = "123456@users.heroku.com"
    user = Heroku::API::OkJson.encode(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

31 entries across 31 versions & 2 rubygems

Version Path
heroku-api-0.3.15 Rakefile
heroku-api-0.3.14 Rakefile
heroku-api-0.3.13 Rakefile
heroku-api-0.3.12 Rakefile
heroku-api-0.3.11 Rakefile
heroku-api-0.3.10 Rakefile
pogoapp-api-0.3.8 Rakefile
heroku-api-0.3.9 Rakefile
heroku-api-0.3.8 Rakefile
heroku-api-0.3.7 Rakefile
heroku-api-0.3.6 Rakefile
heroku-api-0.3.5 Rakefile
heroku-api-0.3.4 Rakefile
heroku-api-0.3.3 Rakefile
heroku-api-0.3.2 Rakefile
heroku-api-0.3.1 Rakefile
heroku-api-0.3.0 Rakefile
heroku-api-0.2.13 Rakefile
heroku-api-0.2.12 Rakefile
heroku-api-0.2.11 Rakefile