HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

1-step Vanilla dev sites

LincLinc Admin
edited May 2013 in Releases

Cross-posting this in case anyone here is interested: http://icrontic.com/discussion/97541/instant-localhost-sites-for-php-developers

To expand on the Vanilla symlinks part, for anyone who finds themselves doing lots of dev on many different sites:

I have a folder /www/_master that has 4 subfolders: applications, locales, plugins, themes. Each of those subfolders is full of symlinks to those bits and bobs from my various Vanilla-related repos. This is the "master" collection of symlinks.

Example:

[lincoln@yoshi /www/_master/locales:]# ls -la
total 24
drwxr-xr-x  5 lincoln  wheel  170 May 28 09:19 .
drwxr-xr-x  6 lincoln  wheel  204 May 27 21:55 ..
lrwxr-xr-x  1 lincoln  wheel   29 May 28 09:19 vf_de_DE -> /git/addons/locales/vf_de_DE/
lrwxr-xr-x  1 lincoln  wheel   29 May 28 09:19 vf_es_ES -> /git/addons/locales/vf_es_ES/
lrwxr-xr-x  1 lincoln  wheel   29 May 28 09:19 vf_fr_FR -> /git/addons/locales/vf_fr_FR/

I have a folder /www/_copy that contains symlinks to the 4 subfolders above, Vanilla's .htaccess, bootstrap.php, index.php, library folder, and js folder. It has normal folders named cache, config, and uploads (in fact, make this whole path of folders: cache/Smarty/compile). It has symlinks in the config folder for config-defaults.php and constants.php.

[lincoln@yoshi /www/_copy:]# ls -la
total 72
drwxr-xr-x  14 lincoln  wheel  476 May 27 22:14 .
drwxr-xr-x  14 lincoln  wheel  476 May 29 11:34 ..
lrwxr-xr-x   1 lincoln  wheel   22 May 27 22:14 .htaccess -> /git/vanilla/.htaccess
lrwxr-xr-x   1 lincoln  wheel   26 May 27 21:56 applications -> /www/_master/applications/
lrwxr-xr-x   1 lincoln  wheel   26 May 25 23:35 bootstrap.php -> /git/vanilla/bootstrap.php
drwxr-xr-x   3 lincoln  wheel  102 May 25 23:37 cache
drwxr-xr-x   5 lincoln  wheel  170 May 27 21:40 conf
lrwxr-xr-x   1 lincoln  wheel   22 May 25 23:36 index.php -> /git/vanilla/index.php
lrwxr-xr-x   1 lincoln  wheel   15 May 25 23:36 js -> /git/vanilla/js
lrwxr-xr-x   1 lincoln  wheel   21 May 25 23:36 library -> /git/vanilla/library/
lrwxr-xr-x   1 lincoln  wheel   21 May 27 22:02 locales -> /www/_master/locales/
lrwxr-xr-x   1 lincoln  wheel   20 May 27 21:56 plugins -> /www/_master/plugins
lrwxr-xr-x   1 lincoln  wheel   19 May 27 21:56 themes -> /www/_master/themes
drwxr-xr-x   2 lincoln  wheel   68 May 25 23:36 uploads

NOTE: Symlinking index.php can cause path problems. So far, I haven't had any on nginx. That said... I haven't gotten very far using this yet so maybe I just haven't found it yet. If stuff is weird, manually copy index.php.

Now, anytime you copy /www/_copy to a new web root (like in the article I linked above) you'll have an always-updated copy of Vanilla in it forever.

Comments

  • LincLinc Admin

    This discussion brought to you by Lincoln reformatting his laptop and finally getting his shit together on his localhost :D

  • LincLinc Admin
    edited July 2013

    I've added 2 lines that will auto-setup a forum (if you supply the correct username & password etc in the last line):

     read -p "Name: " SITE
    
     #/etc/hosts
     sudo cp /etc/hosts /etc/hosts.original
     echo -e "127.0.0.1\t${SITE}.dev" | sudo tee -a  /etc/hosts
    
     # copy files
     sudo cp -R /www/_copy /www/${SITE}
     sudo chown -R lincoln /www/${SITE}
    
     # database
     sudo echo "create database ${SITE}" | mysql -u root
    
     # forum setup
     curl http://${SITE}.dev/index.php?p=/dashboard/setup > /dev/null
     curl -d "Database-dot-Host=localhost" -d "Database-dot-Name=${SITE}" -d "Database-dot-User=root" -d "Database-dot-Password=" -d "Garden-dot-Title=${SITE}" -d "Email=lincoln%40vanillaforums.com" -d "Name=admin" -d "Password=admin" -d "PasswordMatch=admin" http://${SITE}.dev/index.php?p=/dashboard/setup
    
  • Just a serious question and a bump also, of course : I see lots of symlinking, but I'm on Windows. Will these steps also work on Windows?

    There was an error rendering this rich post.

  • @UnderDog I use a program called Link Shell Extension. You can find out all about it here: http://www.howtogeek.com/howto/16226/complete-guide-to-symbolic-links-symlinks-on-windows-or-linux/

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • @Underdog You could try cygwin. Trying to port this script directly to Windows would be a bit of a challenge. Honestly, I can't imagine doing web dev on Windows now that I've seen the other side.

  • LincLinc Admin
    edited August 2013

    Gravy for the end:

     # go to your new site
     open -a Firefox.app ${SITE}.dev/entry
    
  • @Lincoln said:
    I can't imagine doing web dev on Windows now that I've seen the other side.

    I can't imagine doing anything creative or productive on Windows... once you go iOS.... well you know what ... I have come to a realization that people who like Windows are just masochists ;)

Sign In or Register to comment.