-
-
Save phdoerfler/5718de7afaaef8632e5d to your computer and use it in GitHub Desktop.
Revisions
-
Philipp Dörfler revised this gist
Dec 11, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
Empty file. -
phdoerfler revised this gist
Dec 8, 2015 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -49,6 +49,8 @@ function openWithDirectory() { open -a "$IDEA" "${PROJECT_DIR}/pom.xml" elif [ -f "${PROJECT_DIR}/build.sbt" ]; then open -a "$IDEA" "${PROJECT_DIR}/build.sbt" else open -a "$IDEA" "${PROJECT_DIR}" fi -
grocky revised this gist
Jun 22, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -95,4 +95,4 @@ function getWebStormApp() { ls -1d /Applications/WebStorm* | tail -n1 } main "$@" -
grocky revised this gist
Jun 22, 2015 . 1 changed file with 89 additions and 26 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,35 +1,98 @@ #!/usr/bin/env bash IDEA='' PROJECT_DIR='' function main() { openIdea "$@" } function openIdea() { if [ -f "$1" ]; then openByFile fi openWithDirectory "$1" } function openByFile() { if [ "$1" ~= '.php' ]; then IDEA=$(getPhpStormApp) fi if [ "$1" ~= '.js' ] || [ "$1" ~= '.css' ]; then IDEA=$(getWebStormApp) fi open -a "$IDEA" "$1" } function openWithDirectory() { PROJECT_DIR=$(getProjectDirectory) detectProjectIdeaApplication if [ -d "${PROJECT_DIR}/.idea" ]; then echo "opening via the .idea dir" open -a "$IDEA" ${PROJECT_DIR} elif [ -f "${PROJECT_DIR}/*.ipr" ]; then echo "opening via the project file" open -a "$IDEA" $(ls -1d *.ipr | head -n1) elif [ -f "${PROJECT_DIR}/pom.xml" ]; then open -a "$IDEA" "${PROJECT_DIR}/pom.xml" else open -a "$IDEA" "${PROJECT_DIR}" fi } function getProjectDirectory() { if [ -d "$1" ]; then ls -1d "$1" | head -n1 fi if [ -z "$1" ]; then pwd fi } function detectProjectIdeaApplication() { if [ -f "${PROJECT_DIR}/composer.json" ]; then IDEA=$(getPhpStormApp) return 0 fi if [ -f "${PROJECT_DIR}/package.json" ]; then IDEA=$(getWebStormApp) return 0 fi IDEA=$(getIntelliJ) } function getIntelliJ() { ls -1d /Applications/IntelliJ\ * | tail -n1 } function getPhpStormApp() { ls -1d /Applications/PhpStorm* | tail -n1 } function getWebStormApp() { ls -1d /Applications/WebStorm* | tail -n1 } main "$@" -
grocky revised this gist
Jun 22, 2015 . 1 changed file with 7 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,41 +1,33 @@ #!/usr/bin/env bash IDEA=$(ls -1d /Applications/IntelliJ\ * | tail -n1) wd=$(pwd) # were we given a directory? if [ -d "$1" ]; then wd=$(ls -1d "$1" | head -n1) fi # were we given a file? if [ -f "$1" ]; then open -a "$IDEA" "$1" else pushd $wd > /dev/null if [ -d ".idea" ]; then echo "opening via the .idea dir" open -a "$IDEA" . elif [ -f *.ipr ]; then echo "opening via the project file" open -a "$IDEA" $(ls -1d *.ipr | head -n1) # Is there a pom.xml? elif [ -f pom.xml ]; then open -a "$IDEA" "pom.xml" # can't do anything smart; just open IDEA else open "$IDEA" fi -
chrisdarroch created this gist
Oct 17, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,43 @@ #!/bin/sh # check for where the latest version of IDEA is installed IDEA=`ls -1d /Applications/IntelliJ\ * | tail -n1` wd=`pwd` # were we given a directory? if [ -d "$1" ]; then # echo "checking for things in the working dir given" wd=`ls -1d "$1" | head -n1` fi # were we given a file? if [ -f "$1" ]; then # echo "opening '$1'" open -a "$IDEA" "$1" else # let's check for stuff in our working directory. pushd $wd > /dev/null # does our working dir have an .idea directory? if [ -d ".idea" ]; then # echo "opening via the .idea dir" open -a "$IDEA" . # is there an IDEA project file? elif [ -f *.ipr ]; then # echo "opening via the project file" open -a "$IDEA" `ls -1d *.ipr | head -n1` # Is there a pom.xml? elif [ -f pom.xml ]; then # echo "importing from pom" open -a "$IDEA" "pom.xml" # can't do anything smart; just open IDEA else # echo 'cbf' open "$IDEA" fi popd > /dev/null fi