Repository: audreyr/cookiecutter
Pull request #963 (2017-06-24 13:58:44)

Add gitlab shorthand
Nothing much to add here 😁 

I think we should support a GitLab abbreviation.

Please let me know your thoughts! Ty 🍪 


Patch:
diff --git a/cookiecutter/config.py b/cookiecutter/config.py
index 35bfc49..f2e7d24 100644
--- a/cookiecutter/config.py
+++ b/cookiecutter/config.py
@@ -20,6 +20,7 @@ USER_CONFIG_PATH = os.path.expanduser('~/.cookiecutterrc')
 
 BUILTIN_ABBREVIATIONS = {
     'gh': 'https://github.com/{0}.git',
+    'gl': 'https://gitlab.com/{0}.git',
     'bb': 'https://bitbucket.org/{0}',
 }
 
diff --git a/docs/advanced/user_config.rst b/docs/advanced/user_config.rst
index f6fae93..96f5008 100644
--- a/docs/advanced/user_config.rst
+++ b/docs/advanced/user_config.rst
@@ -49,5 +49,5 @@ Possible settings are:
   the text `{0}`, using standard Python string formatting.  With the above
   aliases, you could use the `cookiecutter-pypackage` template simply by saying
   `cookiecutter pp`, or `cookiecutter gh:audreyr/cookiecutter-pypackage`.
-  The `gh` (github) and `bb` (bitbucket) abbreviations shown above are actually
-  built in, and can be used without defining them yourself.
+  The `gh` (github), `bb` (bitbucket), and `gl` (gitlab) abbreviations shown
+  above are actually built in, and can be used without defining them yourself.
diff --git a/docs/usage.rst b/docs/usage.rst
index cb384e2..0d8b325 100644
--- a/docs/usage.rst
+++ b/docs/usage.rst
@@ -16,7 +16,7 @@ Modify the variables defined in `cookiecutter.json`.
 
 Open up the skeleton project. If you need to change it around a bit, do so.
 
-You probably also want to create a repo, name it differently, and push it as 
+You probably also want to create a repo, name it differently, and push it as
 your own new Cookiecutter project template, for handy future use.
 
 Generate your project
@@ -42,8 +42,9 @@ To create a project from the cookiecutter-pypackage.git repo template::
 
     $ cookiecutter gh:audreyr/cookiecutter-pypackage
 
-Cookiecutter knows abbreviations for Github (``gh``) and Bitbucket (``bb``)
-projects, but you can also give it the full URL to any repository::
+Cookiecutter knows abbreviations for Github (``gh``), Bitbucket (``bb``), and
+GitLab (``gl``) projects, but you can also give it the full URL to any
+repository::
 
     $ cookiecutter https://github.com/audreyr/cookiecutter-pypackage.git
     $ cookiecutter git+ssh://git@github.com/audreyr/cookiecutter-pypackage.git


Test patch:
diff --git a/tests/test_get_config.py b/tests/test_get_config.py
index 0c2968c..441c173 100644
--- a/tests/test_get_config.py
+++ b/tests/test_get_config.py
@@ -23,6 +23,7 @@ def test_get_config():
         },
         'abbreviations': {
             'gh': 'https://github.com/{0}.git',
+            'gl': 'https://gitlab.com/{0}.git',
             'bb': 'https://bitbucket.org/{0}',
         }
     }
@@ -70,6 +71,7 @@ def test_get_config_with_defaults():
         },
         'abbreviations': {
             'gh': 'https://github.com/{0}.git',
+            'gl': 'https://gitlab.com/{0}.git',
             'bb': 'https://bitbucket.org/{0}',
         }
     }
diff --git a/tests/test_get_user_config.py b/tests/test_get_user_config.py
index 2fbea32..21d8886 100644
--- a/tests/test_get_user_config.py
+++ b/tests/test_get_user_config.py
@@ -69,6 +69,7 @@ def custom_config():
         'replay_dir': '/home/example/some-path-to-replay-files',
         'abbreviations': {
             'gh': 'https://github.com/{0}.git',
+            'gl': 'https://gitlab.com/{0}.git',
             'bb': 'https://bitbucket.org/{0}',
         }
     }