Permalink
Browse files

build script

  • Loading branch information...
1 parent e5f628b commit af6031039a2ae6a7831d5d03372d0c0f3f15bf0d @ivaynberg ivaynberg committed May 16, 2012
Showing with 91 additions and 14 deletions.
  1. +10 −14 LICENSE
  2. +76 −0 release.sh
  3. +3 −0 select2.css
  4. +2 −0 select2.js
View
24 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.
View
@@ -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"
View
@@ -1,3 +1,6 @@
+/*
+Version: @@ver@@ Timestamp: @@timestamp@@
+*/
.select2-container {
position: relative;
display: inline-block;
View
@@ -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:

0 comments on commit af60310

Please sign in to comment.