<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (c) 2012 to original author or authors
    All rights reserved. This program and the accompanying materials
    are made available under the terms of the Eclipse Public License v1.0
    which accompanies this distribution, and is available at
    http://www.eclipse.org/legal/epl-v10.html

-->
<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>
    <groupId>io.takari.polyglot</groupId>
    <artifactId>polyglot</artifactId>
    <version>0.7.1</version>
  </parent>

  <artifactId>polyglot-ruby</artifactId>
  <packaging>takari-maven-component</packaging>
  <name>Polyglot :: Ruby</name>

  <dependencies>
    <dependency>
      <groupId>io.takari.polyglot</groupId>
      <artifactId>polyglot-common</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jruby</groupId>
      <artifactId>jruby</artifactId>
      <version>9.4.5.0</version>
      <type>pom</type>
    </dependency>
    <!-- Test -->
    <dependency>
      <groupId>io.takari.polyglot</groupId>
      <artifactId>polyglot-maven-plugin</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <properties>
    <mavengem-wagon.version>2.0.2</mavengem-wagon.version>
  </properties>

  <pluginRepositories>
    <pluginRepository>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
      <id>sonatype</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
    </pluginRepository>
  </pluginRepositories>

  <build>
    <extensions>
      <extension>
        <groupId>org.jruby.maven</groupId>
        <artifactId>mavengem-wagon</artifactId>
        <version>${mavengem-wagon.version}</version>
      </extension>
    </extensions>
    <plugins>
      <plugin>
        <artifactId>maven-invoker-plugin</artifactId>
        <configuration>
          <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
        </configuration>
        <executions>
          <execution>
            <id>integration-test</id>
            <goals>
              <goal>install</goal>
              <goal>run</goal>
            </goals>
            <configuration>
              <settingsFile>${basedir}/src/it/settings.xml</settingsFile>
              <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.jruby.maven</groupId>
                    <artifactId>
                      gem-maven-plugin
                    </artifactId>
                    <versionRange>
                      [1.0.1,)
                    </versionRange>
                    <goals>
                      <goal>initialize</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
  <profiles>
    <!--
         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
    -->
    <profile>
      <id>build</id>
   
      <activation>
        <file>
          <exists>../polyglot-common</exists>
        </file>
      </activation>

      <repositories>
	<repository>
	  <id>mavengems</id>
	  <url>mavengem:https://rubygems.org</url>
        </repository>
      </repositories>
      
      <dependencies>
        <dependency>
          <groupId>rubygems</groupId>
          <artifactId>maven-tools</artifactId>
          <version>1.2.1</version>
          <type>gem</type>
          <scope>provided</scope>
        </dependency>
      </dependencies>

      <properties>
        <jruby.plugins.version>3.0.2</jruby.plugins.version>
      </properties>

      <build>

        <plugins>
          <plugin>
            <groupId>org.jruby.maven</groupId>
            <artifactId>gem-maven-plugin</artifactId>
            <version>${jruby.plugins.version}</version>
            <executions>
              <execution>
                <goals>
                  <goal>initialize</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <includeGemsInResources>provided</includeGemsInResources>
            </configuration>
          </plugin>

        </plugins>
      </build>

    </profile>
  </profiles>
</project>
