From af6031039a2ae6a7831d5d03372d0c0f3f15bf0d Mon Sep 17 00:00:00 2001 From: Igor Vaynberg Date: Wed, 16 May 2012 09:35:21 -0700 Subject: [PATCH] build script --- LICENSE | 24 +++++++---------- release.sh | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++ select2.css | 3 +++ select2.js | 2 ++ 4 files changed, 91 insertions(+), 14 deletions(-) create mode 100755 release.sh diff --git a/LICENSE b/LICENSE index 60b675e3..627fddef 100644 --- a/LICENSE +++ b/LICENSE @@ -1,16 +1,12 @@ -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you 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 +Copyright 2012 Igor Vaynberg + +Version: @@ver@@ Timestamp: @@timestamp@@ - http://www.apache.org/licenses/LICENSE-2.0 +Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in +compliance with the License. You may obtain a copy of the License in the LICENSE file, or at: -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. +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. \ No newline at end of file diff --git a/release.sh b/release.sh new file mode 100755 index 00000000..4b9c5a57 --- /dev/null +++ b/release.sh @@ -0,0 +1,76 @@ +#!/bin/bash +set -e + +echo -n "Enter the version for this release: " + +read ver + +if [ ! $ver ]; then + echo "Invalid version." + exit +fi + +name=select2 +js="$name.js" +mini="$name.min.js" +css="$name.css" +release="$name-$ver" +tag="release-$ver" +branch="build-$ver" +curbranch=`git branch | grep "*" | sed "s/* //"` +timestamp=$(date) +tokens="s/@@ver@@/$ver/g;s/\@@timestamp@@/$timestamp/g" +remote="github" + +git branch "$branch" +git checkout "$branch" + +echo "Tokenizing..." + +find . -name "$js" | xargs sed -i -e "$tokens" +find . -name "$css" | xargs sed -i -e "$tokens" + +git add "$js" +git add "$css" + +echo "Minifying..." + +echo "/*" > "$mini" +cat LICENSE | sed "$tokens" >> "$mini" +echo "*/" >> "$mini" + +curl -s \ + -d compilation_level=SIMPLE_OPTIMIZATIONS \ + -d output_format=text \ + -d output_info=compiled_code \ + --data-urlencode "js_code@$js" \ + http://closure-compiler.appspot.com/compile \ + >> "$mini" + +git add "$mini" + +git commit -m "release $ver" + +echo "Tagging..." + +git tag -a "$tag" -m "tagged version $ver" +git push "$remote" --tags + +echo "Archiving..." + +rm -rf "$release" +mkdir "$release" + +cp $name.* "$release" +cp spinner.gif "$release" +cp README.* "$release" + +zip -r "$release.zip" "$release" +rm -rf "$release" + +echo "Cleaning Up..." + +git checkout "$curbranch" +git branch -D "$branch" + +echo "Done" \ No newline at end of file diff --git a/select2.css b/select2.css index 2e169916..81fcf0c5 100755 --- a/select2.css +++ b/select2.css @@ -1,3 +1,6 @@ +/* +Version: @@ver@@ Timestamp: @@timestamp@@ +*/ .select2-container { position: relative; display: inline-block; diff --git a/select2.js b/select2.js index 288383fd..1238e3d7 100755 --- a/select2.js +++ b/select2.js @@ -1,5 +1,7 @@ /* Copyright 2012 Igor Vaynberg + + Version: @@ver@@ Timestamp: @@timestamp@@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at: