Book Image

DART Cookbook

By : Ivo Balbaert
Book Image

DART Cookbook

By: Ivo Balbaert

Overview of this book

Table of Contents (18 chapters)
Dart Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Hosting your own private pub mirror


Another possibility for when the pub repository is not reachable (because you have no Internet access or work behind a very strict firewall) is to host your own private pub mirror.

How to do it...

Follow these steps to host your own private pub mirror:

  1. You need a server that speaks to the pub's HTTP API. Documentation on that standalone API does not yet exist, but the main pub server running at pub.dartlang.org is open source with its code living at https://github.com/dart-lang/pub-dartlang. To run the server locally, go through these steps:

    1. Install the App Engine SDK for Python.

    2. Verify that its path is in $PATH.

    3. Install the pip installation file, beautifulsoup4, and pycrypto webtest packages.

    4. From the top-level directory, run this command to start the pub server dev_appserver.py app.

    5. Verify that it works in your browser with http://localhost:8080/.

  2. You need to set a PUB_HOSTED_URL environment variable to point to the URL of your mirror server, so that the pub will look there to download the hosted dependencies, for example, PUB_HOSTED_URL = http://me:[email protected]:8042.

  3. Manually upload the packages you need to your server, visit http://localhost:8080/admin (sign in as an administrator), go to the Private Key tab, and enter any string into the private key field.

How it works...

The server from https://pub.dartlang.org/ is written in Python and is made to run on Google App Engine, but it can be run from an Intranet as well.