geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r509390 - in /geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands: addpage.groovy getpage.groovy removepage.groovy
Date Mon, 19 Feb 2007 23:59:44 GMT
Author: jdillon
Date: Mon Feb 19 15:59:43 2007
New Revision: 509390

URL: http://svn.apache.org/viewvc?view=rev&rev=509390
Log:
Added getpage

Added:
    geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/getpage.groovy 
 (with props)
Modified:
    geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/addpage.groovy
    geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/removepage.groovy

Modified: geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/addpage.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/addpage.groovy?view=diff&rev=509390&r1=509389&r2=509390
==============================================================================
--- geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/addpage.groovy (original)
+++ geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/addpage.groovy Mon
Feb 19 15:59:43 2007
@@ -90,7 +90,7 @@
                 }
             }
             println '----8<----'
-            println resultPage['content']
+            println resultPage.content
             println '---->8----'
         }
         finally {

Added: geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/getpage.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/getpage.groovy?view=auto&rev=509390
==============================================================================
--- geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/getpage.groovy (added)
+++ geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/getpage.groovy Mon
Feb 19 15:59:43 2007
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+//
+// $Id$
+//
+
+package hokeypokey.commands
+
+import groovy.net.xmlrpc.XMLRPCServerProxy
+
+/**
+ * Do the Hokey Pokey!
+ */
+class getpage extends HokeyPokeyCommand
+{
+    private String space
+    private String title
+    private File file
+    
+    def run(args) {
+        def cli = new CliBuilder(usage : 'hokeypokey getpage [option]*')
+        
+        cli.h(longOpt: 'help', 'Print out this message.')
+        cli.s(longOpt: 'space', args: 1, argName: 'name', 'Space name (required)')
+        cli.t(longOpt: 'title', args: 1, argName: 'name', 'Page title (required)')
+        cli.f(longOpt: 'file', args: 1, argName: 'file', 'Save page contents to file')
+        
+        def options = cli.parse(args)
+        if (options == null) {
+            println ('Error in processing command line options.')
+            return
+        }
+        if (options.h) { cli.usage(); return }
+        if (options.s) { space = options.s }
+        if (options.t) { title = options.t }
+        if (options.f) { file = new File(options.f) }
+        
+        def arguments = options.arguments()
+        if (arguments.size() != 0) {
+            cli.usage(); return
+        }
+        
+        if (!space && !title) {
+            cli.usage(); return
+        }
+        
+        println "Getting page '$title' to space '$space'"
+        
+        client.login()
+        
+        try {
+            def page = client.getPage(space, title)
+            
+            println 'Page details:'
+            page.each {
+                if (it.key != 'content') {
+                    println "    $it"
+                }
+            }
+            if (file) {
+                println "Saving page content to: $file"
+                file.write(page.content)
+            }
+            else {
+                println '----8<----'
+                println page.content
+                println '---->8----'
+            }
+        }
+        finally {
+            client.logout()
+        }
+    }
+}
+

Propchange: geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/getpage.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/getpage.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/getpage.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/removepage.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/removepage.groovy?view=diff&rev=509390&r1=509389&r2=509390
==============================================================================
--- geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/removepage.groovy
(original)
+++ geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/removepage.groovy
Mon Feb 19 15:59:43 2007
@@ -32,7 +32,6 @@
 {
     private String space
     private String title
-    private String parent
     
     def run(args) {
         def cli = new CliBuilder(usage : 'hokeypokey removepage [option]*')



Mime
View raw message