-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdartdoc
executable file
·55 lines (45 loc) · 1.39 KB
/
dartdoc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
# To generate docs for a library, run this script with the path to an entrypoint
# .dart file, like:
#
# $ dartdoc foo.dart
#
# You can also pass in a couple of "special" entrypoints for generating
# docs for dart's built in libraries. The special entrypoints are:
#
# - "corelib": dart:core, dart:coreimpl
# - "dom": dart:core, dart:coreimpl, dart:dom
# - "html": dart:core, dart:coreimpl, dart:dom, dart:html
# Get the .dart lib file the user wants to generate docs for.
# Add the path to it so that we can find it, but only if it's a .dart file and
# not one of the special fake entrypoints like "corelib".
entrypoint=$1
if [[ $1 == *.dart ]]
then
entrypoint=$PWD/$1
fi
# Run from dartdoc directory to get correct relative paths.
pushd `dirname "$0"` >>/dev/null
compileToJs() {
# if [ "$1.dart" -nt "static/$1.js" ]
# then
../../frog/minfrog --libdir=../../frog/lib \
--out=static/$1.js --compile-only $1.dart
echo "Compiled $1.dart."
# fi
}
# Clean the output directory.
if [ -d "docs" ]; then
rm -r docs
fi
mkdir docs
# Ditch the first arg so we can pass any extra arguments to dartdoc.
shift
# Generate the user's docs.
../../frog/minfrog --libdir=../../frog/lib dartdoc.dart "$entrypoint" $@
# Generate the client-side .js files if needed.
compileToJs "client-static"
compileToJs "client-live-nav"
# Copy the static files over.
cp -R static/* docs
popd >>/dev/null