Ensure directory exists before changing in popen

If the directory does not exist, we want to ensure that it does.

Forking repos will fail in some situations because of this issue.
Whitespace fixes to patch
Add comment about tls for ldap method

`omniauth-ldap` also supports tls for ldap method
refactor omniauth configuration method

This refactoring allows a user to use omniauth providers which do not
use ```app_id``` and ```app_secret``` without needing to change the
devise configuration.
Merge branch 'master' into dont-depend-on-appid-and-appsecret

* master: (238 commits)
  Version 6.5.1
  Fix selectbox when submit MR from fork to origin
  Fix HELP layout
  No need for code tag here.
  Spelling mistake and add links.
  Warn against RVM.
  Remove GitHub mention because we also have a GitLab issue tracker now.
  Replace 6.0-to-6.4.md with 6.0-to-6.5.md
  Add public assets to gitignore
  Version 6.5.0
  Use 6-5 branch in installation docs
  Remove deprecated twitter handle.
  Further explain userPrincipalName settings
  Update from 6.4 to 6.5 guide
  Explain how to use AD userPrincipalName for logins
  More entries to CHANGELOG. Version to rc1
  Rephrase LDAP check script output
  add O'Reilly sponsorship in CHANGELOG
  Fix select2 css for drop above style
  Rename "Website url" labels to "Website"
  ...
Add a custom 502 page
An architectural overview of GitLab

This is to help new admins of GitLab understand what components
are involved in making GitLab work.
update links for gitlab.com
Clarifying web frontend direct file access

Rewrite how Apache/nginx interacts with precompiled assets.
Fix relative links in markdown. Related to #6182
updating structure doc
adding ref from structure to architecture
Merge pull request #6183 from Undev/fix_links_in_markdown

Fix relative links in markdown. Related to #6182
Improve issue box UI

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Show images as raw and update the documentation.
Merge pull request #5842 from vikraman/patch-1

Add comment about tls for ldap method
 Merge branch 'nicer_502' into 'master'

Nicer 502
Merge branch 'master' of github.com:gitlabhq/gitlabhq
Fix note form width

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Remove unnecessary text shadow

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>