Skip to content
serialseb edited this page Apr 24, 2011 · 13 revisions

#The OpenWrap shell (o.exe)

Introduction

The shell is responsible for finding a bootstrap class in a package that will handle the actual execution of commands, optionally downloading missing packages as needed.

To do this, the shell scans the current directory and it's parents for a child directory containing .wrap files. When one is found, the shell attemps to locate the openwrap package. If you re-use the bootstrapper, you can specify your own entry-point package by name.

The shell will then resolve any dependent packages, and select whatever latest version of each is specified. It's important to note that the shell ignores any dependency version identifiers and always picks the latest version.

Once all packages are loaded, assemblies in each of the scanned folders will be scanned for a type with a name ending in Runner containing one of two methods.

The first is a static method named Main and accepting an IDictionary<string,object> that describes the current environment (location of the system repository, current directory, command line and bootstrapped packages). This is what OpenWrap 1.1 uses.

The second is a static method also called Main, but accepting an array of strings and returning an int. This is what OpenWrap 1.0 used, and is no longer the recommended entrypoint to use. In this mode, the shell also tries to locate a SetSystemRepositoryPath static method taking the full path to the system repository path (as defined by the -SystemRepositoryPath input, see below).

As part of this loading process, all assemblies in the dependency chain will be pre-loaded in the LoadFrom context.

The Main method (1.1 and above)

The Main method of the bootstrapper receives an IDictionary<string,object> containing all the environment information needed for proper initializations.

Those are the values currently passed by the environment:

  • openwrap.syspath the system repository path
  • openwrap.cd the current directory
  • openwrap.shell.commandline the full command line that was passed to the openwrap shell
  • openwrap.shell.assemblies IEnumerable the full paths of all assemblies located and pre-loaded by the shell
  • openwrap.shell.version string The version of the shell used to load the
  • openwrap.shell.args IEnumerable the list of arguments the shell has already consumed

Shell inputs

The OpenWrap shell lets you specify certain command inputs.

-InstallHref http://server.com

Specifies the name of the server used for retrieving initial packages at installation time.

-SystemRepositoryPath c:\path\to\systemrepository

Specifies the system repository to use. Usually used for testing the behavior of the shell without uninstalling your system repository.

-ProxyHref http://proxy:port

The shell normally uses the system-defined proxy to install itself. If you need a custom proxy, you can use the ProxyHref input to change the proxy address.

-ProxyUsername username (or DOMAIN\username)

The username to use for the proxy. If missing, the credentials for the current user are used.

ProxyPassword password

The password to use for the proxy.

-ShellInstall (None|Install|UseCurrent)

Specifies what to do if the shell is not installed. Accepts the following value:

  • None: Does nothing and uses the current executable
  • Install: Installs the shell to the default location
  • UseCurrent: Uses the shell from the current location and registers it.

-ShellPanic

This is when your system repository has a version of OpenWrap that stopped working and you want to force a redownload and an overwrite of any package you have in your system repository. Use for when things go bad.

-UseSystemVersion

Enables the system repository version of OpenWrap to be used instead of the project repository (if present).

Clone this wiki locally