<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/maven-v4_0_0.xsd">

  <parent>
    <groupId>org.torquebox</groupId>
    <artifactId>torquebox-parent</artifactId>
    <version>2.1.2.redhat.1</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <modelVersion>4.0.0</modelVersion>
  <groupId>rubygems</groupId>
  <artifactId>torquebox-gems-parent</artifactId>
  <packaging>pom</packaging>
  <name>TorqueBox Gems Parent</name>
  <description />

  <modules>
    <module>core</module>
    <module>naming</module>
    <module>transactions</module>
    <module>messaging</module>
    <module>stomp</module>
    <module>security</module>
    <module>cache</module>
    <module>web</module>

    <module>configure</module>

    <module>rake-support</module>
    <module>capistrano-support</module>

    <module>no-op</module>
    <module>torquebox</module>
  </modules>

  <dependencies>
    <dependency>
      <groupId>rubygems</groupId>
      <artifactId>rspec</artifactId>
      <type>gem</type>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>de.saumya.mojo</groupId>
          <artifactId>rspec-maven-plugin</artifactId>
          <executions>
            <execution>
              <id>run-specs</id>
              <phase>test</phase>
              <goals>
                <goal>test</goal>
              </goals>
              <configuration>
                <fork>true</fork>
                <systemProperties>
                  <property>
                    <name>log4j.configuration</name>
                    <value>test-log4j.xml</value>
                  </property>
                </systemProperties>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
          <executions>
            <execution>
              <inherited>true</inherited>
              <id>test-resources</id>
              <goals>
                <goal>testResources</goal>
              </goals>
              <phase>process-test-resources</phase>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-deploy-plugin</artifactId>
        <executions>
          <execution>
            <id>default-deploy</id>
            <phase>deploy</phase>
            <goals>
              <goal>deploy</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>assemblage-present</id>
      <activation>
        <file>
          <exists>../../build/assembly/target/stage/torquebox/jruby</exists>
        </file>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>de.saumya.mojo</groupId>
              <artifactId>jruby-maven-plugin</artifactId>
              <executions>
                <execution>
                  <id>install-gem</id>
                  <inherited>true</inherited>
                  <phase>install</phase>
                  <goals>
                    <goal>jruby</goal>
                  </goals>
                  <configuration>
                    <jrubyJvmArgs>-Xmx768m</jrubyJvmArgs>
                    <script>
                      basedir = '${project.basedir}'.gsub('\\', '/')
                      load %Q(#{basedir}/../../build/assembly/lib/assembly_tool.rb)
                      ext = '.gem'
                      ext = ( ( 'java-gem' == '${project.packaging}' ) ? '-java.gem' : '.gem' )
                      safe_version = '${project.version}'.gsub(/-SNAPSHOT/, '')
                      AssemblyTool.install_gem( %Q(#{basedir}/target/${project.artifactId}-#{safe_version}#{ext}) )
                    </script>
                  </configuration>
                </execution>
              </executions>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>

    <profile>
      <id>dist</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>de.saumya.mojo</groupId>
            <artifactId>jruby-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>dist-yardocs</id>
                <inherited>false</inherited>
                <phase>prepare-package</phase>
                <goals>
                  <goal>jruby</goal>
                </goals>
                <configuration>
                  <file>bin/run-yard.rb</file>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
              <execution>
                <id>jar-dist-yardocs</id>
                <inherited>false</inherited>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
                <configuration>
                  <descriptors>
                    <descriptor>src/main/assembly/yardoc-jar.xml</descriptor>
                  </descriptors>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

  </profiles>
</project>
