Permalink
Browse files

Add release script, and add pdf/epub to generate

  • Loading branch information...
1 parent a172916 commit 756f4275dafa7e16d198b280f33167f7c827f7d7 @pmuir pmuir committed May 4, 2012
View
@@ -0,0 +1,38 @@
+#!/usr/bin/env ruby
+
+exts = ['html', 'xhtml', 'xml', 'properties', 'java']
+
+# check license in files, add it if not present
+require 'find'
+
+updated = 0
+conform = 0
+dir = File.dirname(__FILE__)
+exts.each() do |ext|
+ puts "--- processing #{ext} files"
+ license = IO.readlines(dir + '/license.'+ext).join()
+ Find.find(dir + '/../') do |f|
+ if File.file?(f) && File.extname(f) == '.'+ext
+ content = ''
+ header = ''
+ IO.readlines(f).each() do |line|
+ if content.length == 0 && header.length == 0 && (ext == 'xml' || ext == 'html' || ext == 'xhtml') && (line.index('<?') == 0 || (line.index('<!') == 0 && line.index('<!--') != 0))
+ header += line
+ else
+ content += line
+ end
+ end
+ if content.index(license) != 0
+ File.open(f, 'w') do |f2|
+ f2.puts header + license + content
+ end
+ puts "#{f} updated"
+ updated += 1
+ else
+ conform += 1
+ end
+ end
+ end
+end
+puts "------------------------------------------------"
+puts "#{updated} files updated, #{conform} already compliant"
View
@@ -0,0 +1,16 @@
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2012, Red Hat, Inc. and/or its affiliates, and individual
+contributors by the @authors tag. See the copyright.txt in the
+distribution for a full listing of individual contributors.
+
+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.
+-->
View
@@ -0,0 +1,16 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * 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.
+ */
View
@@ -0,0 +1,14 @@
+# JBoss, Home of Professional Open Source
+# Copyright 2012, Red Hat, Inc. and/or its affiliates, and individual
+# contributors by the @authors tag. See the copyright.txt in the
+# distribution for a full listing of individual contributors.
+#
+# 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.
View
@@ -0,0 +1,16 @@
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2012, Red Hat, Inc. and/or its affiliates, and individual
+contributors by the @authors tag. See the copyright.txt in the
+distribution for a full listing of individual contributors.
+
+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.
+-->
View
@@ -0,0 +1,10 @@
+<!-- JBoss, Home of Professional Open Source Copyright 2012, Red Hat, Inc.
+ and/or its affiliates, and individual contributors by the @authors tag. See
+ the copyright.txt in the distribution for a full listing of individual contributors.
+ 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. -->
View
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- JBoss, Home of Professional Open Source Copyright 2012, Red Hat, Inc.
+ and/or its affiliates, and individual contributors by the @authors tag. See
+ the copyright.txt in the distribution for a full listing of individual contributors.
+ 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. -->
+<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.jboss</groupId>
+ <artifactId>jboss-parent</artifactId>
+ <version>6-beta-2</version>
+ <relativePath/>
+ </parent>
+ <groupId>org.jboss.seam.migration</groupId>
+ <artifactId>jboss-seam-migration-dist</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Seam 2 Migration</name>
+ <description>Seam 2 to Java EE 6 Migration Distribution</description>
+ <url>http://seamframework.org</url>
+
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <distribution>repo</distribution>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
+ </license>
+ </licenses>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>distribution</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/assembly.xml</descriptor>
+ </descriptors>
+ <finalName>seam-migration-${project.version}</finalName>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
View
@@ -0,0 +1,10 @@
+Releasing
+=========
+
+1. Ensure you have dblatex, asciidoc and pygments set up and ready to run. This is used to process the markdown files and add syntax highlighting.
+2. Make sure you have Bash 3 or newer
+3. Make sure you have credentials set up to deploy to `jboss-releases-repository` in your `settings.xml`, and have access to rsync files to `filemgmt.jboss.org/download_htdocs/seam`
+4. Release
+
+ dist/release.sh -s <old snapshot version> -r <release version>
+
View
@@ -0,0 +1,80 @@
+#!/bin/bash
+
+REQUIRED_BASH_VERSION=3.0.0
+
+if [[ $BASH_VERSION < $REQUIRED_BASH_VERSION ]]; then
+ echo "You must use Bash version 3 or newer to run this script"
+ exit
+fi
+
+
+SOURCE="${BASH_SOURCE[0]}"
+while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
+DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
+
+# DEFINE
+
+# SCRIPT
+
+usage()
+{
+cat << EOF
+usage: $0 options
+
+This script aids in releasing the quickstarts
+
+OPTIONS:
+ -u Updates version numbers in all POMs, used with -o and -n
+ -o Old version number to update from
+ -n New version number to update to
+ -g Generate html & pdf versions of guides
+ -h Shows this message
+EOF
+}
+
+update()
+{
+cd $DIR/../
+echo "Updating versions from $OLDVERSION TO $NEWVERSION for all Java and XML files under $PWD"
+perl -pi -e "s/${OLDVERSION}/${NEWVERSION}/g" `find . -name \*.xml -or -name \*.java`
+}
+
+asciidoc()
+{
+ ${DIR}/../generate-guides.sh
+}
+
+OLDVERSION="1.0.0-SNAPSHOT"
+NEWVERSION="1.0.0-SNAPSHOT"
+VERSION="1.0.0-SNAPSHOT"
+CMD="usage"
+
+while getopts “muo:n:r:” OPTION
+
+do
+ case $OPTION in
+ u)
+ CMD="update"
+ ;;
+ h)
+ usage
+ exit
+ ;;
+ o)
+ OLDVERSION=$OPTARG
+ ;;
+ n)
+ NEWVERSION=$OPTARG
+ ;;
+ g)
+ CMD="asciidoc"
+ ;;
+ [?])
+ usage
+ exit
+ ;;
+ esac
+done
+
+$CMD
+
View
@@ -0,0 +1,114 @@
+#!/bin/bash
+
+REQUIRED_BASH_VERSION=3.0.0
+
+if [[ $BASH_VERSION < $REQUIRED_BASH_VERSION ]]; then
+ echo "You must use Bash version 3 or newer to run this script"
+ exit
+fi
+
+SOURCE="${BASH_SOURCE[0]}"
+while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
+DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
+
+# DEFINE
+
+VERSION_REGEX='([0-9]*)\.([0-9]*)([a-zA-Z0-9\.]*)'
+
+
+# SCRIPT
+
+usage()
+{
+cat << EOF
+usage: $0 options
+
+This script performs a release of the Migration guides
+
+OPTIONS:
+ -s Snapshot version number to update from
+ -n New snapshot version number to update to, if undefined, defaults to the version number updated from
+ -r Release version number
+EOF
+}
+
+release()
+{
+ echo "Regenerating html & pdf from asciidoc"
+ $DIR/release-utils.sh -g
+ echo "Releasing Seam Migration version $RELEASEVERSION"
+ $DIR/release-utils.sh -u -o $SNAPSHOTVERSION -n $RELEASEVERSION
+ git commit -a -m "Prepare for $RELEASEVERSION release"
+ git tag -a $RELEASEVERSION -m "Tag $RELEASEVERSION"
+ $DIR/release-utils.sh -u -o $RELEASEVERSION -n $NEWSNAPSHOTVERSION
+ git commit -a -m "Prepare for development of $NEWSNAPSHOTVERSION"
+ echo "Building Distribution zip"
+ BRANCH=$(parse_git_branch)
+ git checkout $RELEASEVERSION
+ mvn clean install -f $DIR/pom.xml
+ git checkout $BRANCH
+ echo "Uploading distribution to http://download.jboss.org/seam/$MAJOR_VERSION/migration/$RELEASEVERSION/jboss-seam-migration-$RELEASEVERSION-dist.zip"
+ rsync -Pv --protocol=28 $DIR/target/jboss-seam-migration-$RELEASEVERSION-dist.zip seam@filemgmt.jboss.org:downloads_htdocs/seam/$MAJOR_VERSION/migration/$RELEASEVERSION/
+}
+
+parse_git_branch() {
+ git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
+}
+
+
+SNAPSHOTVERSION="UNDEFINED"
+RELEASEVERSION="UNDEFINED"
+NEWSNAPSHOTVERSION="UNDEFINED"
+MAJOR_VERSION="UNDEFINED"
+MINOR_VERSION="UNDEFINED"
+
+while getopts “n:r:s:” OPTION
+
+do
+ case $OPTION in
+ h)
+ usage
+ exit
+ ;;
+ s)
+ SNAPSHOTVERSION=$OPTARG
+ ;;
+ r)
+ RELEASEVERSION=$OPTARG
+ ;;
+ n)
+ NEWSNAPSHOTVERSION=$OPTARG
+ ;;
+ [?])
+ usage
+ exit
+ ;;
+ esac
+done
+
+if [[ $RELEASEVERSION =~ $VERSION_REGEX ]]; then
+ MAJOR_VERSION=${BASH_REMATCH[1]}
+ MINOR_VERSION=${BASH_REMATCH[2]}
+fi
+
+if [ "$NEWSNAPSHOTVERSION" == "UNDEFINED" ]
+then
+ NEWSNAPSHOTVERSION=$SNAPSHOTVERSION
+fi
+
+if [ "$MAJOR_VERSION" == "UNDEFINED" -o "$MINOR_VERSION" == "UNDEFINED" ]
+then
+ echo "\nUnable to extract major and minor versions\n"
+ usage
+ exit
+fi
+
+if [ "$SNAPSHOTVERSION" == "UNDEFINED" -o "$RELEASEVERSION" == "UNDEFINED" ]
+then
+ echo "\nMust specify -r and -s\n"
+ usage
+ exit
+fi
+
+release
+
Oops, something went wrong.

0 comments on commit 756f427

Please sign in to comment.