From 409829b2aca94790976641b28cc81b9d1fc4f4b9 Mon Sep 17 00:00:00 2001 From: Wess Cope Date: Thu, 17 Nov 2016 16:01:09 -0500 Subject: [PATCH] Creates check and install scripts Updates the readme file with some docs Adds a proper license --- LICENSE | 23 ++++++++- Makefile | 2 +- README.md | 128 +++++++++++++++++++++++++++++++++++++++++++++++- docs/check.sh | 50 +++++++++++++++++++ docs/install.sh | 29 +++++++++++ 5 files changed, 229 insertions(+), 3 deletions(-) create mode 100644 docs/check.sh create mode 100644 docs/install.sh diff --git a/LICENSE b/LICENSE index 4b727a2..88457f7 100644 --- a/LICENSE +++ b/LICENSE @@ -1 +1,22 @@ -# LICENSE + +The MIT License + +Copyright (c) 2016 Wesley Cope http://wess.io + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/Makefile b/Makefile index 04c5265..6845236 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ all: build build: @swift build -install: release +install: @mv .build/release/overlook /usr/local/bin/ diff --git a/README.md b/README.md index 58a7003..d34d161 100644 --- a/README.md +++ b/README.md @@ -1 +1,127 @@ -# Overlook +# Overlook ![Swift](http://img.shields.io/badge/swift-3.0-brightgreen.svg) + +A commandline app that will watch your folder and monitor any changes. When a change occurs, *Overlook* will execute (or restart) the process. *Overlook* is platform +independent and will work with anything from writing a README file, to developing a service. + +--- + +### Table of Contents + + * [Requirements](#requirements) + * [Installation](#installation) + * [Homebrew](#homebrew) + * [Via Script](#via-script) + * [Manual](#manual) + * [Usage](#usage) + * [.overlook](#.overlook) + * [Commandline](#commandline) + * [To Do](#to-do) + * [Contributing](#contributing) + * [License](#license) + + +--- +# Requirements +- Swift 3.0 or up. + +# Installation +## Homebrew +```bash +brew install wess/repo/overlook --HEAD +``` + +## Via Script +```bash +curl -sL wess.io/overlook/install.sh +``` + +## Build It Yourself +```bash +git clone https://github.com/wess/overlook.git +cd overlook +make release +ln -s .build/release/overlook /usr/local/bin/overlook +``` + +# Usage +There are 2 ways to use *Overlook*. You can either use it completely on the command line, or setup a _.overlook_ config file. + +## .overlook +The _.overlook_ file is a configuration file that defines environment variables, what to ignore, what to watch and what to excute on change. To create a _.overlook_ file in your current directory, simply run: + +```bash +$ overlook init +``` + +This will generate the following file: + +```json +{ + "ignore" : [ + ".git", + ".gitignore", + ".overlook" + ], + "env" : { + "example" : "variable" + }, + "execute" : [ + "ls -la" + ], + "directories" : [ + "build", + "tests" + ] +} +``` + +*Available* +- _*ignore*_ : A list of files or folders that Overlook should ignore changes on. + +- _*env*_ : Environment variables _overlook_ can set for you when running/restarting. + +- _*execute*_ : A list of commands for _overlook_ to run when a change has been observed. + +- _*directories*_ : Directories that should be watched for changes. + +--- + +## Commandline +Overlook can run without a _.overlook_ file. You can run ```overlook help``` for a list of available commands + +The main command you will use with _overlook_ will be _watch_. This command is what tells _overlook_ what to watch for changes and what to execute. + +The required flags for _overlook watch_ are: +- *e, execute* What is executed when targets are changed. + +- *h, help* Show help information for this command. + + + + +- *i, ignore* Comma separated list of files or directories to ignore. + +- *t, target* Comma separated list of directory or files to monitor. + + +Example: + +```bash +$ overlook watch -t /folder/to/watch -e /script/to/execute +``` + +# To Do +- Parallel observations/executions +- Task running + +# Contributing +Contributions are welcome, just make a pull request. If you are including new functionality, please write a usage example, and include any information that will impact installation and/or setup. + +# License +*Overlook* is released under the MIT license. See LICENSE for details. + +# Get in touch +- Any questions, comments, concerns? Hit me up on twitter: [@wesscope](https://twitter.com/wesscope) + + + diff --git a/docs/check.sh b/docs/check.sh new file mode 100644 index 0000000..1b20d96 --- /dev/null +++ b/docs/check.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +SWIFTC=`which swift` +SWIFTV=`swift --version` +OS=`uname` + +if [[ $SWIFTC == "" ]]; + then + echo "❌ Unable to locate a swift installation." + echo "" + echo "Swift 3 is required to install Overlook." + echo "For more information on Swift, visit Swift.org" + echo "" + exit 1; +fi + +if [[ $OS == "Darwin" ]]; # macOS +then + XCBVERSION=`xcodebuild -version` + if [[ $XCBVERSION != *"Xcode 8"* ]]; + then + echo "⚠️ It looks like your Command Line Tools version is incorrect." + echo "" + echo "Open Xcode and make sure the correct SDK is selected:" + echo "👀 Xcode > Preferences > Locations > Command Line Tools" + echo "" + echo "Correct: Xcode 8.x (Any Build Number)" + echo "Current: $XCBVERSION" + echo "" + help + exit 1; + fi +fi + +if [[ $SWIFTV == *"3.0"* ]]; +then + echo "✅ Compatible" + exit 0; +else + echo "❌ Incompatible" + echo "Reason: Swift 3.0 is required." + echo "" + echo "'swift --version' output:" + echo $SWIFTV + echo "" + echo "Output does not contain '3.0'." + echo "" + help + exit 1; +fi diff --git a/docs/install.sh b/docs/install.sh new file mode 100644 index 0000000..6dffb34 --- /dev/null +++ b/docs/install.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +curl -sL "wess.io/overlook/check.sh" | bash || exit 1; + +DIR=".overlook-tmp"; +BOLD=$(tput bold) +NORMAL=$(tput sgr0) + +rm -rf $DIR; +mkdir -p $DIR +cd $DIR; + +echo "Downloading..."; +git clone https://github.com/wess/overlook.git overlook > /dev/null 2>&1; +cd overlook + +echo "Compiling..."; +make clean; +make release; + +echo "Installing..."; +make install; + +cd ../../; +rm -rf $DIR; + +echo "Complete. Use: ${BOLD}overlook help${NORMAL} and ${BOLD}overlook help{$NORMAL} for more info."; + +