commit ff79a813001f4a1a869886073059d72c882a684b Author: Ryan Date: Tue Oct 4 21:30:15 2016 +0200 initial import diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..57a71df --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright © Ryan Kes + +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. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..ec17dc8 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +Fill me! \ No newline at end of file diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..82a8a51 --- /dev/null +++ b/run.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +# return true if local npm package is installed at ./node_modules, else false +# example +# echo "gulpacular : $(npm_package_is_installed gulpacular)" +function npm_package_is_installed { + # set to true initially + local return_=true + # set to false if not found + ls node_modules | grep $1 >/dev/null 2>&1 || { local return_=false; } + # return value + echo "$return_" +} + +# First make sure surge is installed +if ! type gulp &> /dev/null ; then + # Check if it is in repo + if ! $(npm_package_is_installed surge) ; then + info "surge not installed, trying to install it through npm" + + if ! type npm &> /dev/null ; then + fail "npm not found, make sure you have npm or surge installed" + else + info "npm is available" + debug "npm version: $(npm --version)" + + info "installing surge" + npm config set ca "" --silent + sudo npm install npm -g --silent + sudo npm install -g --silent gulp + gulp_command="surge" + fi + else + info "surge is available locally" + debug "surge version: $( node ./node_modules/.bin/surge --version)" + surge_command=" node ./node_modules/.bin/surge" + fi +else + info "surge is available" + debug "surge version: $(surge --version)" + surge_command="surge" +fi + +debug "$surge_command" + +set +e +$surge_command +result="$?" +set -e + +# Fail if it is not a success or warning +if [[ result -ne 0 && result -ne 6 ]] +then + warn "$result" + fail "surge command failed" +else + success "finished $surge_command" +fi \ No newline at end of file diff --git a/wercker-step.yml b/wercker-step.yml new file mode 100644 index 0000000..3b76103 --- /dev/null +++ b/wercker-step.yml @@ -0,0 +1,20 @@ +name: surge-deploy +version: 0.1.0 +description: Deploys a directory to surge.sh. +keywords: + - deploy + - surge.sh +properties: + surge_login: + type: string + required: true + directory: + type: string + default: public + required: true + token: + type: string + required: true + domain: + type: string + required: true \ No newline at end of file