Rakefile in pupa-0.2.3 vs Rakefile in pupa-0.2.4
- old
+ new
@@ -17,21 +17,23 @@
namespace :popolo do
desc 'Update Popolo schemas'
task :schemas do
require 'base64'
+ require 'json'
require 'octokit'
Octokit.contents('popolo-project/popolo-spec', path: 'schemas', ref: 'gh-pages').each do |file|
response = Octokit.contents('popolo-project/popolo-spec', path: file.path, ref: 'gh-pages')
if response.encoding == 'base64'
- content = Base64.decode64(response.content)
+ content = JSON.load(Base64.decode64(response.content))
else
raise "Can't handle #{response.encoding} encoding"
end
+ content['id'] = content['id'].sub('http://www.popoloproject.com/schemas/', '')
File.open(File.expand_path(File.join('schemas', 'popolo', file.name), __dir__), 'w') do |f|
- f.write(content)
+ f.write(JSON.dump(content))
end
end
end
end