You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by cu...@apache.org on 2019/06/02 20:30:17 UTC
[whimsy] branch master updated: Centralize all simple redirects;
rearrange get metnods together
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 dc499ca Centralize all simple redirects; rearrange get metnods together
dc499ca is described below
commit dc499ca4a136f24961f45a236c7cec105c3b47c6
Author: Shane Curcuru <as...@shanecurcuru.org>
AuthorDate: Sun Jun 2 16:30:10 2019 -0400
Centralize all simple redirects; rearrange get metnods together
Sorry for the odd diff, not intending to change any functionality, just better organizing the whole set of routes
---
www/roster/main.rb | 101 +++++++++++++++++++++++++----------------------------
1 file changed, 48 insertions(+), 53 deletions(-)
diff --git a/www/roster/main.rb b/www/roster/main.rb
index 2badf7f..09ad883 100755
--- a/www/roster/main.rb
+++ b/www/roster/main.rb
@@ -51,32 +51,29 @@ get '/' do
end
end
-get '/committer/' do
- _html :committers
-end
-
-get '/committer' do
- redirect to('/committer/')
-end
-
+# Handle traditional top level PMCs
get '/committee/' do
@members = ASF::Member.list.keys
@committees = ASF::Committee.pmcs
_html :committees
end
-get '/committee' do
- redirect to('/committee/')
+get '/committee/:name.json' do |name|
+ data = Committee.serialize(name, env)
+ pass unless data
+ _json data
end
-get '/nonpmc/' do
- @members = ASF::Member.list.keys
- @nonpmcs = ASF::Committee.nonpmcs
- _html :nonpmcs
+get '/committee/:name' do |name|
+ @auth = Auth.info(env)
+ @committee = Committee.serialize(name, env)
+ pass unless @committee
+ _html :committee
end
-get '/nonpmc' do
- redirect to('/nonpmc/')
+# Handle individual committer (or member) records
+get '/committer/' do
+ _html :committers
end
index = nil
@@ -112,32 +109,6 @@ get '/committer/index.json' do
index
end
-get '/committee/:name.json' do |name|
- data = Committee.serialize(name, env)
- pass unless data
- _json data
-end
-
-get '/committee/:name' do |name|
- @auth = Auth.info(env)
- @committee = Committee.serialize(name, env)
- pass unless @committee
- _html :committee
-end
-
-get '/nonpmc/:name.json' do |name|
- data = NonPMC.serialize(name, env)
- pass unless data
- _json data
-end
-
-get '/nonpmc/:name' do |name|
- @auth = Auth.info(env)
- @nonpmc = NonPMC.serialize(name, env)
- pass unless @nonpmc
- _html :nonpmc
-end
-
get '/committer/:name.json' do |name|
data = Committer.serialize(name, env)
pass unless data
@@ -178,6 +149,27 @@ post '/committer/:userid/:file' do |name, file|
_json :"actions/#{params[:file]}"
end
+# Handle nonpmc: committees that aren't PMCs
+get '/nonpmc/' do
+ @members = ASF::Member.list.keys
+ @nonpmcs = ASF::Committee.nonpmcs
+ _html :nonpmcs
+end
+
+get '/nonpmc/:name.json' do |name|
+ data = NonPMC.serialize(name, env)
+ pass unless data
+ _json data
+end
+
+get '/nonpmc/:name' do |name|
+ @auth = Auth.info(env)
+ @nonpmc = NonPMC.serialize(name, env)
+ pass unless @nonpmc
+ _html :nonpmc
+end
+
+# Handle groups: other kinds of auth/ldap/etc. groupings
get '/group/:name.json' do |name|
_json Group.serialize(name)
end
@@ -203,6 +195,7 @@ get '/members.json' do
_json Hash[ASF.members.map {|person| [person.id, person.public_name]}.sort]
end
+# Handle podling PPMCs
get '/ppmc/_new_' do
@pmcsAndBoard = (ASF::Committee.pmcs.map(&:id) + ['board']).sort
@officersAndMembers = (ASF.pmc_chairs + ASF.members).uniq.map(&:id)
@@ -240,7 +233,6 @@ get '/ppmc/:name' do |name|
_html :ppmc
end
-
# complete podling list
get '/podlings' do
attic = ASF::SVN['attic-xdocs']
@@ -261,21 +253,13 @@ get '/attic/issues.json' do
_json Attic.issues
end
-# overall organization chart
+# Handle overall organization chart
get '/orgchart/' do
@org = OrgChart.load
_html :orgchart
end
-get '/orgchart' do
- redirect to('/orgchart/')
-end
-
-get '/orgchart.cgi' do
- redirect to('/orgchart/')
-end
-
-# individual duties
+# Orgchart individual duties
get '/orgchart/:name' do |name|
person = ASF::Person.find(env.user)
@@ -326,6 +310,7 @@ get '/env' do
JSON.pretty_generate(env: env, ENV: ENV.to_h, asset: asset)
end
+# Handle error and other conditions
not_found do
@errors = env
_html :not_found
@@ -335,3 +320,13 @@ error do
@errors = env
_html :errors
end
+
+# Redirect common partial paths
+['/committee', '/committer', '/group', '/nonpmc', '/ppmc', '/orgchart'].each do |ppath|
+ get ppath do
+ redirect to("#{ppath}/")
+ end
+end
+get '/orgchart.cgi' do
+ redirect to('/orgchart/')
+end