From 74ba3885284b317ae599bb8d27055f9b674c46a2 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Mon, 18 Jun 2018 06:54:30 -0300 Subject: [PATCH 01/12] first pass at some docs for this idea --- docs/metadata.md | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 docs/metadata.md diff --git a/docs/metadata.md b/docs/metadata.md new file mode 100644 index 0000000000..1d199d952f --- /dev/null +++ b/docs/metadata.md @@ -0,0 +1,58 @@ +# Gitignore Metadata + +This document outlines the additional metadata that can be associated with a gitignore template, and how tools can consume this metadata. + +## Metadata Location + +To add additional metadata to a gitignore template, add a new file to the same directory, with the matching name but ending in `yml`. + +For example: + - for `C.gitignore` the associated metadata will be stored in `C.yml` + - for `Global/JetBrains.gitignore` the metadata file will be `Global/JetBrains.gitignore` + +## Supported Fields + +The structure of these files is still being settled upon, but for the moment these are some proposed entries. + +#### `aliases` + +Some templates can be used to represent a number of different situations, and rather than duplicating files on disk and needing to keep these in sync, we can store a list of these entries as metadata. + +For example, JetBrains has a unified gitignore template that can be applied to all of their IDEs. Previously these were stored as comments in the header: + +``` +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +``` + +These values can be represented as metadata, so that tools consuming this repository can use these entries as matches if the user is searching for a specific product: + +```yaml +aliases: + - IntelliJ + - RubyMine + - PhpStorm + - AppCode + - PyCharm + - CLion + - Android Studio + - WebStorm + - Rider +``` + +#### `editors` + +There are a number of editors out there that support working with different languages. Rather than baking every editor's rules in every language that is supported, a list of additional templates that might be of interest + +```yaml +editors: + - Global/JetBrains.gitignore + - Global/VisualStudioCode.gitignore +``` + +#### `reference` + +Some ecosystems have up-to-date documentation about things that are necessary to exclude from version control. To associate this with a template, this could be stored as a key-value pair in metadata: + +```yaml +reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 +``` \ No newline at end of file From 677c7abacfe2eb365b96919bd65cf529114ec1ed Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Mon, 18 Jun 2018 06:55:42 -0300 Subject: [PATCH 02/12] extract JetBrains header information into metadata --- Global/JetBrains.gitignore | 3 --- Global/JetBrains.yml | 11 +++++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 Global/JetBrains.yml diff --git a/Global/JetBrains.gitignore b/Global/JetBrains.gitignore index 02d16aae38..b778d2380e 100644 --- a/Global/JetBrains.gitignore +++ b/Global/JetBrains.gitignore @@ -1,6 +1,3 @@ -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - # User-specific stuff .idea/**/workspace.xml .idea/**/tasks.xml diff --git a/Global/JetBrains.yml b/Global/JetBrains.yml new file mode 100644 index 0000000000..402f6507a4 --- /dev/null +++ b/Global/JetBrains.yml @@ -0,0 +1,11 @@ +aliases: + - IntelliJ + - RubyMine + - PhpStorm + - AppCode + - PyCharm + - CLion + - Android Studio + - WebStorm + - Rider +reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 \ No newline at end of file From 3fe5f882ec934f95127a70ab313ad7377aae3035 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Mon, 18 Jun 2018 06:56:17 -0300 Subject: [PATCH 03/12] hint that both JetBrains and VSCode support Python --- Python.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 Python.yml diff --git a/Python.yml b/Python.yml new file mode 100644 index 0000000000..31450430a7 --- /dev/null +++ b/Python.yml @@ -0,0 +1,3 @@ +editors: + - Global/JetBrains.gitignore + - Global/VisualStudioCode.gitignore From 22a63953fbd16e8d538b59f0ecaf2294ff899526 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Mon, 18 Jun 2018 06:57:10 -0300 Subject: [PATCH 04/12] add metadata to unify the XCode/ObjC/Swift templates --- Global/Xcode.gitignore | 4 --- Global/Xcode.yml | 3 ++ Objective-C.gitignore | 63 -------------------------------------- Swift.gitignore | 68 ------------------------------------------ 4 files changed, 3 insertions(+), 135 deletions(-) create mode 100644 Global/Xcode.yml delete mode 100644 Objective-C.gitignore delete mode 100644 Swift.gitignore diff --git a/Global/Xcode.gitignore b/Global/Xcode.gitignore index cd0c7d3e45..b805012ee4 100644 --- a/Global/Xcode.gitignore +++ b/Global/Xcode.gitignore @@ -1,7 +1,3 @@ -# Xcode -# -# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore - ## User settings xcuserdata/ diff --git a/Global/Xcode.yml b/Global/Xcode.yml new file mode 100644 index 0000000000..66c67e5576 --- /dev/null +++ b/Global/Xcode.yml @@ -0,0 +1,3 @@ +aliases: + - Objective-C + - Swift diff --git a/Objective-C.gitignore b/Objective-C.gitignore deleted file mode 100644 index 86de6aa3f5..0000000000 --- a/Objective-C.gitignore +++ /dev/null @@ -1,63 +0,0 @@ -# Xcode -# -# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore - -## Build generated -build/ -DerivedData/ - -## Various settings -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 -xcuserdata/ - -## Other -*.moved-aside -*.xccheckout -*.xcscmblueprint - -## Obj-C/Swift specific -*.hmap -*.ipa -*.dSYM.zip -*.dSYM - -# CocoaPods -# -# We recommend against adding the Pods directory to your .gitignore. However -# you should judge for yourself, the pros and cons are mentioned at: -# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control -# -# Pods/ - -# Carthage -# -# Add this line if you want to avoid checking in source code from Carthage dependencies. -# Carthage/Checkouts - -Carthage/Build - -# fastlane -# -# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the -# screenshots whenever they are needed. -# For more information about the recommended setup visit: -# https://docs.fastlane.tools/best-practices/source-control/#source-control - -fastlane/report.xml -fastlane/Preview.html -fastlane/screenshots/**/*.png -fastlane/test_output - -# Code Injection -# -# After new code Injection tools there's a generated folder /iOSInjectionProject -# https://github.com/johnno1962/injectionforxcode - -iOSInjectionProject/ diff --git a/Swift.gitignore b/Swift.gitignore deleted file mode 100644 index 312d1f652c..0000000000 --- a/Swift.gitignore +++ /dev/null @@ -1,68 +0,0 @@ -# Xcode -# -# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore - -## Build generated -build/ -DerivedData/ - -## Various settings -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 -xcuserdata/ - -## Other -*.moved-aside -*.xccheckout -*.xcscmblueprint - -## Obj-C/Swift specific -*.hmap -*.ipa -*.dSYM.zip -*.dSYM - -## Playgrounds -timeline.xctimeline -playground.xcworkspace - -# Swift Package Manager -# -# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. -# Packages/ -# Package.pins -# Package.resolved -.build/ - -# CocoaPods -# -# We recommend against adding the Pods directory to your .gitignore. However -# you should judge for yourself, the pros and cons are mentioned at: -# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control -# -# Pods/ - -# Carthage -# -# Add this line if you want to avoid checking in source code from Carthage dependencies. -# Carthage/Checkouts - -Carthage/Build - -# fastlane -# -# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the -# screenshots whenever they are needed. -# For more information about the recommended setup visit: -# https://docs.fastlane.tools/best-practices/source-control/#source-control - -fastlane/report.xml -fastlane/Preview.html -fastlane/screenshots/**/*.png -fastlane/test_output From 13293bc8ac71d52e097278d370b4079c087e2b69 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Mon, 18 Jun 2018 06:58:13 -0300 Subject: [PATCH 05/12] add hints that JetBrains and VSCode can support VisualStudio projects --- VisualStudio.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 VisualStudio.yml diff --git a/VisualStudio.yml b/VisualStudio.yml new file mode 100644 index 0000000000..2c872d874b --- /dev/null +++ b/VisualStudio.yml @@ -0,0 +1,11 @@ +aliases: + - CSharp + - C# + - FSharp + - F# + - VisualBasic + - VB + +editors: + - Global/JetBrains.gitignore + - Global/VisualStudioCode.gitignore From 8c48d15ecb280f20ee7ffe3b44d520a284bc73de Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Mon, 18 Jun 2018 06:59:00 -0300 Subject: [PATCH 06/12] point the Android template to the JetBrains template to eliminate duplication --- Android.gitignore | 10 ---------- Android.yml | 2 ++ 2 files changed, 2 insertions(+), 10 deletions(-) create mode 100644 Android.yml diff --git a/Android.gitignore b/Android.gitignore index 39b6783cef..60f1e607f2 100644 --- a/Android.gitignore +++ b/Android.gitignore @@ -32,16 +32,6 @@ proguard/ # Android Studio captures folder captures/ -# IntelliJ -*.iml -.idea/workspace.xml -.idea/tasks.xml -.idea/gradle.xml -.idea/assetWizardSettings.xml -.idea/dictionaries -.idea/libraries -.idea/caches - # Keystore files # Uncomment the following line if you do not want to check your keystore files in. #*.jks diff --git a/Android.yml b/Android.yml new file mode 100644 index 0000000000..c4c306d9f9 --- /dev/null +++ b/Android.yml @@ -0,0 +1,2 @@ +editors: + - Global/JetBrains.gitignore \ No newline at end of file From e734a55eb62b3e69736d4ea001752e1381e5c8c7 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Mon, 18 Jun 2018 06:59:22 -0300 Subject: [PATCH 07/12] eliminate duplication of JetBrains rules in VisualStudio --- Global/JetBrains.gitignore | 3 +++ VisualStudio.gitignore | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Global/JetBrains.gitignore b/Global/JetBrains.gitignore index b778d2380e..960ad6e506 100644 --- a/Global/JetBrains.gitignore +++ b/Global/JetBrains.gitignore @@ -47,3 +47,6 @@ fabric.properties # Editor-based Rest Client .idea/httpRequests + +# Rider-specific rules +*.sln.iml \ No newline at end of file diff --git a/VisualStudio.gitignore b/VisualStudio.gitignore index f431ddc7cf..63ab0f8b7e 100644 --- a/VisualStudio.gitignore +++ b/VisualStudio.gitignore @@ -286,10 +286,6 @@ paket-files/ # FAKE - F# Make .fake/ -# JetBrains Rider -.idea/ -*.sln.iml - # CodeRush .cr/ From 9b955e4787932c96170faa7fcf3ff8f377af7e42 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Mon, 18 Jun 2018 07:36:15 -0300 Subject: [PATCH 08/12] replace symlinks with metadata --- C++.yml | 2 ++ Clojure.gitignore | 1 - Fortran.gitignore | 1 - Java.yml | 2 ++ Kotlin.gitignore | 1 - Leiningen.yml | 2 ++ 6 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 C++.yml delete mode 120000 Clojure.gitignore delete mode 120000 Fortran.gitignore create mode 100644 Java.yml delete mode 120000 Kotlin.gitignore create mode 100644 Leiningen.yml diff --git a/C++.yml b/C++.yml new file mode 100644 index 0000000000..444cc2e1ab --- /dev/null +++ b/C++.yml @@ -0,0 +1,2 @@ +aliases: + - Fortran \ No newline at end of file diff --git a/Clojure.gitignore b/Clojure.gitignore deleted file mode 120000 index 7657a270c4..0000000000 --- a/Clojure.gitignore +++ /dev/null @@ -1 +0,0 @@ -Leiningen.gitignore \ No newline at end of file diff --git a/Fortran.gitignore b/Fortran.gitignore deleted file mode 120000 index 5daba98a3e..0000000000 --- a/Fortran.gitignore +++ /dev/null @@ -1 +0,0 @@ -C++.gitignore \ No newline at end of file diff --git a/Java.yml b/Java.yml new file mode 100644 index 0000000000..fed7f632ac --- /dev/null +++ b/Java.yml @@ -0,0 +1,2 @@ +aliases: + - Kotlin \ No newline at end of file diff --git a/Kotlin.gitignore b/Kotlin.gitignore deleted file mode 120000 index c48376eebc..0000000000 --- a/Kotlin.gitignore +++ /dev/null @@ -1 +0,0 @@ -Java.gitignore \ No newline at end of file diff --git a/Leiningen.yml b/Leiningen.yml new file mode 100644 index 0000000000..0a0bb34587 --- /dev/null +++ b/Leiningen.yml @@ -0,0 +1,2 @@ +aliases: + - Clojure \ No newline at end of file From de60b262fc9d705a2ae7a66f8b186d08f58197b0 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Mon, 18 Jun 2018 08:23:53 -0300 Subject: [PATCH 09/12] ensure all touched files end in a newline --- Android.yml | 2 +- C++.yml | 2 +- Global/JetBrains.gitignore | 2 +- Java.yml | 2 +- Leiningen.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Android.yml b/Android.yml index c4c306d9f9..859433393e 100644 --- a/Android.yml +++ b/Android.yml @@ -1,2 +1,2 @@ editors: - - Global/JetBrains.gitignore \ No newline at end of file + - Global/JetBrains.gitignore diff --git a/C++.yml b/C++.yml index 444cc2e1ab..6c108f739d 100644 --- a/C++.yml +++ b/C++.yml @@ -1,2 +1,2 @@ aliases: - - Fortran \ No newline at end of file + - Fortran diff --git a/Global/JetBrains.gitignore b/Global/JetBrains.gitignore index 960ad6e506..629500fd98 100644 --- a/Global/JetBrains.gitignore +++ b/Global/JetBrains.gitignore @@ -49,4 +49,4 @@ fabric.properties .idea/httpRequests # Rider-specific rules -*.sln.iml \ No newline at end of file +*.sln.iml diff --git a/Java.yml b/Java.yml index fed7f632ac..b1fd2ee603 100644 --- a/Java.yml +++ b/Java.yml @@ -1,2 +1,2 @@ aliases: - - Kotlin \ No newline at end of file + - Kotlin diff --git a/Leiningen.yml b/Leiningen.yml index 0a0bb34587..4ad282bc6b 100644 --- a/Leiningen.yml +++ b/Leiningen.yml @@ -1,2 +1,2 @@ aliases: - - Clojure \ No newline at end of file + - Clojure From 7603d71a56bb12f7783b9473d871468b2bbbaf7e Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Mon, 18 Jun 2018 08:36:39 -0300 Subject: [PATCH 10/12] add reviewers element --- VisualStudio.yml | 3 +++ docs/metadata.md | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/VisualStudio.yml b/VisualStudio.yml index 2c872d874b..a699b6f2b6 100644 --- a/VisualStudio.yml +++ b/VisualStudio.yml @@ -9,3 +9,6 @@ aliases: editors: - Global/JetBrains.gitignore - Global/VisualStudioCode.gitignore + +reviewers: + - Brendan Forster (@shiftkey) \ No newline at end of file diff --git a/docs/metadata.md b/docs/metadata.md index 1d199d952f..99f71e7f95 100644 --- a/docs/metadata.md +++ b/docs/metadata.md @@ -55,4 +55,20 @@ Some ecosystems have up-to-date documentation about things that are necessary to ```yaml reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 -``` \ No newline at end of file +``` + +### `reviewers` + +This element is inspired by the [`DefinitelyTyped`](https://github.com/DefinitelyTyped/DefinitelyTyped) project, allowing community members to opt-in to reviewing templates when a pull request is opened. This helps to share the review load and credit people who have been helpful with reviews. + +```yaml +reviewers: + - @shiftkey +``` + +A friendly name can be provided alongside the GitHub account name. + +```yaml +reviewers: + - Brendan Forster (@shiftkey) +``` From dc9c75a9f089e442789afd5986c02a051d2414eb Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Mon, 18 Jun 2018 08:46:00 -0300 Subject: [PATCH 11/12] and an editorconfig to prevent future mistakes --- .editorconfig | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..1c33738acd --- /dev/null +++ b/.editorconfig @@ -0,0 +1,3 @@ +[*] +end_of_line = lf +insert_final_newline = true From 133c57afa50921139476d0ba2eadefb679155d99 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Mon, 18 Jun 2018 08:46:31 -0300 Subject: [PATCH 12/12] add newline --- VisualStudio.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VisualStudio.yml b/VisualStudio.yml index a699b6f2b6..00c4b81852 100644 --- a/VisualStudio.yml +++ b/VisualStudio.yml @@ -11,4 +11,4 @@ editors: - Global/VisualStudioCode.gitignore reviewers: - - Brendan Forster (@shiftkey) \ No newline at end of file + - Brendan Forster (@shiftkey)