<?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>jquery-raty</artifactId>
    <version>2.5.2</version>
    <name>jquery-raty</name>
    <description>WebJar for jquery-raty</description>
    <url>http://webjars.org</url>

    <licenses>
        <license>
            <name>MIT</name>
            <url>http://opensource.org/licenses/MIT</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <url>http://github.com/webjars/jquery-raty</url>
        <connection>scm:git:https://github.com/webjars/jquery-raty.git</connection>
        <developerConnection>scm:git:https://github.com/webjars/jquery-raty.git</developerConnection>
        <tag>jquery-raty-2.5.2</tag>
    </scm>

    <developers>
        <developer>
            <id>ptahchiev</id>
            <name>Petar Tahchiev</name>
            <email>petar@tahchiev.net</email>
        </developer>
    </developers>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <upstream.version>2.5.2</upstream.version>
        <upstream.directory>raty-${upstream.version}</upstream.directory>
        <upstream.file>${upstream.version}.zip</upstream.file>
        <upstream.url>https://github.com/wbotelhos/raty/archive</upstream.url>
        <destDir>${project.build.outputDirectory}/META-INF/resources/webjars/${project.artifactId}/${upstream.version}</destDir>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>wagon-maven-plugin</artifactId>
                <version>1.0-beta-4</version>
                <executions>
                    <execution>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>download-single</goal>
                        </goals>
                        <configuration>
                            <url>${upstream.url}</url>
                            <fromFile>${upstream.file}</fromFile>
                            <toFile>${project.build.directory}/${project.artifactId}.zip</toFile>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.7</version>
                <executions>
                    <execution>
                        <phase>process-resources</phase>
                        <goals><goal>run</goal></goals>
                        <configuration>
                            <target>
                                <echo message="unzip archive and file files" />
                                <unzip src="${project.build.directory}/${project.artifactId}.zip" dest="${destDir}">
                                    <patternset>
										<exclude name="${upstream.directory}/demo/**" />
										<exclude name="${upstream.directory}/spec/**" />
                                        <exclude name="${upstream.directory}/README.md" />
										<exclude name="${upstream.directory}/changelog.md" />
										<exclude name="${upstream.directory}/index.html" />
                                        <exclude name="${upstream.directory}/.gitignore" />
                                    </patternset>
                                    <mapper>
                                        <!-- Strip leading directory off each path -->
                                        <!-- So "xxx/docs/index.html" becomes "docs/index.html" -->
                                        <cutdirsmapper dirs="1" />
                                    </mapper>
                                </unzip>
                                <echo message="unzip done" />
								<echo message="moving resources" />
                                <move todir="${destDir}">
									<fileset dir="${destDir}/lib/">
										<include name="**/*.js" />
									</fileset>
								</move>
								<move todir="${destDir}" file="${destDir}/lib/img/" /> 
                                <delete dir="${destDir}/lib" />
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.4.2</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.scm</groupId>
                        <artifactId>maven-scm-provider-gitexe</artifactId>
                        <version>1.9</version>
                    </dependency>
                </dependencies>
            </plugin>

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

</project>
