Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mslinn/dottytemplate
https://github.com/mslinn/dottytemplate
Last synced: 17 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/mslinn/dottytemplate
- Owner: mslinn
- Created: 2019-11-08T21:14:11.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-10-26T04:44:47.000Z (about 3 years ago)
- Last Synced: 2024-10-30T07:06:18.245Z (2 months ago)
- Language: Scala
- Homepage:
- Size: 8.79 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Scala Project Template
[![License](https://licensebuttons.net/p/zero/1.0/88x31.png)](https://creativecommons.org/share-your-work/public-domain/cc0/)
[![GitHub version](https://badge.fury.io/gh/mslinn%2FdottyTemplate.svg)](https://badge.fury.io/gh/mslinn%2FdottyTemplate)This is a handy starting point for Scala/Java console apps built with SBT.
Projects are built with Scala 3 (dotty).This project is licensed with CC0, which puts this project into the public domain.
Please delete the `LICENSE` file for any projects you create based on this template project,
unless you want them to be in the public domain as well.For more information about this project and SBT, see the [SBT Project Setup lecture](https://scalacourses.com/student/showLecture/135) on [ScalaCourses.com](https://www.ScalaCourses.com).
## dottyTemplate Bash command
Copy this to a directory on the path (like `/usr/local/bin/`), and call it `dottyTemplate`:
```
#!/bin/bash# Clones dottyTemplate and starts a new SBT project
# Optional argument specifies name of directory to place the new project intoDIR=dottyTemplate
if [ "$1" ]; then DIR="$1"; fi
git clone https://github.com/mslinn/dottyTemplate.git "$DIR"
cd "$DIR"
rm -rf .git
git init
echo "Please edit README.md, build.sbt and publish.sbt right away"
echo "After you create the remote repository, type this:"
echo "git branch -u origin/master"
echo "git add -A"
echo "git commit -m "Initial checkin""
echo "git push"
```Make the bash script executable:
$ chmod a+x /usr/local/bin/dottyTemplate
To create a new SBT project, run the script.
$ dottyTemplate my-new-project
## Using GitHub?
### GitHub Pages
`dottyTemplate` sets up the GitHub pages branch for your new project.
Before you can use it, edit `build.sbt` and change this line so your GitHub user id and project name are substituted
for the placeholders `yourGithubId` and `my-new-project`:git.remoteRepo := "[email protected]:yourGithubId/my-new-project.git"
Now you can publish the Scaladoc for your project with this command:
sbt ";doc ;ghpagesPushSite"
The Scaladoc will be available at a URL of the form:
http://yourGithubId.github.io/my-new-project/latest/api/index.html
### Try Hub!
With `hub` and `dottyTemplate` you can create a new SBT project and a matching GitHub project with only two commands.
The setup documented below will supply your GitHub username and password,
and will only prompt your for your 2-factor-authentication (2FA) token each time
you run it if you set up your GitHub account to use 2FA.#### Install Hub
Install Hub on Mac OS:$ brew install hub
Install Hub on Linux:
$ sudo -H pip install hub
Put your GitHub login credentials in `~/.bash_profile` or `~/.profile`.
Also alias `hub` as `git` (`hub` also executes `git` commands):export GITHUB_USER=yourGithubUserName
export GITHUB_PASSWORD=yourPassword
alias git=hubReload `~/.bash_profile`
$ source `~/.bash_profile`
... or reload `~/.profile`
$ source `~/.profile`
#### Using dottyTemplate with Hub
Create a new SBT project and create a new GitHub project, which `hub` automatically adds as a `git` `remote`:$ dottyTemplate bigBadProject
$ git create -d "Project description"
two-factor authentication code: 881078
Updating origin
created repository: mslinn/bigBadProjectNow check in the new project:
$ git add -A && git commit -m "Initial checkin" && git push -u origin master
## Running the Program
The `bin/run` Bash script assembles this project into a fat jar and runs it.
Sample usage, which runs the `Hello` entry point in `src/main/scala/Hello.scala`:```
$ bin/run Hello
```The `-j` option forces a rebuild of the fat jar.
Use it after modifying the source code.```
$ bin/run -j Hello
```