whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam Ruby <ru...@apache.org>
Subject [whimsy.git] [2/2] Commit 265689f: include podlings in the library
Date Tue, 08 Mar 2016 15:49:52 GMT
Commit 265689fdb53d51f926d6398e202cc8e008e99b29:
    include podlings in the library


Branch: refs/heads/master
Author: Sam Ruby <rubys@intertwingly.net>
Committer: Sam Ruby <rubys@intertwingly.net>
Pusher: rubys <rubys@apache.org>

------------------------------------------------------------
lib/whimsy/asf.rb                                            | + 
lib/whimsy/asf/podlings.rb                                   | ++++++++++ 
www/board/subscriptions.cgi                                  |  --
www/classic/roster/main.rb                                   |  --
www/committers/subscribe.cgi                                 |  --
www/fundraising/invoice.cgi                                  | + --
www/fundraising/prospects.cgi                                |  --
www/fundraising/sponsorship.cgi                              |  --
www/incubator/maillist.cgi                                   | + --
www/members/subscriptions.cgi                                |  --
www/members/watch.cgi                                        |  --
www/roster/main.rb                                           |  -
www/roster/public_nonldap_groups.rb                          |  -
------------------------------------------------------------
33 changes: 13 additions, 20 deletions.
------------------------------------------------------------


diff --git a/lib/whimsy/asf.rb b/lib/whimsy/asf.rb
index 293f9cc..45aa021 100644
--- a/lib/whimsy/asf.rb
+++ b/lib/whimsy/asf.rb
@@ -9,6 +9,7 @@
 require_relative 'asf/auth'
 require_relative 'asf/member'
 require_relative 'asf/site'
+require_relative 'asf/podlings'
 
 module ASF
   def self.library_mtime
diff --git a/lib/whimsy/asf/podlings.rb b/lib/whimsy/asf/podlings.rb
index bf1e26a..7fcec5c 100644
--- a/lib/whimsy/asf/podlings.rb
+++ b/lib/whimsy/asf/podlings.rb
@@ -44,5 +44,15 @@ def each
         yield node['resource'], data
       end
     end
+
+    # convenience method for iterating over the entire list
+    def self.to_enum
+      self.new.to_enum    
+    end
+
+    # return the entire list as a hash
+    def self.list
+      Hash[self.new.to_a]
+    end
   end
 end
diff --git a/www/board/subscriptions.cgi b/www/board/subscriptions.cgi
index 4a5c56c..0afc0ec 100755
--- a/www/board/subscriptions.cgi
+++ b/www/board/subscriptions.cgi
@@ -2,8 +2,6 @@
 $LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__)
 require 'wunderbar'
 require 'whimsy/asf'
-require 'whimsy/asf/podlings'
-require 'whimsy/asf/site'
 
 SUBSCRIPTIONS = '/srv/subscriptions/board'
 
diff --git a/www/classic/roster/main.rb b/www/classic/roster/main.rb
index 6bdc5b4..aa9a9a1 100755
--- a/www/classic/roster/main.rb
+++ b/www/classic/roster/main.rb
@@ -5,8 +5,6 @@
 #
 
 require 'whimsy/asf'
-require 'whimsy/asf/podlings'
-require 'whimsy/asf/site'
 
 require 'wunderbar/sinatra'
 require 'wunderbar/bootstrap/theme'
diff --git a/www/committers/subscribe.cgi b/www/committers/subscribe.cgi
index c74c60d..be3a253 100755
--- a/www/committers/subscribe.cgi
+++ b/www/committers/subscribe.cgi
@@ -2,8 +2,6 @@
 require 'wunderbar'
 require 'mail'
 require 'whimsy/asf'
-require 'whimsy/asf/podlings'
-require 'whimsy/asf/site'
 require 'time'
 
 $SAFE = 1
diff --git a/www/fundraising/invoice.cgi b/www/fundraising/invoice.cgi
index 88f2dfa..0311d42 100755
--- a/www/fundraising/invoice.cgi
+++ b/www/fundraising/invoice.cgi
@@ -5,8 +5,7 @@ require "date"
 require "yaml"
 
 require 'whimsy/asf'
-require 'whimsy/asf/podlings'
-require 'whimsy/asf/site'
+
 user = ASF::Person.new($USER)
 unless user.asf_member? or ASF.pmc_chairs.include? user or $USER=='ea'
   print "Status: 401 Unauthorized\r\n"
diff --git a/www/fundraising/prospects.cgi b/www/fundraising/prospects.cgi
index ba5a0da..6dbcfa6 100755
--- a/www/fundraising/prospects.cgi
+++ b/www/fundraising/prospects.cgi
@@ -1,8 +1,6 @@
 #!/usr/bin/env ruby
 require 'wunderbar'
 require 'whimsy/asf'
-require 'whimsy/asf/podlings'
-require 'whimsy/asf/site'
 require 'yaml'
 require 'date'
 
diff --git a/www/fundraising/sponsorship.cgi b/www/fundraising/sponsorship.cgi
index 5d247ac..815746a 100755
--- a/www/fundraising/sponsorship.cgi
+++ b/www/fundraising/sponsorship.cgi
@@ -1,8 +1,6 @@
 #!/usr/bin/env ruby
 require 'wunderbar'
 require 'whimsy/asf'
-require 'whimsy/asf/podlings'
-require 'whimsy/asf/site'
 require 'yaml'
 require 'date'
 
diff --git a/www/incubator/maillist.cgi b/www/incubator/maillist.cgi
index 9da7a14..27a3075 100755
--- a/www/incubator/maillist.cgi
+++ b/www/incubator/maillist.cgi
@@ -2,7 +2,6 @@
 $LOAD_PATH.unshift File.realpath(File.expand_path('../../../lib', __FILE__))
 
 require 'whimsy/asf'
-require 'whimsy/asf/podlings'
 require 'wunderbar/bootstrap'
 
 _html do
@@ -16,7 +15,7 @@ _html do
       _th 'mailing lists'
     end
 
-    ASF::Podlings.new.to_a.sort.each do |name, description|
+    ASF::Podlings.to_enum.sort.each do |name, description|
       next if description[:status] == 'retired'
       next if description[:status] == 'graduated'
 
diff --git a/www/members/subscriptions.cgi b/www/members/subscriptions.cgi
index 4e0bfbf..d323721 100755
--- a/www/members/subscriptions.cgi
+++ b/www/members/subscriptions.cgi
@@ -3,8 +3,6 @@ $LOAD_PATH.unshift File.realpath(File.expand_path('../../../lib', __FILE__))
 
 require 'wunderbar'
 require 'whimsy/asf'
-require 'whimsy/asf/podlings'
-require 'whimsy/asf/site'
 
 SUBSCRIPTIONS = '/home/apmail/subscriptions/members'
 
diff --git a/www/members/watch.cgi b/www/members/watch.cgi
index 83bfc08..38cb61a 100755
--- a/www/members/watch.cgi
+++ b/www/members/watch.cgi
@@ -3,8 +3,6 @@ $LOAD_PATH.unshift File.realpath(File.expand_path('../../../lib', __FILE__))
 
 require 'wunderbar'
 require 'whimsy/asf'
-require 'whimsy/asf/podlings'
-require 'whimsy/asf/site'
 require 'nokogiri'
 require 'date'
 
diff --git a/www/roster/main.rb b/www/roster/main.rb
index 1922f78..1ea8f2e 100755
--- a/www/roster/main.rb
+++ b/www/roster/main.rb
@@ -5,7 +5,6 @@
 #
 
 require 'whimsy/asf'
-require 'whimsy/asf/podlings'
 
 require 'mail'
 require 'tmpdir'
diff --git a/www/roster/public_nonldap_groups.rb b/www/roster/public_nonldap_groups.rb
index 10506f8..e7f7376 100644
--- a/www/roster/public_nonldap_groups.rb
+++ b/www/roster/public_nonldap_groups.rb
@@ -21,7 +21,6 @@
 # }
 
 require_relative 'public_json_common'
-require 'whimsy/asf/podlings'
 
 require 'net/http'
 pods = Hash[ASF::Podlings.new.map {|podling, definition| [podling, definition[:status]]}]

Mime
View raw message