source: trunk/contrib/make-release.sh

Last change on this file was 1435, checked in by gogo, 20 months ago

make-release needed to make the lang/merged directory because it's not part of the repo.

File size: 4.3 KB
Line 
1#!/bin/bash
2
3if ! [ -f XinhaCore.js ]
4then
5  echo "Run this from the root of your working copy." >&2
6  echo                                                >&2
7  exit 1
8fi
9
10
11if ! [ -d .svn ]
12then
13  echo "This script must be run inside a subversion working copy." >&2
14  echo                                                             >&2
15  exit 1
16fi
17
18if [ "$1" = "" ]
19then
20  echo "Usage: $0 {VersionNumber}"                    >&2
21  echo                                                >&2
22  exit 1
23fi
24
25# Run this with bash from the root of your SVN working copy checkout of the trunk
26# it will dump int /tmp the archived release files
27# eg bash contrib/make-release.sh
28
29VER="$1"
30
31# Export
32if [ -d /tmp/xinha-$VER ]
33then
34  echo "/tmp/xinha-$VER exists, you need to delete it first."
35  exit
36fi
37
38# Update plugin Manifest
39MANIFEST="$(bash contrib/generate-plugin-manifest.sh | sort | perl -0777 -pe 's/,\s*$//s' )"
40cat XinhaCore.js | perl -0777  -pe 's/(.pluginManifest\s+=)\s+.+?;/\1 {\nPUT_THE_MANIFEST_HERE_YO\n};/is' | replace PUT_THE_MANIFEST_HERE_YO "$MANIFEST" >XinhaCore2.js
41mv XinhaCore2.js XinhaCore.js
42
43
44mkdir /tmp/xinha-$VER
45svn export $(pwd) /tmp/xinha-$VER/xinha
46cd /tmp/xinha-$VER/xinha
47echo "xinha-$VER" >VERSION.TXT
48
49# Create the merged language files
50mkdir lang/merged
51php contrib/lc_parse_strings.php
52for lang in $(find . -wholename "*/lang/*.js" | sed -r 's/.*\///' | sort | uniq | grep -v base | sed -r 's/.js//')
53do
54  php contrib/lc_create_merged_file.php $lang lang/merged/$lang.js
55done
56php contrib/lc_create_merged_file.php NEW lang/merged/__new__.js
57
58
59cd ../
60
61# Create the main distribution zip and bz2
62zip -r xinha-$VER.zip        xinha
63#tar -cjvf xinha-$VER.tar.bz2 xinha
64
65# Make a stripped down plugins set for the plugins which must be run locally
66#  ie, ones that upload files or deal with the local server file system
67mkdir xinha-cdn
68mkdir xinha-cdn/contrib
69mkdir xinha-cdn/plugins
70cp -rp xinha/contrib/php-xinha.php         xinha-cdn/contrib
71cp -rp xinha/contrib/.htaccess             xinha-cdn/contrib
72cp -rp xinha/plugins/MootoolsFileManager   xinha-cdn/plugins
73cp -rp xinha/plugins/Linker                xinha-cdn/plugins
74cp -rp xinha/examples                      xinha-cdn/examples
75
76# Some examples are not appropriate for the cdn
77rm -rf xinha-cdn/examples/Old_Newbie_Guide
78rm -rf xinha-cdn/examples/ExtendedDemo.html
79rm -rf xinha-cdn/examples/files/ext_example*php
80rm -rf xinha-cdn/examples/files/Extended.html
81
82# Comment out some examples from the index
83cat xinha-cdn/examples/index.html | sed -r 's/<h2>Exper/<!-- These are not applicable in a CDN environment: <h2>Exper/' | sed -r 's/(<.body>)/-->\1/' >xinha-cdn/examples/index.html.2
84mv xinha-cdn/examples/index.html.2  xinha-cdn/examples/index.html
85
86# Replace the XinhaEasy.js link to the "CDN" link
87for file in xinha-cdn/examples/*
88do
89  replace "../XinhaEasy.js" "//s3-us-west-1.amazonaws.com/xinha/xinha-${VER}/XinhaEasy.js" -- $file
90done
91
92cat >xinha-cdn/README.TXT <<'EOF'
93Xinha CDN Local Distribution
94--------------------------------------------------------------------------------
95
96This directory contains plugins for Xinha (www.xinha.org) which must be run on
97the local web server rather than from an external server/content delivery
98network.
99
100Consult the NewbieGuide ( http://trac.xinha.org/wiki/Documentation/NewbieGuide )
101for complete details on Xinha configuration and see the examples in the directory
102here for, err, examples.
103
104Especially take note of examples/UsingPhpPlugins.php
105
106EOF
107echo "xinha-$VER" >xinha-cdn/VERSION.TXT
108zip -r    xinha-$VER-cdn.zip     xinha-cdn
109#tar -cjvf xinha-cdn.tar.bz2 xinha-cdn
110
111# Update the s3 bucket
112read -p "Upload to \"s3://xinha/xinha-${VER}/\"? [yN]: "
113if [ "$REPLY" == "y" ] || [ "$REPLY" == "Y" ]
114then
115  cd xinha
116  s3cmd --delete-removed --acl-public sync ./ s3://xinha/xinha-${VER}/
117  cd ..
118fi
119
120read -p "Upload to \"s3://xinha/xinha-latest/\"? [yN]: "
121if [ "$REPLY" == "y" ] || [ "$REPLY" == "Y" ]
122then
123  cd xinha
124  s3cmd --delete-removed --acl-public sync ./ s3://xinha/xinha-latest/
125  cd ..
126fi
127
128cd xinha
129php contrib/compress_yui.php
130sleep 5
131cd ../
132zip -r    xinha-$VER-minified.zip     xinha
133# tar -cjvf xinha-$VER-minified.tar.bz2 xinha
134
135ls -l *.zip
136read -p "Upload zip files to to \"s3://xinha/releases/\"? [yN]: "
137if [ "$REPLY" == "y" ] || [ "$REPLY" == "Y" ]
138then
139  for file in *.zip
140  do
141    s3cmd --acl-public put $file s3://xinha/releases/
142  done
143fi
Note: See TracBrowser for help on using the repository browser.