sync: use pip upgrade with sudo privileges to sync cloudstackAPI

Sometimes you want to synchronize marvin with the new APIs that you have
introduced locally or any alterations you may have made the API. In such cases
you can sync marvin's libraries as follows.

$sudo mvn -Pdeveloper,sync -Dendpoint=localhost -pl :cloud-marvin

This needs sudo privileges since it will call on pip to upgrade the existing
marvin installation on your machine. The endpoint is where your management
server is running and is exposing the API discovery plugin. A listApis call is
made and the resulting json deserialized back into marvin's library entities.

Signed-off-by: Prasanna Santhanam <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/27417438
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/27417438
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/27417438

Branch: refs/heads/bvt
Commit: 274174389b38e2fb3a4eb560c0d3f124ceb920b0
Parents: 2c2894e
Author: Prasanna Santhanam <[email protected]>
Authored: Thu Mar 28 19:16:25 2013 +0530
Committer: Prasanna Santhanam <[email protected]>
Committed: Thu Mar 28 19:16:25 2013 +0530

----------------------------------------------------------------------
 tools/marvin/pom.xml |   73 +++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 71 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/27417438/tools/marvin/pom.xml
----------------------------------------------------------------------
diff --git a/tools/marvin/pom.xml b/tools/marvin/pom.xml
index bf90ab3..d1f7611 100644
--- a/tools/marvin/pom.xml
+++ b/tools/marvin/pom.xml
@@ -83,8 +83,77 @@
       </plugin>
     </plugins>
   </build>
+  <!-- Custom profiles for sync and integration tests-->
   <profiles>
     <profile>
+      <id>sync</id>
+      <activation>
+        <property>
+          <name>endpoint</name>
+          <value>localhost</value>
+        </property>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>exec-maven-plugin</artifactId>
+            <version>1.2.1</version>
+            <executions>
+              <execution>
+                <id>generate-sources</id>
+                <phase>generate-sources</phase>
+                <goals>
+                  <goal>exec</goal>
+                </goals>
+                <configuration>
+                  <workingDirectory>${basedir}/marvin</workingDirectory>
+                  <executable>python</executable>
+                  <arguments>
+                    <argument>codegenerator.py</argument>
+                    <argument>-e</argument>
+                    <argument>${endpoint}</argument>
+                    <echo>Generating ${project.artifactId} API classes}</echo>
+                  </arguments>
+                </configuration>
+              </execution>
+              <execution>
+                <id>package</id>
+                <phase>package</phase>
+                <goals>
+                  <goal>exec</goal>
+                </goals>
+                <configuration>
+                  <workingDirectory>${exec.workingdir}</workingDirectory>
+                  <executable>python</executable>
+                  <arguments>
+                    <argument>setup.py</argument>
+                    <argument>sdist</argument>
+                  </arguments>
+                </configuration>
+              </execution>
+              <execution>
+                <id>install</id>
+                <phase>install</phase>
+                <goals>
+                  <goal>exec</goal>
+                </goals>
+                <configuration>
+                  <workingDirectory>${basedir}/dist</workingDirectory>
+                  <executable>pip</executable>
+                  <arguments>
+                    <argument>install</argument>
+                    <argument>--upgrade</argument>
+                    <argument>Marvin-0.1.0.tar.gz</argument>
+                  </arguments>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+    <profile>
       <id>marvin</id>
       <activation>
         <property><name>marvin.config</name></property>
@@ -126,7 +195,7 @@
                 </goals>
                 <configuration>
                   <workingDirectory>${basedir}/marvin</workingDirectory>
-                  <executable>/usr/local/bin/nosetests</executable>
+                  <executable>nosetests</executable>
                   <arguments>
                     <argument>--with-marvin</argument>
                     <argument>--marvin-config</argument>
@@ -144,4 +213,4 @@
       </build>
     </profile>
   </profiles>
-</project>
+</project>
\ No newline at end of file

Reply via email to