From bc2cc1273171ef9c83b4af01d7a65d8c17406c12 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Matija=20=C4=8Cupi=C4=87?= <matteeyah@gmail.com>
Date: Wed, 25 Sep 2019 15:27:31 +0000
Subject: [PATCH] Add projections file

---
 .gitignore                     |  1 +
 .projections.json.example      | 36 ++++++++++++++++++++++++++++++++++
 doc/development/README.md      |  4 ++++
 doc/development/projections.md | 34 ++++++++++++++++++++++++++++++++
 4 files changed, 75 insertions(+)
 create mode 100644 .projections.json.example
 create mode 100644 doc/development/projections.md

diff --git a/.gitignore b/.gitignore
index 7310c04d11760..65befc209636d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -81,3 +81,4 @@ package-lock.json
 jsdoc/
 **/tmp/rubocop_cache/**
 .overcommit.yml
+.projections.json
diff --git a/.projections.json.example b/.projections.json.example
new file mode 100644
index 0000000000000..7ea0862f56abd
--- /dev/null
+++ b/.projections.json.example
@@ -0,0 +1,36 @@
+{
+  "app/*.rb": {
+    "alternate": "spec/{}_spec.rb",
+    "type": "source"
+  },
+  "spec/*_spec.rb": {
+    "alternate": "app/{}.rb",
+    "type": "test"
+  },
+  "lib/*.rb": {
+    "alternate": "spec/lib/{}_spec.rb",
+    "type": "source"
+  },
+  "spec/lib/*_spec.rb": {
+    "alternate": "lib/{}.rb",
+    "type": "test"
+  },
+  "ee/app/*.rb": {
+    "alternate": "ee/spec/{}_spec.rb",
+    "type": "source"
+  },
+  "ee/spec/*_spec.rb": {
+    "alternate": "ee/app/{}.rb",
+    "type": "test"
+  },
+  "ee/lib/*.rb": {
+    "alternate": "ee/spec/lib/{}_spec.rb",
+    "type": "source"
+  },
+  "ee/spec/lib/*_spec.rb": {
+    "alternate": "ee/lib/{}.rb",
+    "type": "test"
+  },
+  "*.rb": {"dispatch": "bundle exec rubocop {file}"},
+  "*_spec.rb": {"dispatch": "bundle exec rspec {file}"}
+}
diff --git a/doc/development/README.md b/doc/development/README.md
index 4c9e111bc996b..bdc9223671639 100644
--- a/doc/development/README.md
+++ b/doc/development/README.md
@@ -165,6 +165,10 @@ description: 'Learn how to contribute to GitLab.'
 
 - [Shell scripting standards and style guidelines](shell_scripting_guide/index.md)
 
+## Other Development guides
+
+- [Defining relations between files using projections](projections.md)
+
 ## Other GitLab Development Kit (GDK) guides
 
 - [Run full Auto DevOps cycle in a GDK instance](https://gitlab.com/gitlab-org/gitlab-development-kit/blob/master/doc/howto/auto_devops.md)
diff --git a/doc/development/projections.md b/doc/development/projections.md
new file mode 100644
index 0000000000000..9d5702da530e5
--- /dev/null
+++ b/doc/development/projections.md
@@ -0,0 +1,34 @@
+# Projections
+
+Projections are a way to define relations between files. Every file can have a
+"related" or "alternate" file. It's common to consider spec files to be
+"alternate" files to source files.
+
+## How to use it
+
+- Install an editor plugin that consumes projections
+- Copy `.projections.json.example` to `.projections.json`
+
+## How to customize it
+
+You can find a basic list of projection options in
+[projectionist.txt](https://github.com/tpope/vim-projectionist/blob/master/doc/projectionist.txt)
+
+## Which plugins can I use
+
+- vim
+  - [vim-projectionist](https://github.com/tpope/vim-projectionist)
+- VSCode
+  - [Alternate File](https://marketplace.visualstudio.com/items?itemName=will-wow.vscode-alternate-file)
+  - [projectionist](https://github.com/jarsen/projectionist)
+  - [jumpto](https://github.com/gmdayley/jumpto)
+- Atom
+  - [projectionist-atom](https://atom.io/packages/projectionist-atom)
+- Command-line
+  - [projectionist](https://github.com/glittershark/projectionist)
+
+## History
+
+This started as a
+[plugin for vim by tpope](https://github.com/tpope/vim-projectionist)
+It has since become editor-agnostic and ported to most modern editors.
-- 
GitLab