Skip to content

Instantly share code, notes, and snippets.

@fudanchii
Created April 12, 2021 02:47
Show Gist options
  • Save fudanchii/c6538273ab8c6797f73991895f6181d5 to your computer and use it in GitHub Desktop.
Save fudanchii/c6538273ab8c6797f73991895f6181d5 to your computer and use it in GitHub Desktop.
$HOME/bin/embulk
#!/usr/bin/env bash
args=$@
if [[ $1 == "bundle-spec" ]]; then
docker run -i -t --rm \
-v $PWD:/app \
-v $HOME:$HOME \
-v /etc/passwd:/etc/passwd \
-e USER=$USER \
-e HOME=$HOME \
-e BUNDLE_APP_CONFIG=$HOME/.embulk/bundle \
-e BUNDLE_PATH=$HOME/.embulk/bundle \
-u $(id -u $USER):$(id -g $USER) \
-w /app \
jruby:9.1 bundle
exit $?
fi
if [[ $1 == "spec" ]]; then
docker run -i -t --rm \
-v $PWD:/app \
-v $HOME:$HOME \
-v /etc/passwd:/etc/passwd \
-e USER=$USER \
-e HOME=$HOME \
-e BUNDLE_APP_CONFIG=$HOME/.embulk/bundle \
-e BUNDLE_PATH=$HOME/.embulk/bundle \
-u $(id -u $USER):$(id -g $USER) \
-w /app \
jruby:9.1 bundle exec rspec $@
exit $?
fi
docker run -i -t --rm \
-v $PWD:/app \
-v $HOME:$HOME \
-v /etc/passwd:/etc/passwd \
-e USER=$USER \
-e HOME=$HOME \
-e ZOHOCRM_API_TOKEN=$ZOHOCRM_API_TOKEN \
-e ZOHOCRM_REFRESH_TOKEN=$ZOHOCRM_REFRESH_TOKEN \
-e ZOHOCRM_CLIENT_ID=$ZOHOCRM_CLIENT_ID \
-e ZOHOCRM_CLIENT_SECRET=$ZOHOCRM_CLIENT_SECRET \
-e ZOHOCRM_REDIRECT_URI=$ZOHOCRM_REDIRECT_URI \
-e ZOHOCRM_GCP_JSON_KEY=$ZOHOCRM_GCP_JSON_KEY \
-e ZOHOCRM_GCP_PROJECT=$ZOHOCRM_GCP_PROJECT \
-e ZOHOCRM_BIGQUERY_DATASET=$ZOHOCRM_BIGQUERY_DATASET \
-e SCHEMA_FILE=$SCHEMA_FILE \
-u $(id -u $USER):$(id -g $USER) \
-w /app \
openjdk:8 bash -c "bash $HOME/bin/embulk-0.8.15.jar $args"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment