diff --git a/README.md b/README.md index f11a6a4..9ad7c0e 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,13 @@ IntelliJ IDEA code style settings for Square's Java and Android projects. Installation ------------ - * Run the `install.sh` script. + * On Unix, run the `install.sh` script. Windows users should use `install.bat` instead. * Restart IntelliJ if it's running. * Open IntelliJ Project Settings -> Code Styles, change the code style for the project to the one you want. + + +License +------- + +[![Public domain](https://licensebuttons.net/p/zero/1.0/88x31.png)](https://creativecommons.org/publicdomain/zero/1.0/legalcode) diff --git a/configs/Square.xml b/configs/Square.xml deleted file mode 100644 index 12864cf..0000000 --- a/configs/Square.xml +++ /dev/null @@ -1,249 +0,0 @@ - - - - - - - diff --git a/configs/SquareAndroid.xml b/configs/codestyles/Square.xml similarity index 57% rename from configs/SquareAndroid.xml rename to configs/codestyles/Square.xml index f93f30c..d07d02a 100644 --- a/configs/SquareAndroid.xml +++ b/configs/codestyles/Square.xml @@ -1,5 +1,4 @@ - - + - - + + + \ No newline at end of file diff --git a/configs/codestyles/SquareAndroid.xml b/configs/codestyles/SquareAndroid.xml new file mode 100644 index 0000000..d4ce731 --- /dev/null +++ b/configs/codestyles/SquareAndroid.xml @@ -0,0 +1,382 @@ + + + + + \ No newline at end of file diff --git a/configs/inspection/Square.xml b/configs/inspection/Square.xml new file mode 100644 index 0000000..361afca --- /dev/null +++ b/configs/inspection/Square.xml @@ -0,0 +1,7 @@ + + + + diff --git a/configs/options/editor.codeinsight.xml b/configs/options/editor.codeinsight.xml new file mode 100644 index 0000000..8733999 --- /dev/null +++ b/configs/options/editor.codeinsight.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/install.bat b/install.bat new file mode 100644 index 0000000..e1ffa85 --- /dev/null +++ b/install.bat @@ -0,0 +1,22 @@ +REM Installs Square's IntelliJ configs into your user configs. +@echo off +echo Installing Square IntelliJ configs... + +setlocal enableDelayedExpansion + +for /D %%i in ("%userprofile%"\.AndroidStudio*) do call :copy_config "%%i" +for /D %%i in ("%userprofile%"\.IdeaIC*) do call :copy_config "%%i" +for /D %%i in ("%userprofile%"\.IntelliJIdea*) do call :copy_config "%%i" + +echo. +echo Restart IntelliJ and/or AndroidStudio, go to preferences, and apply 'Square' or 'SquareAndroid'. +exit /b + +REM sub function for copy config files +:copy_config +set config_dir=%~1\config +echo Installing to "!config_dir!" +xcopy /s configs "!config_dir!" +echo Done. +echo. +exit /b diff --git a/install.sh b/install.sh index a461c00..a03a9a1 100755 --- a/install.sh +++ b/install.sh @@ -1,16 +1,31 @@ #!/bin/bash # Installs Square's IntelliJ configs into your user configs. -echo "Installing Square code style configs..." +echo "Installing Square IntelliJ configs..." -for i in $HOME/Library/Preferences/IntelliJIdea*/codestyles \ - $HOME/Library/Preferences/IdeaIC*/codestyles \ - $HOME/Library/Preferences/AndroidStudio*/codestyles \ - $HOME/.IntelliJIdea*/config/codestyles \ - $HOME/.IdeaIC*/config/codestyles \ - $HOME/.AndroidStudio*/config/codestyles +CONFIGS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/configs" + +for i in $HOME/Library/Preferences/IntelliJIdea* \ + $HOME/Library/Preferences/IdeaIC* \ + $HOME/Library/Preferences/AndroidStudio* \ + $HOME/.IntelliJIdea*/config \ + $HOME/.IdeaIC*/config \ + $HOME/.AndroidStudio*/config do - cp -frv $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/configs/* $i 2> /dev/null + if [[ -d $i ]]; then + + # Install codestyles + mkdir -p $i/codestyles + cp -frv "$CONFIGS/codestyles"/* $i/codestyles + + # Install inspections + mkdir -p $i/inspection + cp -frv "$CONFIGS/inspection"/* $i/inspection + + # Install options ("Exclude from Import and Completion") + mkdir -p $i/options + cp -frv "$CONFIGS/options"/* $i/options + fi done echo "Done."