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

Subscribers

People subscribed via source and target branches