Add rake task to update JSON schemas for github-pages

This commit is contained in:
Benjamin Neff 2017-06-03 19:59:28 +02:00
parent 7a28db7d76
commit 473450c34a
No known key found for this signature in database
GPG key ID: 971464C3F1A90194

View file

@ -6,6 +6,20 @@ task build: :test do
end
FileUtils.mkdir_p("pkg")
FileUtils.mv(Dir["*.gem"], "pkg")
Rake::Task["update_json_schemas"].invoke
end
desc "Update JSON schemas for github-pages"
task :update_json_schemas do
git_clean = `git status --porcelain`.empty?
sh "git stash" unless git_clean
FileUtils.mkdir_p("docs/schemas")
FileUtils.cp(Dir["lib/diaspora_federation/schemas/*.json"], "docs/schemas")
sh "git add docs/schemas && git diff --staged --quiet || git commit -m 'Update JSON schemas for github-pages'"
sh "git stash pop" unless git_clean
end
desc "Tags version, pushes to remote, and pushes gem"