aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wfar...@apache.org
Subject svn commit: r1720057 - in /aurora/site: README.md Rakefile
Date Tue, 15 Dec 2015 01:01:46 GMT
Author: wfarner
Date: Tue Dec 15 01:01:46 2015
New Revision: 1720057

URL: http://svn.apache.org/viewvc?rev=1720057&view=rev
Log:
Add sanity check for contents of data/downloads.yml.

Modified:
    aurora/site/README.md
    aurora/site/Rakefile

Modified: aurora/site/README.md
URL: http://svn.apache.org/viewvc/aurora/site/README.md?rev=1720057&r1=1720056&r2=1720057&view=diff
==============================================================================
--- aurora/site/README.md (original)
+++ aurora/site/README.md Tue Dec 15 01:01:46 2015
@@ -71,9 +71,7 @@ First, prepare the vagrant environment a
 
 You will use the `generate_docs` rake task to fetch the docs you wish to place on the website.
 This task takes two arguments - `title` and `git_tag`.  The title is the name to give this
branch
-of documentation.  All titles should be a release and must be listed in `data/downloads.yml`,
-with the exception of the `latest` title.  Each title will be represented as a directory
under
-`source/documentation`.
+of documentation.
 
 #### Updating documentation to match git master
 If a documentation patch is contributed and you would like to update the website to reflect

Modified: aurora/site/Rakefile
URL: http://svn.apache.org/viewvc/aurora/site/Rakefile?rev=1720057&r1=1720056&r2=1720057&view=diff
==============================================================================
--- aurora/site/Rakefile (original)
+++ aurora/site/Rakefile Tue Dec 15 01:01:46 2015
@@ -1,19 +1,53 @@
-require 'rubygems'
-require 'rake/clean'
 require 'fileutils'
+require 'rake/clean'
+require 'rubygems'
+require 'set'
+require 'yaml'
 
 task :default => [:build, :clean]
  
-CLEAN.include "**/.DS_Store"
+CLEAN.include '**/.DS_Store'
+
+def list_release_dirs()
+  Dir.chdir('source/documentation') {
+    dirs = Dir.glob('*')
+    dirs.delete('latest')
+    dirs
+  }
+end
+
+def downloads_sanity_check()
+  releases_file = 'data/downloads.yml'
 
-desc "Build the website from source"
+  releases = []
+  YAML.load_file(releases_file)['releases'].each do |release|
+    releases << release['version']
+  end
+
+  if releases.detect{ |e| releases.count(e) > 1 }
+    puts "#{releases_file} contains a duplicate release version"
+    exit 2
+  end
+
+  release_dirs = list_release_dirs()
+  if releases.uniq.sort != release_dirs.uniq.sort
+    puts 'Listed releases does not match release dirs!'
+    puts "Releases in #{releases_file}: #{releases}"
+    puts "Release dirs: #{release_dirs}"
+    exit 2
+  end
+end
+
+desc 'Build the website from source'
 task :build do
-  puts "Building website from static source"
-  result = system("middleman build --clean")
+  downloads_sanity_check()
+
+  puts 'Building website from static source'
+  result = system('middleman build --clean')
   if result 
-    puts "Successfully generated the site, please commit your changes"
+    puts 'Successfully generated the site, please commit your changes'
   else
-    puts "An error was encountered when generating the site"
+    puts 'An error was encountered when generating the site'
   end
 end
 
@@ -29,7 +63,7 @@ task :generate_docs, [:title, :git_tag]
 
   puts "Generating docs from git tag #{git_tag} with title #{title}"
 
-  tmp_dir = File.join(File.dirname(__FILE__), "tmp")
+  tmp_dir = File.join(File.dirname(__FILE__), 'tmp')
   #Rake::Task[:clean].invoke if File.exist?(tmp_dir)
 
   FileUtils.mkdir_p(tmp_dir)
@@ -85,7 +119,6 @@ task :generate_docs, [:title, :git_tag]
             # Fix image links.  This is necessary because middleman turns each markdown page
             # into a directory name.  During this process, relative image tags in HTML are
not
             # adjusted accordingly.
-# img src="images
             gsub(/img src="images\//, "img src=\"/documentation/#{title}/images/")
       })
     }
@@ -95,7 +128,7 @@ task :generate_docs, [:title, :git_tag]
   puts 'Note: If you are adding docs for a new release, you should generate with the title
"latest" as well.'
 end
 
-desc "Run the site in development mode. Preview available at http://localhost:4567/"
+desc 'Run the site in development mode. Preview available at http://localhost:4567/'
 task :dev do
-  system("middleman server")
+  system('middleman server')
 end



Mime
View raw message