<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <artifactId>jruby-maven-plugins</artifactId>
    <groupId>de.saumya.mojo</groupId>
    <version>1.0.10-SNAPSHOT</version>
  </parent>
  <artifactId>gem-proxy</artifactId>
  <packaging>war</packaging>
  <name>Rubygems as Maven Repository Webapp</name>
  <url>http://github.com/mkristian/jruby-maven-plugins</url>
  <dependencies>
    <dependency>
      <groupId>de.saumya.mojo</groupId>
      <artifactId>ruby-tools</artifactId>
      <version>${project.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.codehaus.plexus</groupId>
          <artifactId>plexus-classworlds</artifactId>
        </exclusion>
        <exclusion>
          <groupId>ant</groupId>
          <artifactId>ant</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.maven</groupId>
          <artifactId>maven-model</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.codehaus.plexus</groupId>
          <artifactId>plexus-velocity</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.codehaus.plexus</groupId>
          <artifactId>plexus-component-annotations</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.codehaus.plexus</groupId>
          <artifactId>plexus-container-default</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.codehaus.plexus</groupId>
          <artifactId>plexus-utils</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.codehaus.plexus</groupId>
          <artifactId>plexus-archiver</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>2.5</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.jruby</groupId>
      <artifactId>jruby-complete</artifactId>
      <version>1.7.19</version>
    </dependency>
  </dependencies>
  <build>
    <finalName>rubygems</finalName>
    <resources>
      <resource>
        <directory>src/main/ruby</directory>
      </resource>
    </resources>
    <plugins>
      <!-- we do not need to deploy that here -->
      <plugin>
	<artifactId>maven-deploy-plugin</artifactId>
	<version>2.4</version>
	<configuration>
	  <skip>true</skip>
	</configuration>
      </plugin>
      <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>${jetty.version}</version>
        <configuration>
          <scanIntervalSeconds>10</scanIntervalSeconds>
          <systemProperties>
            <systemProperty>
              <name>gem.proxy.storage</name>
              <value>${project.build.directory}/storage</value>
            </systemProperty>
            <systemProperty>
              <name>jetty.port</name>
              <value>8989</value>
            </systemProperty>
          </systemProperties>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>skip-some</id>
      <build>
	<plugins>
	  <plugin>
	    <artifactId>maven-invoker-plugin</artifactId>
	    <configuration>
	      <pomExcludes>
		<pomExclude>*/pom.xml</pomExclude>
	      </pomExcludes>
	    </configuration>
	  </plugin>
	</plugins>
      </build>
    </profile>
    <profile>
      <id>integration-test</id>
      <properties>
        <invoker.skip>true</invoker.skip>
      </properties>
      <build>
        <defaultGoal>install</defaultGoal>
        <plugins>
          <plugin>
            <artifactId>maven-invoker-plugin</artifactId>
            <version>1.5</version>
            <configuration>
	      <pomExcludes>
	      </pomExcludes>
              <projectsDirectory>src/it</projectsDirectory>
              <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
              <preBuildHookScript>setup.bsh</preBuildHookScript>
              <postBuildHookScript>verify.bsh</postBuildHookScript>
            </configuration>
            <executions>
              <execution>
                <id>integration-test</id>
                <goals>
                  <goal>install</goal>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <settingsFile>src/it/settings.xml</settingsFile>
                  <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
                </configuration>
              </execution>
            </executions>
          </plugin> 
          <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
	    <configuration>
	      <stopPort>4711</stopPort>
	      <stopKey>gem-proxy</stopKey>
	    </configuration>
            <executions>
              <execution>
                <id>start-jetty</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <scanIntervalSeconds>0</scanIntervalSeconds>
                  <daemon>true</daemon>
                </configuration>
              </execution>
              <execution>
                <id>stop-jetty</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
