<?xml version="1.0" encoding="UTF-8"?>
<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">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>7</version>
    </parent>

    <packaging>jar</packaging>
    <groupId>org.webjars</groupId>
    <artifactId>rjs</artifactId>
    <version>2.3.5</version>
    <name>r.js</name>
    <description>WebJar for r.js - the RequireJS optimizer</description>
    <url>http://webjars.org</url>

    <licenses>
        <license>
            <name>The MIT License</name>
            <url>https://github.com/requirejs/r.js/blob/master/LICENSE</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <url>http://github.com/webjars/r.js</url>
        <connection>scm:git:https://github.com/webjars/r.js.git</connection>
        <developerConnection>scm:git:https://github.com/webjars/r.js.git</developerConnection>
        <tag>rjs-2.3.5</tag>
    </scm>

    <developers>
        <developer>
            <id>huntc</id>
            <name>Christopher Hunt</name>
        </developer>
    </developers>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <upstreamVersion>2.3.5</upstreamVersion>
        <upstream.url>https://registry.npmjs.org/requirejs/-/requirejs-${upstreamVersion}.tgz</upstream.url>
        <extractDir>${project.build.directory}/package</extractDir>
        <destDir>
            ${project.build.outputDirectory}/META-INF/resources/webjars/${project.artifactId}/${upstreamVersion}
        </destDir>
    </properties>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.7</version>
                <executions>
                    <execution>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <get src="${upstream.url}" dest="${project.build.directory}/${project.artifactId}.tgz" />

                                <echo message="untar archive" />
                                <untar src="${project.build.directory}/${project.artifactId}.tgz" dest="${project.build.directory}" compression="gzip" />

                                <echo message="moving resources" />
                                <move file="${extractDir}/package.json" toDir="${destDir}" />
                                <move file="${extractDir}/bin" toDir="${destDir}" />
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.1</version>
            </plugin>

            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>1.6.5</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>sonatype-nexus-staging</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>
