forked from heroku/heroku.rb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
41 lines (33 loc) · 1.2 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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["email"] = "[email protected]"
user["id"] = "[email protected]"
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