whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From curc...@apache.org
Subject [whimsy] branch master updated: Future parser/display for ComDev Apache Way talks
Date Tue, 23 May 2017 15:49:38 GMT
This is an automated email from the ASF dual-hosted git repository.

curcuru pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git

The following commit(s) were added to refs/heads/master by this push:
       new  77432f2   Future parser/display for ComDev Apache Way talks
77432f2 is described below

commit 77432f2a578b41630462c00f5773cac23e00817e
Author: Shane Curcuru <asf@shanecurcuru.org>
AuthorDate: Tue May 23 11:49:34 2017 -0400

    Future parser/display for ComDev Apache Way talks
---
 tools/comdevtalks.rb | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/tools/comdevtalks.rb b/tools/comdevtalks.rb
new file mode 100644
index 0000000..de71cd3
--- /dev/null
+++ b/tools/comdevtalks.rb
@@ -0,0 +1,47 @@
+#!/usr/bin/env ruby
+<<~HEREDOC
+ComDev Talks: Parse ComDev listings of Apache-related talks
+
+Currently requires local checkout; future use for displaying talks by category
+HEREDOC
+require 'yaml'
+require 'json'
+
+COMDEVTALKS = 'https://svn.apache.org/repos/asf/comdev/site/trunk/content/speakers/talks/'
# *.yaml
+COMDEVDIR = '/Users/curcuru/src/comdev/site/trunk/content/speakers/talks/' # *.yaml
+
+# Parse all talks and submitters
+def parse_talks(dir)
+  talks = {}
+  submitters = {}
+  Dir[File.join("#{dir}", "*.yaml")].each do |fname|
+    begin
+      if fname =~ /_/
+        talks["#{File.basename(fname, ".*")}"] = YAML.load(File.read(fname))
+      else
+        submitters["#{File.basename(fname, ".*")}"] = YAML.load(File.read(fname))
+      end
+    rescue Exception => e
+      puts "Bogosity! analyzing #{fname} raised #{e.message[0..255]}"
+      puts "\t#{e.backtrace.join("\n\t")}"
+    end
+  end
+
+  return talks, submitters
+end
+
+# ## ### #### ##### ######
+# Main method for command line use
+if __FILE__ == $PROGRAM_NAME
+  dir = COMDEVDIR
+  outfile = File.join("#{dir}", "comdevtalks.json")
+  puts "BEGIN: Parsing YAMLs in #{dir}"
+  talks, submitters = parse_talks dir
+  results = {}
+  results['talks'] = talks
+  results['submitters'] = submitters
+  File.open(outfile, "w") do |f|
+    f.puts JSON.pretty_generate(results)
+  end
+  puts "END: Thanks for running, see #{outfile}"
+end

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <commits@whimsical.apache.org>'].

Mime
View raw message