Script – from google code svn to google code downloads

You may have a google code project and the project has the same layout in the google code svn repository as the target files you wish to publish in the google code download section.

Manually downloading a copy of your repo and exporting to a zip file then manually uploading to google can be a pain. The following script takes care of doing all that for you

And now to the point you can get the two files here

Once you download both files and you place them in a folder make sure both are executable and to get a list of options you can run:

./google-code-svn-to-download.sh

Usage: ./google-code-svn-to-download.sh

Required parameters

-p Google Code project name

Optional parameters

-u Your Google Code username (will ask if not provided)
-w Your Google Code password (will ask if not provided)
-s Short description of the file (Defaults to project name)
-l A list of comma-separated labels to attach to the file
-f the name of the file to upload (Defaults to project name)

And here is an example of the script running passing all parameters:

 
raul-raja-martinezs-macbook:test raul$ ./google-code-svn-to-download.sh -p raulrajatutorials -u raulraja -w your_google_code_pass -s "my file summary" -l tag1,tag2,tag3,tag4 -f myfilename
fetching raulrajatutorials from google svn repository
cleaning up local svn files
zipping raulrajatutorials to myfilename.zip
removing svn downloaded files
uploading raulrajatutorials to google code downloads area
The file was uploaded successfully.
URL: http://raulrajatutorials.googlecode.com/files/myfilename.ZIP
Removing myfilename.zip after uploaded to google

This is what the script does:

  1. Download a copy of your trunk from your google code project svn repository.
  2. Zip the download
  3. Uploads the zipped file to your google code downloads section using this handy python script provided by google

And in case you’re wondering about the script itself here it is. If you copy it from here don’t forget to grab also the google script here

 
#!/bin/bash
# checkouts your google code project and makes a zip and uploads it to the downloads section
#  -s SUMMARY, Short description of the file
#  -p PROJECT, Google Code project name
#  -u USER, Your Google Code username
#  -w PASSWORD, Your Google Code password
#  -l LABELS, An optional list of comma-separated labels to attach to the file
#  -f FILENAME, the file name to be used on the upload
 
SCRIPT_USAGE="\
\n    Usage: $0
\n
\n    Required parameters
\n
\n      -p Google Code project name
\n
\n    Optional parameters
\n
\n      -u Your Google Code username (will ask if not provided)
\n      -w Your Google Code password (will ask if not provided)
\n      -s Short description of the file (Defaults to project name)
\n      -l A list of comma-separated labels to attach to the file
\n      -f the name of the file to upload (Defaults to project name)
\n
\n"
 
 
# Iterate over the options passed to the script
while getopts "s:p:u:w:l:f:" MYOPTION;
do
	case "$MYOPTION" in
		s)   GOOGLE_CODE_SUMMARY="$OPTARG" ;;
		p)   GOOGLE_CODE_PROJECT="$OPTARG" ;;
		u)   GOOGLE_CODE_USER="$OPTARG" ;;
		w)   GOOGLE_CODE_PASSWORD="$OPTARG" ;;
		l)   GOOGLE_CODE_LABELS="$OPTARG" ;;
		f)   GOOGLE_CODE_FILENAME="$OPTARG" ;;
	esac
done
 
 
# if all the required options are there
if [ -z "${GOOGLE_CODE_PROJECT}" ];
then
    # One of the required arguments is missing
    echo -e $SCRIPT_USAGE
else
     # setup default values if necessary
    GOOGLE_CODE_FILENAME=${GOOGLE_CODE_FILENAME:="$GOOGLE_CODE_PROJECT"}
    GOOGLE_CODE_SUMMARY=${GOOGLE_CODE_SUMMARY:="latest $GOOGLE_CODE_PROJECT"}
    # fetch project from svn
    echo "fetching $GOOGLE_CODE_PROJECT from google svn repository"
    svn export -q http://$GOOGLE_CODE_PROJECT.googlecode.com/svn/trunk/ $GOOGLE_CODE_PROJECT
 
    # zip the project
    echo "zipping $GOOGLE_CODE_PROJECT to $GOOGLE_CODE_FILENAME.zip"
    zip -r -q $GOOGLE_CODE_FILENAME.zip $GOOGLE_CODE_PROJECT
 
    # remove the svn download folders
    echo "removing svn downloaded files"
    rm -rf $GOOGLE_CODE_PROJECT
 
    # upload the project to the google code downloads
    echo "uploading $GOOGLE_CODE_PROJECT to google code downloads area"
    ./googlecode_upload.py -s "$GOOGLE_CODE_SUMMARY" -p "$GOOGLE_CODE_PROJECT" -u "$GOOGLE_CODE_USER" -w "$GOOGLE_CODE_PASSWORD" -l "$GOOGLE_CODE_LABELS" $GOOGLE_CODE_FILENAME.ZIP
 
    # remove the zip file
    echo "Removing $GOOGLE_CODE_FILENAME.zip after uploaded to google"
    rm -rf $GOOGLE_CODE_FILENAME.ZIP   
fi
Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • MySpace
  • RSS
  • TwitThis
  • email
  • FriendFeed
  • PDF
  • Slashdot

This post is tagged , , ,

don't '

4 Responses

  1. Ben Collins-Sussman says:

    Your script would be much simpler if you simply run ‘svn export’ rather than ‘svn checkout’. ‘svn export’ is the same thing, except that it doesn’t create the .svn/ metadata subdirs. So you wouldn’t have to go and delete those anymore. :-)

  2. Raul Raja says:

    Thanks Ben, I have updated the script and post to use “svn export”

  3. alisher says:

    is there any possible and good solution for embedded googlewave which is on my website, as you can see the content of blip are store in iframe and i want to get it,

    by remembering cross-domain does not allow you to do this, although I have had my own blip content.

    Hope that you got my point

    thanks
    ali

  4. Raul Raja says:

    If the content is in the same domain you can get the html of the iframe, if not afaik you can’t. I’m not sure how the wave api for embedded waves implement that. You should try using the wave apis for extracting, creating or manipulating waves if it fits your use case http://code.google.com/apis/wave/

Leave a Reply

Comments may be held for moderation, please do not repost. I reserve the right to remove any inappropriate or off-topic comments. If you plan on sharing helpful code, please pass it through Postable first. Want other to know who you are? Register a Gravatar.





Sponsored Links

Categories

Pages

juice141
insurance158
gardens47
jewelers93
bestyoucanfind.info
heart146
james29
lyrics167
industries92
google142
lafayette9
kitchen229
lyrics120
jesus90
italian248
lyrics1
afreeocx.com
guide24
manhattan166
green201
information113
frank168
lyrics160
lyrics190
family142
kofflerboats.com
hitachi214
festival182
forest102
jamaica25
hotel86
executive74
guide23
flavor28
grant172
hockey221
free-microsofts.com
lyrics239
thesagamore.com
failed120
hockey220
healthbenefitsdepot.com
generic67
exchange72
fever194
island235
games21
italy249
manual188
management155
excellpressurewashers.com
library131
gibson97
grill212
marble210
flights35
hotel150
manitoba168
manual186
found137
finance231
house216
install128
institute139
lyric61
garden44
katie169
guitar51
festival181
hotels171
house189
franchise158
columbiatn.com
insurance150
guitar58
illinois22
louisville24
little204
festival189
height163
lyric67
guitar48
lyrics152
lyric48
lacrosse6
hotel154
georgia80
marine233
fitness19
cam.com
hospital62
hunter243
magazine103
floyd73
living210
sex-teen.org
lyrics46
honda22
honey36
mmgins.com
hotel142
ithaca3
lyrics202
lyrics142
management154
lyrics50
hunting247
harold105
creeksidepreserve.com
logic235
forum124
letter111
industrial90
lyrics31
gainesville242
hotel138
island224
heaters152
lyrics171
lyric69
marysvilleohio.org
gauge53
laboratories3
estate2
fields205
infant100
hairstyles77
indian72
james35
ireland214
maine125
houston231
malta148
jones128
fireplace241
honey36
rustyiron.com
finder236
germany90
jessica88
magnum119
fruit195
lyrics235
inurl204
guild36
lyrics37
kennel188
groups248
handbags91
freedom177
jeremy71
lyric81
furnace215
falls129
installing131
manufacturing203
lauderdale58
hotels176
major128
estate25
kenwood198
guitar47
hyderabad7
lyrics129
latex53
fabric103
lonsberry.com
lyrics147
maine123
sunyacc.edu
james27
veostingray.com
landing17
gallery12
lyrics231
madden90
furniture217
lyrics179
fountain146
little197
indian70
lounge27
lyrics121
keygen206
kevin201
import41
foster135
happy95
history199
jones124
kitten231
furniture236
manor170
language22
festival186
flash24
guitar43
lyrics44
homes8
hawaii119
hotel108
madden90
knight236
goneglobal35.com
florist65
myispfinder.org
lyric81
estate12
grand166
estate40
lyrics126
guitars67
fiber195
jumper148
limited160
hamilton85
female171
hospital67
instant132
estate6
glasses123
legal90
level116
pdc.org
estate18
india67
gallery13
kingdom217
florida59
katrina172
lyric76
linux183
football89
ingredients119
gymnastics73
houston229
humidifier241
naral.org
flying75
jewelry102
marine235
internet191
hotel133
hospital54
finder236
katrina172
listing193
lodge228
johnny110
mygibline.com
lyrics231
exhaust83
india54
little196
fuelmaker.com
lyrics163
harrison108
europe51
leather84
luggage33
gallery1
london242
lyrics67
magnum119
italy249
gallery3
lyrics9
london246
24fusion.info
hawaii118
lyric69
great186
thunderwear.com
market243
lyrics200
guide23
james27
linux179
houston222
example60
louisiana21
living211
maison127
californiaduihelp.com
fisher8
lyrics42
horses52
horse46
genesis68
indianapolis82
headphones123
lyrics201
forum123
local219
jelly60
malaysia144
fender177
lyric65
factory116
nomino.ca
greensboro206
express93
humidifier241
lights156
exercise76
girls104
jewish103
honda17
pulaskicountyassessor.net
lyric78
lyric75
harley103
group234
houses217
hockey219
lynch39
machine76
honda31
island229
gymnastics73
harvard114
katie168
infant100
lyrics207
language33
financialhack.com
login238
garcia35
manufacturer202
banana1015.com