├── README.md └── SublimeDrupal.sh /README.md: -------------------------------------------------------------------------------- 1 | sublime-drupal 2 | ============== 3 | 4 | Script to setup a Sublime Text 2 editor for Drupal development (Mac & Linux) 5 | 6 |
The installer include plugins and settings to configure the environment in order to speed up the Drupal Development process.
7 | 8 |* = Only available for MacOSX
36 | 37 |After save a JS file a validation is executed using JSLint, JSLint needs Node.JS/ installed on your system.
39 | 40 |If you already have this script installed you just need run the following command to get the latest version. 53 | 54 |
The command above will include new plugins and update your current plugins, if you have custom settings the script always create backups and you can use to restore your custom settings.
65 | 66 |To use the Drupal Coding Standard plugin you have to install before PHP Code Sniffer , you check the installation process at http://drupal.org/node/1419988
70 | 71 |To use the Drupal Auto Complete, you need to create a SublimeProject and save the project definition at the drupal document root where index.php is located
73 | 74 |Automatic highlight of any "non-ASCII (code point > 128) characters"
76 | 77 |* = Only available for MacOSX
93 | 94 |Super Key stands for Command in Mac, Windows Key in Windows and CTRL in Linux
95 | 96 |Orginally forked from https://github.com/phase2/sublime-drupal/
97 | -------------------------------------------------------------------------------- /SublimeDrupal.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Attempt OS detection to set path 4 | os=`uname`; 5 | phpcs=`which phpcs`; 6 | 7 | # ST2 Packages directory 8 | if [ $os = 'Linux' ] 9 | then 10 | st2Dir=~/".config/sublime-text-2/Packages/" 11 | else 12 | # Assume OSX 13 | st2Dir=~/"Library/Application Support/Sublime Text 2/Packages/" 14 | fi 15 | 16 | # Navigate to Packages DirectoryCKAGE 17 | cd "$st2Dir"; 18 | 19 | # User Packages Directory 20 | st2UserDir="$st2Dir"User/; 21 | 22 | # Default Settings File 23 | st2Settings="$st2UserDir"Preferences.sublime-settings; 24 | 25 | 26 | # Default Preferences fork for enzo 27 | if [ ! -d "DrupalSublimeConfig" ]; then 28 | git clone https://github.com/enzolutions/drupal-sublime-config.git DrupalSublimeConfig; 29 | else 30 | echo "Updating plugin DrupalSublimeConfig"; 31 | cd "DrupalSublimeConfig" 32 | git pull origin master 33 | cd .. 34 | fi 35 | 36 | # Back up old PHP settings file 37 | if [ -f "$st2UserDir"PHP.sublime-settings ]; then 38 | echo "Backing up previous version of PHP.sublime-settings..."; 39 | sudo cp -Lf "$st2UserDir"PHP.sublime-settings "$st2UserDir"PHP.sublime-settings.bak; 40 | fi 41 | 42 | # Link up new PHP settings file 43 | echo "Linking up settings PHP.sublime-settings..." 44 | ln -fs "$st2Dir"DrupalSublimeConfig/PHP.sublime-settings "$st2UserDir"PHP.sublime-settings; 45 | 46 | # Back up old Preferences settings file 47 | if [ -f "$st2UserDir"Preferences.sublime-settings ]; then 48 | echo "Backing up previous version of Preferences.sublime-settings..."; 49 | sudo cp -Lf "$st2UserDir"Preferences.sublime-settings "$st2UserDir"Preferences.sublime-settings.bak; 50 | fi 51 | 52 | # Link up new settings file 53 | echo "Linking up settings Preferences.sublime-settings..." 54 | ln -fs "$st2Dir"DrupalSublimeConfig/Preferences.sublime-settings "$st2Settings"; 55 | 56 | # Back up old SublimeLinter settings file 57 | if [ -f "$st2UserDir"SublimeLinter.sublime-settings ]; then 58 | echo "Backing up previous version of SublimeLinter.sublime-settings..."; 59 | sudo cp -Lf "$st2UserDir"SublimeLinter.sublime-settings "$st2UserDir"SublimeLinter.sublime-settings.bak; 60 | fi 61 | 62 | # Link up new settings file 63 | echo "Linking up settings SublimeLinter.sublime-settings..." 64 | ln -fs "$st2Dir"DrupalSublimeConfig/SublimeLinter.sublime-settings "$st2UserDir"SublimeLinter.sublime-settings; 65 | 66 | # Back up old GitGutter settings file 67 | if [ -f "$st2UserDir"GitGutter.sublime-settings ]; then 68 | echo "Backing up previous version of GitGutter.sublime-settings..."; 69 | sudo cp -Lf "$st2UserDir"GitGutter.sublime-settings "$st2UserDir"GitGutter.sublime-settings.bak; 70 | fi 71 | 72 | # Link up new settings file 73 | echo "Linking up settings GitGutter.sublime-settings..." 74 | ln -fs "$st2Dir"DrupalSublimeConfig/GitGutter.sublime-settings "$st2UserDir"GitGutter.sublime-settings; 75 | 76 | # Back up old Highlighter settings file 77 | if [ -f "$st2UserDir"Highlighter.sublime-settings ]; then 78 | echo "Backing up previous version of Highlighter.sublime-settings..."; 79 | sudo cp -Lf "$st2UserDir"Highlighter.sublime-settings "$st2UserDir"Highlighter.sublime-settings.bak; 80 | fi 81 | 82 | # Link up new settings file 83 | echo "Linking up settings Highlighter.sublime-settings..." 84 | ln -fs "$st2Dir"DrupalSublimeConfig/Highlighter.sublime-settings "$st2UserDir"Highlighter.sublime-settings; 85 | 86 | 87 | # Clone all the plugins! 88 | if [ ! -d "PACKAGE CONTROL" ]; then 89 | git clone https://github.com/wbond/sublime_package_control.git "Package Control"; 90 | else 91 | echo "Updating plugin Package Control"; 92 | cd "Package Control" 93 | git pull origin master 94 | cd .. 95 | fi 96 | 97 | # BracketHighlighter 98 | if [ ! -d "BracketHighlighter" ]; then 99 | git clone https://github.com/facelessuser/BracketHighlighter.git BracketHighlighter; 100 | else 101 | echo "Updating plugin BracketHighlighter"; 102 | cd "BracketHighlighter" 103 | git pull origin master 104 | cd .. 105 | fi 106 | 107 | # Highlighter 108 | if [ ! -d "Highlighter" ]; then 109 | git clone https://github.com/bluegray/Highlighter.git Highlighter; 110 | else 111 | echo "Updating plugin Highlighter"; 112 | cd "Highlighter" 113 | git pull origin master 114 | cd .. 115 | fi 116 | 117 | # ApplySyntax 118 | if [ ! -d "ApplySyntax" ]; then 119 | git clone https://github.com/facelessuser/ApplySyntax.git ApplySyntax; 120 | else 121 | echo "Updating plugin Apply Syntax"; 122 | cd "ApplySyntax" 123 | git pull origin master 124 | cd .. 125 | fi 126 | 127 | # Pretty YAML 128 | if [ ! -d "PrettyYAML" ]; then 129 | git clone https://github.com/aukaost/SublimePrettyYAML.git PrettyYAML; 130 | else 131 | echo "Updating plugin PrettyYAML"; 132 | cd "PrettyYAML" 133 | git pull origin master 134 | cd .. 135 | fi 136 | 137 | # DocBlockr 138 | if [ ! -d "DocBlockr" ]; then 139 | git clone https://github.com/spadgos/sublime-jsdocs.git DocBlockr; 140 | else 141 | echo "Updating plugin DocBlockr"; 142 | cd "DocBlockr" 143 | git pull origin master 144 | cd .. 145 | fi 146 | 147 | # GotoDrupalAPI 148 | if [ ! -d "Sublime-Text-2-Goto-Drupal-API" ]; then 149 | git clone https://github.com/BrianGilbert/Sublime-Text-2-Goto-Drupal-API.git; 150 | else 151 | echo "Updating plugin Sublime-Text-2-Goto-Drupal-API"; 152 | cd "Sublime-Text-2-Goto-Drupal-API" 153 | git pull origin master 154 | cd .. 155 | fi 156 | 157 | # Drupal Sublime Snippets 158 | if [ ! -d "DrupalSublimeSnippets" ]; then 159 | git clone https://github.com/juhasz/drupal_sublime-snippets.git DrupalSublimeSnippets; 160 | else 161 | echo "Updating plugin DrupalSublimeSnippets"; 162 | cd "DrupalSublimeSnippets" 163 | git pull origin master 164 | cd .. 165 | fi 166 | 167 | # DrupalCodingStandard Fork 168 | if [ ! -d "DrupalCodingStandard" ]; then 169 | git clone https://github.com/rypit/DrupalCodingStandard.git DrupalCodingStandard; 170 | else 171 | echo "Updating plugin DrupalCodingStandard"; 172 | cd "DrupalCodingStandard" 173 | git pull origin master 174 | cd .. 175 | fi 176 | 177 | #PHP Syntax Checker 178 | #git clone git://github.com/naomichi-y/php_syntax_checker.git 179 | 180 | # Address pathing issues with DrupalCodingStandard's phpcs path 181 | if [ -d /usr/bin/phpcs ]; then 182 | # Control will enter here if $DIRECTORY exists. 183 | echo "Setting a symlink to phpcs for DrupalCodingStandard..." 184 | sudo ln -s "$phpcs" /usr/bin/phpcs 185 | fi 186 | 187 | # Goto Documentation 188 | if [ ! -d "sublime-text-2-goto-documentation" ]; then 189 | git clone https://github.com/kemayo/sublime-text-2-goto-documentation; 190 | else 191 | echo "Updating plugin sublime-text-2-goto-documentation"; 192 | cd "sublime-text-2-goto-documentation" 193 | git pull origin master 194 | cd .. 195 | fi 196 | 197 | # Synced SideBar 198 | if [ ! -d "SyncedSideBar" ]; then 199 | git clone git://github.com/sobstel/SyncedSideBar; 200 | else 201 | echo "Updating plugin SyncedSideBar"; 202 | cd "SyncedSideBar" 203 | git pull origin master 204 | cd .. 205 | fi 206 | 207 | # Traling Spaces 208 | if [ ! -d "TrailingSpaces" ]; then 209 | git clone https://github.com/SublimeText/TrailingSpaces.git; 210 | else 211 | echo "Updating plugin TrailingSpaces"; 212 | cd "TrailingSpaces" 213 | git pull origin master 214 | cd .. 215 | fi 216 | 217 | # Drupal AutoComplete 218 | if [ ! -d "st2-drupal-autocomplete" ]; then 219 | git clone https://github.com/tanc/st2-drupal-autocomplete.git; 220 | else 221 | echo "Updating plugin st2-drupal-autocomplete"; 222 | cd "st2-drupal-autocomplete" 223 | git pull origin master 224 | cd .. 225 | fi 226 | 227 | # To-Do: Test other version right now takes to much time 228 | # Find Function Definition 229 | #if [ ! -d "sublime-find-function-definition" ]; then 230 | # git clone git://github.com/timdouglas/sublime-find-function-definition.git; 231 | #else 232 | # echo "Updating Find Function Definition"; 233 | # cd "sublime-find-function-definition" 234 | # git pull origin master 235 | # cd .. 236 | #fi 237 | 238 | # Git 239 | if [ ! -d "sublime-text-2-git" ]; then 240 | git clone https://github.com/kemayo/sublime-text-2-git.git; 241 | else 242 | echo "Updating plugin Git"; 243 | cd "sublime-text-2-git" 244 | git pull origin master 245 | cd .. 246 | fi 247 | 248 | # GitGutter 249 | if [ ! -d "GitGutter" ]; then 250 | git clone https://github.com/jisaacks/GitGutter.git; 251 | else 252 | echo "Updating plugin GitGutter"; 253 | cd "GitGutter" 254 | git pull origin master 255 | cd .. 256 | fi 257 | 258 | # SideBarGit 259 | if [ ! -d "SideBarGit" ]; then 260 | git clone https://github.com/SublimeText/SideBarGit.git; 261 | else 262 | echo "Updating plugin SideBarGit"; 263 | cd "SideBarGit" 264 | git pull origin master 265 | cd .. 266 | fi 267 | 268 | # SublimeLinter 269 | if [ ! -d "SublimeLinter" ]; then 270 | git clone https://github.com/SublimeLinter/SublimeLinter.git 271 | else 272 | echo "Updating plugin SublimeLinter"; 273 | cd "SublimeLinter" 274 | git pull origin master 275 | cd .. 276 | fi 277 | 278 | # SASS 279 | if [ ! -d "SASS" ]; then 280 | git clone ghttps://github.com/nathos/sass-textmate-bundle.git SASS; 281 | else 282 | echo "Updating plugin SASS"; 283 | cd "SASS" 284 | git pull origin master 285 | cd .. 286 | fi 287 | 288 | # CssSnippets 289 | if [ ! -d "CssSnippets" ]; then 290 | git clone https://github.com/P233/Emmet-Css-Snippets-for-Sublime-Text-2.git CssSnippets; 291 | else 292 | echo "Updating plugin CssSnippets"; 293 | cd "CssSnippets" 294 | git pull origin master 295 | cd .. 296 | fi 297 | 298 | # JSLint 299 | if [ ! -d "JSLint" ]; then 300 | git clone https://github.com/darrenderidder/Sublime-JSLint.git JSLint; 301 | else 302 | echo "Updating plugin JSLint"; 303 | cd "JSLint" 304 | git pull origin master 305 | cd .. 306 | fi 307 | 308 | #Specific plugings for MAC 309 | if [ $os != 'Linux' ]; then 310 | # MacTerminal 311 | if [ ! -d "MacTerminal" ]; then 312 | git clone https://github.com/afterdesign/MacTerminal.git 313 | else 314 | echo "Updating plugin MacTerminal"; 315 | cd "MacTerminal" 316 | git pull origin master 317 | cd .. 318 | fi 319 | 320 | if [ -d "/Applications/iTerm.app" ]; then 321 | # Back up old MacTerminal settings file 322 | if [ -f "$st2UserDir"MacTerminal.sublime-settings ]; then 323 | echo "Backing up previous version of MacTerminal.sublime-settings..."; 324 | sudo cp -Lf "$st2UserDir"MacTerminal.sublime-settings "$st2UserDir"MacTerminal.sublime-settings.bak; 325 | fi 326 | 327 | # Link up new PHP settings file 328 | echo "Linking up settings MacTerminal.sublime-settings..." 329 | ln -fs "$st2Dir"DrupalSublimeConfig/MacTerminal.sublime-settings "$st2UserDir"MacTerminal.sublime-settings; 330 | fi 331 | fi 332 | 333 | # Soda Theme 334 | if [ ! -d "Theme - Soda" ]; then 335 | git clone https://github.com/buymeasoda/soda-theme/ "Theme - Soda" 336 | else 337 | echo "Updating plugin Theme - Soda"; 338 | cd "Theme - Soda" 339 | git pull origin master 340 | cd .. 341 | fi 342 | 343 | # fetch specific color schemas for soda theme 344 | 345 | cd "Theme - Soda" 346 | if [ ! -f "colour-schemes.zip" ]; then 347 | curl -OLk https://buymeasoda.github.com/soda-theme/extras/colour-schemes.zip; 348 | else 349 | rm colour-schemes.zip 350 | curl -OLk https://buymeasoda.github.com/soda-theme/extras/colour-schemes.zip 351 | fi 352 | yes | unzip colour-schemes.zip 353 | 354 | echo "Done"; 355 | --------------------------------------------------------------------------------