Repository: mkdocs/mkdocs

Issue:
`mkdocs new` broken under python2
current master, python 2.7.9 virtualenv
only top directory and mkdocs.yml created, no docs dir or index.md

```
(karasu)[lashni@orphan src]$ mkdocs new karasu
Creating project directory: karasu
Writing config file: karasu/mkdocs.yml
Traceback (most recent call last):
  File "/home/lashni/dev/karasu/bin/mkdocs", line 9, in <module>
    load_entry_point('mkdocs==0.11.1', 'console_scripts', 'mkdocs')()
  File "/home/lashni/dev/karasu/src/mkdocs/mkdocs/main.py", line 74, in run_main
    main(cmd, args=sys.argv[2:], options=dict(opts))
  File "/home/lashni/dev/karasu/src/mkdocs/mkdocs/main.py", line 58, in main
    new(args, options)
  File "/home/lashni/dev/karasu/src/mkdocs/mkdocs/new.py", line 47, in new
    open(config_path, 'w', encoding='utf-8').write(config_text)
TypeError: must be unicode, not str
```

current master, python 3.4.3 virtualenv, files/dirs created successfully

```
(test)[lashni@orphan src]$ mkdocs new karasu
Creating project directory: karasu
Writing config file: karasu/mkdocs.yml
Writing initial docs: karasu/docs/index.md
```



Discussion:
mkdocs.yml in python2 virtualenv is also blank, no "site_name: My Docs"

hmm, good catch. Thanks.


Resolving patch:
diff --git a/mkdocs/main.py b/mkdocs/main.py
--- a/mkdocs/main.py
+++ b/mkdocs/main.py
@@ -55,7 +55,7 @@ def main(cmd, args, options=None):
         build(config, clean_site_dir=clean_site_dir)
         gh_deploy(config)
     elif cmd == 'new':
-        new(args, options)
+        new(args)
     else:
         print('MkDocs (version {0})'.format(__version__))
         print('mkdocs [help|new|build|serve|gh-deploy|json] {options}')
diff --git a/mkdocs/new.py b/mkdocs/new.py
--- a/mkdocs/new.py
+++ b/mkdocs/new.py
@@ -1,10 +1,13 @@
 # coding: utf-8
 from __future__ import print_function
+
 import os
 from io import open
 
-config_text = 'site_name: My Docs\n'
-index_text = """# Welcome to MkDocs
+from mkdocs import compat
+
+config_text = compat.unicode('site_name: My Docs\n')
+index_text = compat.unicode("""# Welcome to MkDocs
 
 For full documentation visit [mkdocs.org](http://mkdocs.org).
 
@@ -21,10 +24,11 @@
     docs/
         index.md  # The documentation homepage.
         ...       # Other markdown pages, images and other files.
-"""
+""")
+
 
+def new(args):
 
-def new(args, options):
     if len(args) != 1:
         print("Usage 'mkdocs new [directory-name]'")
         return


Test patch:
diff --git a/mkdocs/tests/new_tests.py b/mkdocs/tests/new_tests.py
new file mode 100644
--- /dev/null
+++ b/mkdocs/tests/new_tests.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+# coding: utf-8
+
+import tempfile
+import unittest
+import os
+
+from mkdocs import new
+
+
+class NewTests(unittest.TestCase):
+
+    def test_new(self):
+
+        tempdir = tempfile.mkdtemp()
+        os.chdir(tempdir)
+
+        new.new(["myproject", ])
+
+        expected_paths = [
+            os.path.join(tempdir, "myproject"),
+            os.path.join(tempdir, "myproject", "mkdocs.yml"),
+            os.path.join(tempdir, "myproject", "docs"),
+            os.path.join(tempdir, "myproject", "docs", "index.md"),
+        ]
+
+        for expected_path in expected_paths:
+            self.assertTrue(os.path.exists(expected_path))