<?xml version="1.0" encoding="UTF-8"?>
<!--
  #%L
  Wildfly Camel Docs
  %%
  Copyright (C) 2013 - 2015 RedHat
  %%
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  #L%
  -->
<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>org.wildfly.camel</groupId>
        <artifactId>wildfly-camel</artifactId>
        <version>10.2.0</version>
    </parent>

    <name>Wildfly Camel :: Docs</name>

    <artifactId>wildfly-camel-docs</artifactId>
    <packaging>pom</packaging>

    <properties>
        <ec2-pub-ip-dash>1-2-3-4</ec2-pub-ip-dash>
        <ec2-pub-ip>1.2.3.4</ec2-pub-ip>
        <wildfly>WildFly</wildfly>
        <wildfly-camel>WildFly-Camel</wildfly-camel>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctor-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>process-asciidoc</goal>
                        </goals>
                        <configuration>
                            <sourceDirectory>${basedir}/guide</sourceDirectory>
                            <sourceDocumentName>index.adoc</sourceDocumentName>
                            <imagesDir>images</imagesDir>
                            <backend>html</backend>
                            <doctype>book</doctype>
                            <attributes>
                                <camel-version>${version.apache.camel}</camel-version>
                                <ec2-pub-ip>${ec2-pub-ip}</ec2-pub-ip>
                                <ec2-pub-ip-dash>${ec2-pub-ip-dash}</ec2-pub-ip-dash>
                                <wildfly>${wildfly}</wildfly>
                                <wildfly-camel>${wildfly-camel}</wildfly-camel>
                                <version>${project.version}</version>
                            </attributes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <replaceregexp file="${project.build.directory}/generated-docs/sources/wildfly-camel-application-template.json" match="\{version\}" replace="${project.version}" byline="true" />
                                <replaceregexp file="${project.build.directory}/generated-docs/sources/wildfly-camel-imagestream.json" match="\{version\}" replace="${project.version}" byline="true" />
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>scripts/assembly-userguide.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <!-- Generate the changelog -->
    <profiles>
        <profile>
            <id>release</id>
            <activation>
                <property>
                    <name>release</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.gmaven</groupId>
                        <artifactId>groovy-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>generate-changelog</id>
                                <goals>
                                    <goal>execute</goal>
                                </goals>
                                <phase>verify</phase>
                                <configuration>
                                    <source>${project.basedir}/scripts/changelog-generate.groovy</source>
                                </configuration>
                            </execution>
                        </executions>
                        <dependencies>
                            <dependency>
                                <groupId>org.eclipse.mylyn.github</groupId>
                                <artifactId>org.eclipse.egit.github.core</artifactId>
                                <version>${version.eclipse.egit.github}</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
