You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by Sebastian Bazley <se...@apache.org> on 2016/03/10 23:29:10 UTC
[whimsy.git] [1/1] Commit 73c278c: Use common json output
Commit 73c278c2a67f316170db5b9e7a99531e816bf0fc:
Use common json output
Branch: refs/heads/master
Author: Sebb <se...@apache.org>
Committer: Sebb <se...@apache.org>
Pusher: sebb <se...@apache.org>
------------------------------------------------------------
www/roster/public_member_info.rb | + --------------
------------------------------------------------------------
29 changes: 2 additions, 27 deletions.
------------------------------------------------------------
diff --git a/www/roster/public_member_info.rb b/www/roster/public_member_info.rb
index afefa4d..7175a0f 100644
--- a/www/roster/public_member_info.rb
+++ b/www/roster/public_member_info.rb
@@ -20,39 +20,15 @@
#
#
#
-require 'bundler/setup'
-require 'json'
-require 'whimsy/asf'
+require_relative 'public_json_common'
-GEMVERSION = Gem.loaded_specs['whimsy-asf'].version.to_s rescue nil
- # rescue is to allow for running with local library rather than a Gem
CODEVERSION = ASF.library_mtime rescue nil
-# parse arguments for output file name
-if ARGV.length == 0 or ARGV.first == '-'
- output = STDOUT
-else
- # exit quickly if there has been no change
- if File.exist? ARGV.first
- source = "#{ASF::SVN['private/foundation']}/members.txt"
- lib = File.expand_path('../../../lib', __FILE__)
- mtime = Dir["#{lib}/**/*"].map {|file| File.mtime(file)}.max
- mtime = [mtime, File.mtime(source), File.mtime(__FILE__)].max
- if File.mtime(ARGV.first) >= mtime
- previous_results = JSON.parse(File.read(ARGV.first)) rescue {}
- exit 0 if previous_results['gem_version'] == GEMVERSION
- end
- end
-
- output = File.open(ARGV.first, 'w')
-end
-
# gather member info
info = {
last_updated: (ASF::Member.svn_change rescue nil),
- gem_version: GEMVERSION,
code_version: CODEVERSION
}
@@ -72,5 +48,4 @@
info[:members].sort!
info[:ex_members] = Hash[info[:ex_members].sort]
-output.puts JSON.pretty_generate(info)
-output.close
+public_json_output(info)