Skip to content

Commit 778b8c4

Browse files
wilsonmarandrewmkrug
authored andcommitted
Add bootstrap script and gitignore (#17)
* Use gitignore from gitignore.io * Add bootstrap script and a description of it in README.md * Fix Terminal typo in README.md * Fix bootstrap URL in README.md * Fix sudo xcodebuild -license accept in bootstrap.sh
1 parent 7c70333 commit 778b8c4

File tree

3 files changed

+257
-17
lines changed

3 files changed

+257
-17
lines changed

.gitignore

Lines changed: 163 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,168 @@
1+
2+
# Mobile Tools for Java (J2ME)
3+
.mtj.tmp/
4+
5+
### Eclipse
6+
.settings/
7+
.classpath
8+
.project
9+
10+
11+
# Created by https://www.gitignore.io/api/macos,java,windows,intellij,intellij+iml,maven
12+
13+
### macOS ###
14+
*.DS_Store
15+
.AppleDouble
16+
.LSOverride
17+
18+
# Icon must end with two \r
19+
Icon
20+
# Thumbnails
21+
._*
22+
# Files that might appear in the root of a volume
23+
.DocumentRevisions-V100
24+
.fseventsd
25+
.Spotlight-V100
26+
.TemporaryItems
27+
.Trashes
28+
.VolumeIcon.icns
29+
.com.apple.timemachine.donotpresent
30+
# Directories potentially created on remote AFP share
31+
.AppleDB
32+
.AppleDesktop
33+
Network Trash Folder
34+
Temporary Items
35+
.apdisk
36+
37+
38+
### Windows ###
39+
# Windows image file caches
40+
Thumbs.db
41+
ehthumbs.db
42+
43+
# Folder config file
44+
Desktop.ini
45+
46+
# Recycle Bin used on file shares
47+
$RECYCLE.BIN/
48+
49+
# Windows Installer files
50+
*.cab
51+
*.msi
52+
*.msm
53+
*.msp
54+
55+
# Windows shortcuts
56+
*.lnk
57+
58+
59+
### Intellij ###
60+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
61+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
62+
63+
# User-specific stuff:
64+
.idea/workspace.xml
65+
.idea/tasks.xml
66+
67+
# Sensitive or high-churn files:
68+
.idea/dataSources/
69+
.idea/dataSources.ids
70+
.idea/dataSources.xml
71+
.idea/dataSources.local.xml
72+
.idea/sqlDataSources.xml
73+
.idea/dynamic.xml
74+
.idea/uiDesigner.xml
75+
76+
# Gradle:
77+
.idea/gradle.xml
78+
.idea/libraries
79+
80+
# Mongo Explorer plugin:
81+
.idea/mongoSettings.xml
82+
83+
## File-based project format:
84+
*.iws
85+
86+
## Plugin-specific files:
87+
88+
# IntelliJ
89+
/out/
90+
91+
# mpeltonen/sbt-idea plugin
92+
.idea_modules/
93+
94+
# JIRA plugin
95+
atlassian-ide-plugin.xml
96+
97+
# Crashlytics plugin (for Android Studio and IntelliJ)
98+
com_crashlytics_export_strings.xml
99+
crashlytics.properties
100+
crashlytics-build.properties
101+
fabric.properties
102+
103+
### Intellij Patch ###
104+
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
105+
106+
# *.iml
107+
# modules.xml
108+
# .idea/misc.xml
109+
# *.ipr
110+
111+
112+
### Intellij+iml ###
113+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
114+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
115+
116+
# User-specific stuff:
117+
118+
# Sensitive or high-churn files:
119+
120+
# Gradle:
121+
122+
# Mongo Explorer plugin:
123+
124+
## File-based project format:
125+
126+
## Plugin-specific files:
127+
128+
# IntelliJ
129+
130+
# mpeltonen/sbt-idea plugin
131+
132+
# JIRA plugin
133+
134+
# Crashlytics plugin (for Android Studio and IntelliJ)
135+
136+
### Intellij+iml Patch ###
137+
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
138+
139+
*.iml
140+
modules.xml
141+
.idea/misc.xml
142+
*.ipr
143+
144+
145+
### Maven ###
146+
target/
147+
pom.xml.tag
148+
pom.xml.releaseBackup
149+
pom.xml.versionsBackup
150+
pom.xml.next
151+
release.properties
152+
dependency-reduced-pom.xml
153+
buildNumber.properties
154+
.mvn/timing.properties
155+
156+
# Exclude maven wrapper
157+
!/.mvn/wrapper/maven-wrapper.jar
158+
159+
160+
### Java ###
1161
*.class
2162

163+
# BlueJ files
164+
*.ctxt
165+
3166
# Mobile Tools for Java (J2ME)
4167
.mtj.tmp/
5168

@@ -10,17 +173,3 @@
10173

11174
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
12175
hs_err_pid*
13-
14-
### IntelliJ Idea
15-
#.idea/
16-
*.iml
17-
*.ipr
18-
*.iws
19-
20-
### Eclipse
21-
.settings/
22-
.classpath
23-
.project
24-
25-
### Maven
26-
target/

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,23 @@ Run these commands depending on your base OS.
99

1010
### On Mac OS
1111

12+
Copy this bootstrap script and run it in a Terminal shell window:
13+
14+
```
15+
sh -c "$(curl -fsSL https://raw.githubusercontent.com/wilsonmar/Basic-Selenium-Java/master/mac-bootstrap.sh)"
16+
```
17+
18+
It installs the following if it is not already installed:
19+
1220
1. Install Homebrew `/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`
1321
2. Install Caskroom `brew tap caskroom/cask`
1422
3. If you dont have the Java Development Kit (JDK) run this command `brew cask install java`
1523
4. Install Maven `brew install maven`
1624
5. Run `./mac_install_browsers.sh`
1725

18-
### Windows
26+
The script also runs the test.
27+
28+
### On Windows
1929

2030
> This is currently untested
2131
@@ -38,9 +48,11 @@ The following commands are instructions on how to run the tests
3848

3949
### From CLI
4050

41-
`mvn test -Dsurefire.suiteXmlFiles=mac-only.xml ` on a mac
51+
On a Mac:
52+
53+
`mvn test -Dsurefire.suiteXmlFiles=mac-only.xml`
4254

43-
### Intellij Idea
55+
### Intellij IDEA
4456

4557
There is a shared run configuration that has the maven target setup and another with a sample built in NUnit test runner option.
4658

mac-bootstrap.sh

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/bin/sh
2+
3+
# mac-bootstrap.sh
4+
# by wilsonmar at gmail.com
5+
# This bash script bootstraps a MacOS laptop (like at https://github.com/fs/osx-bootstrap)
6+
# to run Selenium against a Java source file that
7+
# simply opens a web page in several browsers.
8+
#
9+
# This script installs:
10+
# - xcode
11+
# - homebrew
12+
#
13+
# It will ask you for your sudo password.
14+
15+
fancy_echo() { # to add blank line between echo statements:
16+
local fmt="$1"; shift
17+
# shellcheck disable=SC2059
18+
printf "\n$fmt\n" "$@"
19+
}
20+
21+
fancy_echo "Boostrapping ..."
22+
23+
trap 'ret=$?; test $ret -ne 0 && printf "failed\n\n" >&2; exit $ret' EXIT
24+
25+
set -e # to stop on error.
26+
27+
# Ask for the administrator password upfront and run a
28+
# keep-alive to update existing `sudo` time stamp until script has finished
29+
# sudo -v
30+
# while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
31+
32+
# Ensure Apple's command line tools are installed
33+
if ! command -v cc >/dev/null; then
34+
fancy_echo "Installing xcode (Agreeing to the Xcode/iOS license requires sudo admin privileges) ..."
35+
sudo xcodebuild -license accept
36+
# xcode-select --install
37+
else
38+
fancy_echo "Xcode already installed. Skipping."
39+
fi
40+
41+
42+
if ! command -v brew >/dev/null; then
43+
fancy_echo "Installing Homebrew..."
44+
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" </dev/null
45+
else
46+
fancy_echo "Homebrew already installed. Skipping."
47+
fi
48+
49+
50+
fancy_echo "Install Caskroom ..."
51+
brew tap caskroom/cask
52+
53+
54+
if ! command -v java >/dev/null; then
55+
fancy_echo "Installing Java..."
56+
brew cask install java
57+
else
58+
fancy_echo "Java already installed. Skipping."
59+
fi
60+
61+
62+
if ! command -v mvn >/dev/null; then
63+
fancy_echo "Installing Maven..."
64+
brew install maven
65+
else
66+
fancy_echo "Maven already installed. Skipping."
67+
fi
68+
69+
70+
fancy_echo "Run mac_install_browsers.sh ..."
71+
chmod +x mac_install_browsers.sh
72+
./mac_install_browsers.sh
73+
74+
75+
fancy_echo "Run test ..."
76+
mvn test -Dsurefire.suiteXmlFiles=mac-only.xml
77+
# Browser windows should open and close on their own.
78+
79+
fancy_echo "Done with status $? (0=OK)."

0 commit comments

Comments
 (0)