-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
79 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Asimov Change Log | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
This project adheres to [Semantic Versioning](http://semver.org/). | ||
|
||
|
||
## [0.2.0] | ||
|
||
* Bundle the script with `com.stevegrunwell.asimov.plist`, enabling Asimov to be scheduled to run daily. Users can set this up in a single step by running the new `install.sh` script. | ||
* Fixed pathing issue when resolving the script directory for `install.sh`. Props @morganestes. (#7) | ||
* Change the scope of Asimov to find matching directories within the current user's home directory, not just `~/Sites`. Props to @vitch for catching this! (#10). | ||
* Added a formal change log to the repository. (#5) | ||
|
||
|
||
## [0.1.0] | ||
|
||
Initial public release. | ||
|
||
|
||
[Unreleased]: https://github.com/stevegrunwell/asimov/compare/master...develop | ||
[0.2.0]: https://github.com/stevegrunwell/asimov/releases/tag/v0.2.0 | ||
[0.1.0]: https://github.com/stevegrunwell/asimov/releases/tag/v0.1.0 | ||
[#10]: https://github.com/stevegrunwell/asimov/issues/10 | ||
[#7]: https://github.com/stevegrunwell/asimov/issues/7 | ||
[#5]: https://github.com/stevegrunwell/asimov/issues/5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,26 +8,27 @@ For the average consumer, Time Machine is an excellent choice, especially consid | |
|
||
Asimov aims to solve that problem, scanning your filesystem for known dependency directories (e.g. `node_modules/` living adjacent to a `package.json` file) and excluding them from Time Machine backups. After all, why eat up space on your backup drive for something you could easily restore via `npm install`? | ||
|
||
## Usage | ||
## Installation | ||
|
||
After cloning the repository or downloading and extracting an archive, run the following to automatically exclude dependencies from Time Machine backups: | ||
To get started with Asimov, clone the repository or download and extract an archive anywhere you'd like on your Mac: | ||
|
||
```bash | ||
# Make the script executable (you'll only need to do this once). | ||
$ chmod +x ./asimov | ||
|
||
# Run Asimov. | ||
$ ./asimov | ||
```sh | ||
$ git clone [email protected]:stevegrunwell/asimov.git | ||
``` | ||
|
||
You may wish to schedule Asimov to run automatically, ensuring new projects are automatically excluded from backups. Don't worry about running it multiple times, Asimov is smart enough to see if a directory has already been marked for exclusion. | ||
After you've cloned the repository, run the `install.sh` script to automatically: | ||
* Symlink Asimov to `/usr/local/bin`, making it readily available from anywhere. | ||
* Schedule Asimov to run once a day, ensuring new projects' dependencies are quickly excluded from Time Machine backups. | ||
* Run Asimov for the first time, finding all current project dependencies adding them to Time Machine's exclusion list. | ||
|
||
## How it works | ||
|
||
At its essence, Asimov is a simple wrapper around Apple's `tmutil` program, which provides more granular control over Time Machine. | ||
|
||
Asimov finds recognized dependency directories, verifies that the corresponding dependency file exists and, if so, tells Time Machine not to worry about backing up the dependency directory. | ||
|
||
Don't worry about running it multiple times, either. Asimov is smart enough to see if a directory has already been marked for exclusion. | ||
|
||
### Retrieving excluded files | ||
|
||
If you'd like to see all of the directories and files that have been excluded from Time Machine, you can do so by running the following command ([props Brant Bobby on StackOverflow](https://apple.stackexchange.com/a/25833/206772)): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>Label</key> | ||
<string>com.stevegrunwell.asimov</string> | ||
<key>Program</key> | ||
<string>/usr/local/bin/asimov</string> | ||
<key>StartInterval</key> | ||
<!-- 24 hours = 60 * 60 * 24 --> | ||
<integer>86400</integer> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Install Asimov as a launchd daemon. | ||
# | ||
# @author Steve Grunwell | ||
# @license MIT | ||
|
||
DIR="$(cd "$(dirname "$0")" || return; pwd -P)" | ||
PLIST="com.stevegrunwell.asimov.plist" | ||
|
||
# Verify that Asimov is executable. | ||
chmod +x ./asimov | ||
|
||
# Symlink Asimov into /usr/local/bin. | ||
echo -e "\\033[0;36mSymlinking ${DIR} to /usr/local/bin/asimov\\033[0m" | ||
ln -si "${DIR}/asimov" /usr/local/bin/asimov | ||
|
||
# If it's already loaded, unload first. | ||
if launchctl list | grep -q com.stevegrunwell.asimov; then | ||
echo -e "\\n\\033[0;36mUnloading current instance of ${PLIST}\\033[0m"; | ||
launchctl unload "${DIR}/${PLIST}" | ||
fi | ||
|
||
# Load the .plist file. | ||
launchctl load "${DIR}/${PLIST}" && echo -e "\\n\\033[0;32mAsimov daemon has been loaded!\\033[0m"; | ||
|
||
# Run Asimov for the first time. | ||
"${DIR}/asimov" |