ℹ️ A portable development environment can be set up using a USB stick with various tools and applications, including programming languages, editors, source control, utilities, and more. The user shares their setup and provides instructions on how to customize the environment.
Some notes on setting a portable development environment in a USB stick.
Ah well, let me start from the end. Here’s how my setup looks like
currently :)
[![Portable Development Enviroment
Setup](http://arun.files.wordpress.com/2011/01/portableapps1.png?w=300 "Portable Development Enviroment Setup")](http://arun.files.wordpress.com/2011/01/portableapps1.png)
Directory structure in the device
---------------------------------
\\Documents -- Place for all
documents, ebooks, todo.txt etc..
\Documents\{Music, Videos,
Pictures}
\\Env -- Place for Languages, CoreOS
utils, Development enviroment
\Env\{Python26, Ruby191}
\Env\{CygWin, GnuWin32}
\Env\Bin —
Homegrown scripts and utilities go here (mostly small .ps1 and .py
files). We add this path to $env:PATH.
\Env\Path —
Interesting external tools. E.g. ProcExp, Reflector etc.. We add this
path to $env:PATH.
\Env\Env.ps1 — This
file is sourced into powershell. Sets up paths. Source below.
\Env\Profile.ps1 — Setups
some powershell customizations. See below.
\\PortableApps -- All other
utilities etc. go here. PortableApps.com suite builds up a Menu from
this folder. Cool stuff.
Softwares for the USB stick
---------------------------
Install Portable Apps Platform
([download](http://portableapps.com/download) | for the brave souls,
beta version is [here](http://portableapps.com/node/24258))
### Languages
- Python portable
([download](http://portablepython.com/wiki/Download))
### Editors/Shells
- GVim Portable
([download](http://portableapps.com/apps/development/gvim_portable)) --
doesn't have Python + Ruby. Install this and the play the [replace
magic](http://arun.wordpress.com/2010/12/29/vim-patched-builds-for-win32/)
;)
- CygWin Portable ([how
to](http://sites.google.com/site/devinsezer/Home/software/portable-cygwin))
- Console (download latest \*\_32bit.zip from
[here](http://sourceforge.net/projects/console/files/console-devel/2.00/)).
ConsolePortable from PortableApps.com includes extra stuff which I
don't use.
- Customized Powershell. See below.
### Source control
- MSysGit - Portable git installation
([download](http://code.google.com/p/msysgit/downloads/list)
PortableGit\*.7z file)
### Utilities
- 7zip portable - Archive/Extract files
([download](http://portableapps.com/apps/utilities/7-zip_portable))
- MRemoteNG - Manages your remote desktop connections
([download](http://www.mremoteng.org/download))
- Putty - Telnet, SSH client
([download](http://portableapps.com/apps/internet/putty_portable))
- WinSCP Portable
([download](http://portableapps.com/apps/internet/winscp_portable))
Customized Powershell in Stick
------------------------------
Following modification requires powershell to be installed in the host
machine. Comes by default with Windows 7. For other windows versions
download [here](http://support.microsoft.com/kb/968930). Take my word,
you will enjoy every minute w/ Powershell :)
Our goal here is:
- Hook up powershell with Console
- Setup Python and GIT paths appropriately
### Modify \\PortableApps\\Console\\Console.xml to start Powershell at start
### Contents of \\Env\\Env.ps1
## Portable start script## Created: Sat 15 Jan 2011 01:45:57 PM India Standard Time## Last Modified: Sat 15 Jan 2011 02:51:52 PM India Standard TimeWrite-Host -ForegroundColor Green "--> Setup start"Write-Host -ForegroundColor Green "--> Setting enviroment variables"## Globals# Environment variables$env:PortableRoot = $(pwd).Drive.Root$env:PortableEnv = Join-Path $(pwd).Drive.Root "Env"$env:PortableApps = Join-Path $(pwd).Drive.Root "PortableApps"$env:PortableDocs = Join-Path $(pwd).Drive.Root "Documents"$env:TERM = 'cygwin'$env:LESS = 'FRSX'Write-Host -ForegroundColor Green " > Portable Root: $env:PortableRoot"Write-Host -ForegroundColor Green " > Portable Env: $env:PortableEnv"Write-Host -ForegroundColor Green " > Portable Apps: $env:PortableApps"Write-Host -ForegroundColor Green " > Portable Docs: $env:PortableDocs"# Languages$env:PATH = "$env:PortableEnv\Python26\App;$env:PortableEnv\Python26\App\Scripts;" + $env:PATH# GIT$env:PLINK_PROTOCOL = "ssh"$env:GIT_INSTALL_ROOT = "$env:PortableApps\git"$env:PATH += ";$env:GIT_INSTALL_ROOT\cmd"# Load custom profile$customProfile = $(Join-Path $(Get-ChildItem $MyInvocation.MyCommand.Path).Directory.FullName "\Profile.ps1")if (Test-Path $customProfile){ Write-Host -ForegroundColor Green "--> Loading custom profile: "$customProfile . $customProfile}Write-Host -ForegroundColor Green "--> Setup complete`r`n"
### Contents of \\Env\\Profile.ps1
## Portable Profile## Created: Sat 15 Jan 2011 02:15:57 PM India Standard Time## Last Modified: Sat 15 Jan 2011 03:02:54 PM India Standard Time## promptfunction prompt{ $date = $(date) $dateString = $date.Hour.ToString()+":"+$date.Minute.ToString()+":"+$date.Second.ToString() Write-Host $dateString" ["$(get-location)"]" -foregroundcolor green Write-Host $((get-history -count 1).Id+1)"$" -nonewline return " "}## Aliases#set-alias la ls -recurserm -force alias:whererm -force alias:cdset-alias cal gadget-calendarset-alias cd pushd;set-locationset-alias cd- popdset-alias grep select-stringset-alias l get-childitemset-alias whereis whereset-alias wc measure-object## Globals# Environment variables$env:Path = "$env:PortableEnv\Path;$env:PortableEnv\GnuWin32\bin;" + $env:Path$env:SCRIPTDIR = Resolve-Path("$env:PortableEnv\bin").ToString()$env:EDITOR = "gvim"# Script Directory$env:PATH += ";"+$env:SCRIPTDIR+";."## User applications# ACKfunction ack{ & $env:PortableApps\git\bin\perl.exe "$env:PortableEnv\bin\standalone-ack" $args}# YaGTDfunction gtd{ & $env:PortableEnv\Python26\App\Python.exe $env:PortableEnv\Python26\App\Scripts\yagtd.py -q $args $env:PortableDocs\todo.txt}
The script \\Env\\Env.ps1 provides following environment variables for
your scripting needs.
1. \$env:PortableRoot -- Root of the USB stick
2. \$env:PortableDocs -- Path to \\Documents
3. \$env:PortableEnv -- Path to \\Env
4. \$env:PortableApps -- Path to \\PortableApps
Enjoy the portability.
*Down the memory lane, last time I used usb sticks was in 2005-8. Used
to be a life saver for the labs, the days before project/ppt deadlines
(all kinds of file sync, backup and what not. Poor man's dropbox :D. Ok,
DC++ did revolutionize things too).*
*My primary toolset then was DevC++, VNCViewer/WinSCP/Putty (escape
switch for boring labs, to connect to dorm desktop :P). I was quite a
bit into Java then, so Eclipse was there too. Good ol' times.*
*Well this time, primary reason was my GTD setup. More on that in
another post.*