<?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.5</version>
  </parent>
  <artifactId>ruby-tools</artifactId>
  <version>1.0.5</version>
  <name>Ruby Tools</name>
  <dependencies>
    <dependency>
      <groupId>org.jruby</groupId>
      <artifactId>jruby-complete</artifactId>
      <version>${jruby.version}</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>ant</groupId>
      <artifactId>ant</artifactId>
      <version>1.6.5</version>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-velocity</artifactId>
      <version>1.1.8</version>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-component-annotations</artifactId>
      <version>${plexus.version}</version>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-container-default</artifactId>
      <version>${plexus.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-classworlds</artifactId>
      <version>2.2.3</version>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-utils</artifactId>
      <version>2.0.5</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-model</artifactId>
      <version>${maven.version}</version>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-archiver</artifactId>
      <version>1.2</version>
    </dependency>
    <dependency>
      <groupId>org.yaml</groupId>
      <artifactId>snakeyaml</artifactId>
      <version>1.7</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-core</artifactId>
      <version>${maven.version}</version>
      <optional>true</optional>
      <!--scope>provided</scope-->
    </dependency>
  </dependencies>
  <properties>
    <jruby.versions>1.5.6,1.6.5.1,1.6.7.2,1.7.0.preview1</jruby.versions>
    <jruby.18and19>true</jruby.18and19>
    <plexus.version>1.5.4</plexus.version>
  </properties>
  <build>
    <resources>
      <resource>
        <directory>${basedir}/src/main/resources</directory>
      </resource>
    </resources>
    <plugins>
      <plugin>
	<artifactId>maven-dependency-plugin</artifactId> 
	<version>2.8</version>
	<executions>
          <execution>
            <id>copy jruby</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.jruby</groupId>
                  <artifactId>jruby-complete</artifactId>
                  <version>${jruby.version}</version>
                  <overWrite>false</overWrite>
                  <outputDirectory>${project.build.directory}</outputDirectory>
                </artifactItem>
	      </artifactItems>.
	    </configuration>
	  </execution>
          <execution>
            <id>copy gems</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
	      <includeTypes>gem</includeTypes>
	    </configuration>
	  </execution>
	</executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.2</version>
	<executions>
	  <execution>
	    <id>install gems</id>
	    <phase>process-resources</phase>
	    <goals><goal>exec</goal></goals>
            <configuration>
              <executable>java</executable> 
              <arguments>
		<argument>-jar</argument>
		<argument>${project.build.directory}/jruby-complete-${jruby.version}.jar</argument>
		<argument>${basedir}/src/main/scripts/install_gems.rb</argument>
	      </arguments>
	    </configuration>
	  </execution>
	</executions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile> 
      <!--
	 that profile looks for the development setup and then gets all the 
         needed gems from http://rubygems-proxy.torquebox.org/releases
         this repo does not show when the pom is used from maven central
	 
	 all the gems here are embedded into the jar itself, i.e. those
	 gem dependencies are only for build time
      -->
      <id>build</id>
   
      <activation>
        <file>
          <exists>../jruby-maven-plugin</exists>
        </file>
      </activation>

      <repositories>
	<repository>
	  <id>rubygems-releases</id>
	  <url>http://rubygems-proxy.torquebox.org/releases</url>
	</repository>
      </repositories>

      <dependencies>
	<dependency>
	  <groupId>rubygems</groupId>
	  <artifactId>maven-tools</artifactId>
	  <version>1.0.3</version>
	  <type>gem</type>
	  <scope>provided</scope>
	</dependency>
      </dependencies>
    </profile>
  </profiles>
</project>
