Merge lp:~dbarth/ubuntu-html5-theme/cmdline-tool into lp:ubuntu-html5-theme

Proposed by David Barth
Status: Merged
Approved by: Alexandre Abreu
Approved revision: 201
Merged at revision: 207
Proposed branch: lp:~dbarth/ubuntu-html5-theme/cmdline-tool
Merge into: lp:ubuntu-html5-theme
Diff against target: 78 lines (+74/-0)
1 file modified
ubuntu-html5-theme (+74/-0)
To merge this branch: bzr merge lp:~dbarth/ubuntu-html5-theme/cmdline-tool
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu HTML5 Theme Developers Pending
Review via email: mp+253498@code.launchpad.net

Commit message

Add a command line tool to maintain a theme installation in an html5 project

Description of the change

Add a command line tool to maintain a theme installation in an html5 project

To post a comment you must log in.
Revision history for this message
David Barth (dbarth) wrote :

# To list the available HTML5 toolkit / theme releases:
$ ubuntu-html5-theme list
trunk
14.10
14.04
13.10
rtm-14.09

# To install a toolkit release in the current project directory
$ ubuntu-html5-theme install 14.10
Downloading release 14.10...
Branched 177 revisions.

# To convert the index.html file of an existing project
$ ubuntu-html5-theme convert

Et voilĂ 

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
XiaoGuo, Liu (liu-xiao-guo) wrote :

When I run it, it outputs error message like:

liuxg@liuxg:~/web/proj$ ./ubuntu-html5-theme list
awk: line 1: syntax error at or near ,
liuxg@liuxg:~/web/proj$

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'ubuntu-html5-theme'
2--- ubuntu-html5-theme 1970-01-01 00:00:00 +0000
3+++ ubuntu-html5-theme 2015-03-19 11:19:45 +0000
4@@ -0,0 +1,74 @@
5+#! /bin/sh
6+
7+OUTDIR="$(pwd)"
8+WORKDIR=$(mktemp -d)
9+
10+cleanup()
11+{
12+ rm -rf $WORKDIR
13+ rm -f .ubuntu-html5-theme.releases-list
14+}
15+
16+trap cleanup EXIT INT QUIT ILL KILL SEGV TERM
17+
18+
19+list_releases() {
20+ wget -q -O ./.ubuntu-html5-theme.releases-list https://code.launchpad.net/ubuntu-html5-theme
21+ cat .ubuntu-html5-theme.releases-list | \
22+ grep lp:ubuntu | \
23+ grep ~ubuntu-html5-theme-devs | \
24+ awk '{match($0, /~ubuntu-html5-theme-devs\/ubuntu-html5-theme\/([^\"]*)/, releases); print releases[1]}'
25+}
26+
27+download() {
28+ rel=$1
29+ echo "Downloading release $rel..."
30+ bzr branch https://code.launchpad.net/~ubuntu-html5-theme-devs/ubuntu-html5-theme/$1 $WORKDIR/$rel
31+ if [ "$?" -ne 0 ]; then
32+ echo "Unable to download release $rel"
33+ exit 1
34+ fi
35+}
36+
37+do_install_theme() {
38+ if [ ! -d $OUTDIR/www ]; then
39+ echo "No 'www' folder found in the current directory"
40+ echo "Exiting..."
41+ exit 1
42+ fi
43+ if [ -d $OUTDIR/ambiance ]; then
44+ echo "There is already an 'ambiance' folder in the project directory"
45+ echo "Exiting..."
46+ exit 1
47+ fi
48+ download $1
49+ mv $WORKDIR/$1/0.1/ambiance $OUTDIR/www
50+}
51+
52+do_convert_project() {
53+ if [ ! -e $OUTDIR/www/index.html ]; then
54+ echo "No index.html found in the 'www' folder"
55+ echo "Exiting..."
56+ exit 1
57+ fi
58+ sed -i 's:/usr/share/ubuntu-html5-ui-toolkit/0.1/::' $OUTDIR/www/index.html
59+}
60+
61+case "$1" in
62+install)
63+ do_install_theme $2
64+ ;;
65+convert)
66+ do_convert_project
67+ ;;
68+list)
69+ list_releases
70+ ;;
71+update)
72+ echo "Not implemented..."
73+ exit 1
74+ ;;
75+*)
76+ echo "Usage: $0 {list|install <release>|convert|update}"
77+ exit 1
78+esac

Subscribers

People subscribed via source and target branches