Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows global packages to be activated #45

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,22 @@ web: ./dart-sdk/bin/dart bin/basic_http_server.dart
### Overriding the build command

By default `pub build` is launched after `pub get`, it can be useful to use
another command: for instance `pub build --mode=debug` or
another command: for instance `pub build --mode=debug` or
`/app/dart-sdk/bin/dart build.dart`:

```bash
$> heroku config:set DART_BUILD_CMD="/app/dart-sdk/bin/dart build.dart"
```

## Example
### Activating global packages

You can activate global packages by providing the environment variable `DART_GLOBAL_PACKAGES`. Each globally activated package is space delimited and takes the form of `[email protected]`:

```bash
$> heroku config:set DART_GLOBAL_PACKAGES="[email protected]"
```

## Example

See `test-app` directory for the world simplest Dart web app running on
Heroku.
Expand Down
22 changes: 6 additions & 16 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -100,25 +100,15 @@ for filename in `find . -name pubspec.yaml | grep -v dart-sdk | grep -v pub-cach
#start pub from the /app folder to have correct symlink paths
/app/dart-sdk/bin/pub get

if [ -d "web" ]
then
message "*** Running pub build"
if [[ -z "$DART_BUILD_CMD" ]]
then
message 'Building with "pub build"'
/app/dart-sdk/bin/pub build
else
message "Building with \"$DART_BUILD_CMD\""
eval $DART_BUILD_CMD
fi
else
message '*** Skipping pub build because "web" folder not found'
fi

for package in $DART_GLOBAL_PACKAGES
do
PACKAGE_ELEMENTS=(${package//@/ })
/app/dart-sdk/bin/pub global activate "${PACKAGE_ELEMENTS[0]}" "${PACKAGE_ELEMENTS[1]}"
done
done

# I think heroku deletes all the contents of /app and replaces it with
# whatever is in $BUILD_DIR, so copy over the pub-cache. Why not put it in
# $BUILD_DIR in the first place? because we need symlinks setup correctly.
cp -R $PUB_CACHE $BUILD_DIR/pub-cache
message `ls -l $BUILD_DIR/pub-cache`
message `ls -l $BUILD_DIR/pub-cache`