-
Notifications
You must be signed in to change notification settings - Fork 20
/
ddpoker.rc
91 lines (83 loc) · 3.59 KB
/
ddpoker.rc
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# DD Poker - Source Code
# Copyright (c) 2003-2024 Doug Donohoe
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# For the full License text, please see the LICENSE.txt file
# in the root directory of this project.
#
# The "DD Poker" and "Donohoe Digital" names and logos, as well as any images,
# graphics, text, and documentation found in this repository (including but not
# limited to written documentation, website content, and marketing materials)
# are licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives
# 4.0 International License (CC BY-NC-ND 4.0). You may not use these assets
# without explicit written permission for any uses not covered by this License.
# For the full License text, please see the LICENSE-CREATIVE-COMMONS.txt file
# in the root directory of this project.
#
# For inquiries regarding commercial licensing of this source code or
# the use of names, logos, images, text, or other assets, please contact
# doug [at] donohoe [dot] info.
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# DD Poker Helpful environment vars and aliases
#
DDHOME=${1-$(git rev-parse --show-toplevel)}
# Expected vars
export WORK=$(dirname "${DDHOME}") # parent dir
CODE="${DDHOME}/code"
# Tools
export PATH=${DDHOME}/tools/bin:${PATH}
export PATH=${DDHOME}/tools/db:${PATH}
# maven shortcuts
alias mvn-install-notests='(cd $CODE;mvn install -DskipTests=true)'
alias mvn-install='(cd $CODE;mvn install)'
alias mvn-clean='(cd $CODE;mvn clean)'
alias mvn-package-notests='(cd $CODE;mvn package -DskipTests=true)'
alias mvn-package='(cd $CODE;mvn package)'
alias mvn-test='(cd $CODE;mvn test -Dskip.unit.tests=false)'
alias mvn-tree='mvn dependency:tree -q -Dscope=runtime -Ddependency.classpath.outputFile=/tmp/t && cat /tmp/t && rm -f /tmp/t'
# act shortcut
alias act-ddpoker='act --platform ubuntu-latest=ddpoker-act-runner --pull=false \
--container-options "-v $HOME/.m2:/home/runner/.m2" \
--job test pull_request'
# attempt to auto-set JAVA_HOME to 17 if on mac
if [[ "${OSTYPE:0:6}" == "darwin" ]]; then
JAVA17_HOME=$(/usr/libexec/java_home -F -v 17 2>/dev/null || echo "/java17/not/found")
if [[ -d "${JAVA17_HOME}" && "${JAVA17_HOME}" != "${JAVA_HOME}" ]]; then
export JAVA_HOME="${JAVA17_HOME}"
export PATH="${JAVA17_HOME}/bin:${PATH}"
echo "JAVA_HOME changed, version now '$(java -version 2>&1 | head -1)'"
fi
fi
# See if java 17 is installed
if ! test -x "$(command -v java)"; then
if [[ "${OSTYPE:0:6}" == "darwin" ]]; then
echo "WARNING: Java 17 is not installed. Have your run 'brew install temurin@17'?"
else
echo "WARNING: Java 17 is not installed."
fi
else
# Java is installed, check version is 17
if ! java -version 2>&1 | head -1 | grep -q "\"17\."; then
echo "WARNING: Java version is not 17 (which DD Poker requires). Version is:"
java -version
fi
fi
# See if maven is installed
if ! test -x "$(command -v mvn)"; then
if [[ "${OSTYPE:0:6}" == "darwin" ]]; then
echo "WARNING: Maven is not installed. Have you run 'brew install maven'?"
else
echo "WARNING: Maven is not installed."
fi
fi