The documentation for Plume.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.6 KiB

1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
1 year ago
1 year ago
12 months ago
1 year ago
  1. require "pathname"
  2. BUILD_DIR = Pathname("build")
  3. LOCALE_DIR = Pathname("trans")
  4. TRANS_DIR = Pathname("translate")
  5. PSEUDO_LANG = "ach"
  6. CROWDIN_SNIPPET = <<EOS
  7. <script type="text/javascript">
  8. var _jipt = [];
  9. _jipt.push(['project', 'plume-docs']);
  10. _jipt.push(['escape', function() {
  11. window.location.href = 'https://joinplu.me';
  12. }]);
  13. </script>
  14. <script type="text/javascript" src="//cdn.crowdin.com/jipt/jipt.js"></script>
  15. EOS
  16. class Pathname
  17. alias to_str to_s
  18. end
  19. desc "Build site"
  20. task :build_site => [:build_base, "crowdin:download"] do
  21. LOCALE_DIR.glob("**/*.html").each do |html|
  22. dest = Pathname(html.to_path.sub(LOCALE_DIR, BUILD_DIR))
  23. dest.parent.mkpath
  24. copy html, dest
  25. end
  26. end
  27. task :build_base do
  28. sh "middleman", "build"
  29. end
  30. desc "Build site for translate.docs.joinplu.me"
  31. task :build_trans do
  32. sh "middleman", "build", "--build-dir", TRANS_DIR
  33. (LOCALE_DIR/PSEUDO_LANG/"trans").glob("**/*.html").each do |html|
  34. doc = html.read
  35. doc.sub! "<head>", "<head>" + CROWDIN_SNIPPET
  36. dest = Pathname(html.to_path.sub(LOCALE_DIR/PSEUDO_LANG/"trans", TRANS_DIR))
  37. $stderr.puts "#{html} -> #{dest}"
  38. dest.write doc
  39. end
  40. end
  41. task :build_trans_src do
  42. sh "middleman", "build", "--build-dir", LOCALE_DIR
  43. end
  44. namespace :crowdin do
  45. desc "Download translations"
  46. task :download => :build_trans_src do
  47. sh "crowdin", "download"
  48. end
  49. desc "Upload translation sources"
  50. task :upload do
  51. sh "crowdin", "upload", "sources"
  52. end
  53. task :download_pseudo do
  54. sh "crowdin", "download", "--pseudo"
  55. end
  56. end