[Pkg-privacy-commits] [msva-perl] 36/356: some silly changes to msva-ruby

Ximin Luo infinity0 at moszumanska.debian.org
Mon Aug 24 07:41:37 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch debian
in repository msva-perl.

commit 3e0579e86a651e786f02944872442ab3990c0e0b
Author: mike castleman <m at mlcastle.net>
Date:   Sat Jan 9 18:50:54 2010 -0500

    some silly changes to msva-ruby
---
 msva.rb | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/msva.rb b/msva.rb
index ca4be59..dd3c165 100644
--- a/msva.rb
+++ b/msva.rb
@@ -6,10 +6,20 @@ require 'json'
 require 'openssl'
 require 'sinatra'
 
+configure do
+  git_dir = File.join(File.dirname(__FILE__), ".git")
+  if File.directory?(git_dir)
+    head = File.read("#{git_dir}/HEAD").strip.split[-1]
+    @@git_rev = File.read(File.join(git_dir, head))
+  end
+end
+
 get '/' do
-  content_type 'text/plain; charset=us-ascii'
+  content_type "application/json"
 
-  "Hello from your friendly MSVA."
+  result = { :available => true, :protoversion => 1, :server => "MSVA-Ruby 0.00001" }
+  result[:git_revision] = @@git_rev if @@git_rev
+  result.to_json
 end
 
 post '/reviewcert' do
@@ -18,7 +28,7 @@ post '/reviewcert' do
   begin
     params = JSON.parse(request.body.string)
   rescue JSON::ParserError
-    halt({ :valid => false, :message => "couldn't parse JSON query"})
+    halt({ :valid => false, :message => "couldn't parse JSON query"}.to_json)
   end
 
   unless (params["pkc"] && params["pkc"]["type"] == "x509der")
@@ -31,11 +41,12 @@ post '/reviewcert' do
   { :valid => false, :message => "Just testing!!" }.to_json
 end
 
-get '/noop' do
-  { :available => true, :protoversion => 1, :server => "MSVA-Ruby 0.00001" }.to_json
-end
+# TODO: fill in if we need to do so
+# post '/extracerts' do
+# end
+
+not_found do
+  content_type "application/json"
 
-post '/extracerts' do
-  # TODO: fill in if we need to do so
-  not_found
+  { :status => 404, :message => "not found" }.to_json
 end

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/msva-perl.git



More information about the Pkg-privacy-commits mailing list