<?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>
        <artifactId>reference-base</artifactId>
        <groupId>org.sakaiproject</groupId>
        <version>11.3</version>
        <relativePath>../../pom.xml</relativePath>
    </parent>

    <packaging>jar</packaging>
    <groupId>org.sakaiproject.webjars</groupId>
    <artifactId>ckeditor-autosave</artifactId>
    <version>${ckeditor.autosave.version}</version>
    <name>CKEditor-autosave-webjar</name>
    <description>WebJar for CKEditor-autosave</description>
    <url>http://webjars.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <upstream.version>${ckeditor.autosave.version}</upstream.version>
        <upstream.url>https://github.com/w8tcha/CKEditor-AutoSave-Plugin/archive/${upstream.version}</upstream.url>
        <destDir>${project.build.outputDirectory}/META-INF/resources/webjars/autosave/${upstream.version}</destDir>
        <requirejs>
            {
                "paths": {
                    "autosave": "autosave",
                }
            }
        </requirejs>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.8</version>
                <executions>
                    <execution>
                        <phase>process-resources</phase>
                        <goals><goal>run</goal></goals>
                        <configuration>
                            <target>
                                <mkdir dir="${destDir}" />
                                <get src="${upstream.url}/${upstream.version}.zip" dest="${project.build.directory}/${project.artifactId}.zip" />
                                <echo message="unzip archives" />
                                <unzip src="${project.build.directory}/${project.artifactId}.zip" dest="${project.build.directory}">
                                    <cutdirsmapper dirs="1"/>
                                </unzip>
                                    
-                                <echo message="moving resources" />
-                                <move todir="${destDir}">
-                                    <fileset dir="${project.build.directory}/autosave" excludes="samples/" />
-                                </move>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

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

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

</project>
