I was quite pleased with yesterday's simple Bash script to “de-cache” Dart packages for deployment to my simple GitHub pages site. It seemed a nice, concise solution to a problem in need of a bit of automation. I was almost proud. And then Kasper Lund told me about
In my defense, I did know of
pub deploy, but after brief examination, had decided it was not likely a good candidate for my use-case. But I did not actually try it to make sure. Tonight I do so.
http://gamingjs.comGitHub pages web site, I have two sub-directories:
ice-beta. These contain different versions of the ICE Code Editor at http://gamingjs.com/ice/ and http://gamingjs.com/ice-beta/. Both of these sub-directories are nearly identical with an
main.dartscript that starts the application, and a bunch of Dart packages in the
packagessub-directory created by the Dart Pub tool:
➜ ice-beta git:(gh-pages) ✗ tree . -P 'index*|*.dart' -l -L 2 . ├── index.html ├── main.dart └── packages ├── browser -> /home/chris/.pub-cache/hosted/pub.dartlang.org/browser-0.6.5/lib ├── crypto -> /home/chris/.pub-cache/hosted/pub.dartlang.org/crypto-0.6.5/lib ├── ice_code_editor -> /home/chris/.pub-cache/hosted/pub.dartlang.org/ice_code_editor-0.0.9/lib ├── js -> /home/chris/.pub-cache/hosted/pub.dartlang.org/js-0.0.24/lib ├── meta -> /home/chris/.pub-cache/hosted/pub.dartlang.org/meta-0.6.5/lib └── unittest -> /home/chris/.pub-cache/hosted/pub.dartlang.org/unittest-0.6.5/lib 7 directories, 2 filesThere is other stuff in there as well, but that (I think) is the most important bit for tonight. The
index.htmlneeds to reside there because it enables GitHub pages to serve up a page when the directory is accessed (e.g. http://gamingjs.com/ice-beta/). The
main.dartis important because it imports the ICE package:
import 'package:ice_code_editor/ice.dart' as ICE; main()=> new ICE.Full();Last night's
decache.shconverted the symbolic links in the
packagessub-directory into local copies so that they will still work once pushed to GitHub (GitHub pages do not work with symbolic links).
pub deploywork with this?
As is, the answer would seem to be “no”:
➜ ice-beta git:(gh-pages) ✗ pub deploy There is no '/home/chris/repos/gamingjs/ice-beta/web' directory.This error would seem to refer to the pub layout convention for Dart web applications.
Perhaps if I copy the
index.htmlfile into a
➜ ice-beta git:(gh-pages) ✗ mkdir web ➜ ice-beta git:(gh-pages) ✗ cp index.html web ➜ ice-beta git:(gh-pages) ✗ pub install Resolving dependencies......... Dependencies installed! ➜ ice-beta git:(gh-pages) ✗ pub deploy Finding entrypoints... Copying web/ → deploy/ ➜ ice-beta git:(gh-pages) ✗ ls deploy index.htmlThat did not seem to do anything useful. Perhaps if I also place my
main.dartentry point in there?
deploydirectory is quite useful. But not in my particular use-case.
I need to have the main entry point for ICE directly in the
icesub-directory. I even need this locally so that I can test things out with a local Jekyll server. Placing my
index.htmlapplication page and the associated
main.dartentry point down a level are not going to serve the correct URLs. So I think I have a handle on
pub deploy, but I think my custom built
decache.shwill still be of use.