diff --git a/lib/tasks/build.rake b/lib/tasks/build.rake index 8eec866..ef74168 100644 --- a/lib/tasks/build.rake +++ b/lib/tasks/build.rake @@ -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"