上QQ阅读APP看书,第一时间看更新
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:
- 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:
- Install the App Engine SDK for Python.
- Verify that its path is in
$PATH
. - Install the pip installation file, beautifulsoup4, and pycrypto webtest packages.
- From the top-level directory, run this command to start the pub server
dev_appserver.py app
. - Verify that it works in your browser with
http://localhost:8080/
.
- 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:mypassword@127.0.0.1:8042
. - 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 can be run from an Intranet as well.