From 53c06442efddb29dbf7a5cffbe984e52549f530f Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Mon, 10 May 2021 13:43:13 +0200 Subject: [PATCH] DEV: Clean up .gitignore (#12981) (inspired by martin-brennan's recent adventure with `tags` exclusion) **tl;dr: some of it is obsolete, some is dev-env specific and should live in *your* ~/.gitignore.** --- To enable global gitignore (`~/.gitignore`) run: ```bash git config --global core.excludesFile '~/.gitignore' ``` Then create that file and add your VIM/VSCode/Sublime/Emacs/Eclipse/RubyMine/JetBrains/macOS/Arch/Windows 95-specific stuff. --- Reasons for removal: * `bin` - never really ignored, all the files are checked in * `.DS_Store`, `._.DS_Store` - OS specific * `.sass-cache/*`, `/.bundle`, `/bundle/*`, `/cache`, `/logfile`, `!/plugins/discourse-nginx-performance-report`, `MiniProfiler/Ruby/rack-mini-profiler-2.0.1a.gem`, `config/fog_credentials.yml`, `/public/stylesheet-cache/*`, `script/download_db`, `script/refresh_db`, `config/version.rb` - no longer used? * `/log/*.log` - covered by /log * `bootsnap-load-path-cache`, `bootsnap-compile-cache` - bootsnap now keeps its ~~trash~~ temporary files in `/tmp` * `/.project`, `/.buildpath`, `/.byebug_history`, `/.idea`, `discourse.sublime-workspace`, `*~`, `*.swp`, `*.swo`, `*.swm`, `config/multisite1.yml`, `.rvmrc`, `.ruby-version`, `.ruby-gemset`, `.rbenv`, `bundler_stubs/*`, `*.db`, `*.iml`, `*.swn`, `/package-lock.json`, `.vscode`, `.envrc`, `tags` - dev-env specific, see the note at the top of the commit --- .gitignore | 160 ++++++++++------------------------------------------ bin/rubocop | 29 ++++++++++ 2 files changed, 60 insertions(+), 129 deletions(-) create mode 100755 bin/rubocop diff --git a/.gitignore b/.gitignore index 5de911ec664..8aea19bec0b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,33 +1,26 @@ -# See http://help.github.com/ignore-files/ for more about ignoring files. -# -# If you find yourself ignoring temporary files generated by your text editor -# or operating system, you probably want to add a global ignore instead: -# git config --global core.excludesfile ~/.gitignore_global +/copyright +/coverage +/data +/log +/tmp -.DS_Store -._.DS_Store -dump.rdb +/.env +/.procfile +/dump.rdb -bin/* +/config/discourse.conf +/config/discourse.pill +/config/multisite.yml +# `discourse_dev` gem +/config/dev.yml -data/ - -.sass-cache/* -public/csv/* -public/plugins/* -public/tombstone/* - -# Ignore bundler config -/.bundle -/cache -/coverage/* - -/public/assets/* -/public/tombstone/* -/bundle/* - -config/discourse.pill -config/discourse.conf +/public/assets +/public/backups +/public/csv +/public/fonts +/public/plugins +/public/tombstone +/public/uploads # Ignore the default SQLite database and db dumps *.sql @@ -38,120 +31,29 @@ config/discourse.conf /db/schema.rb /db/schema_cache.yml -# Ignore all logfiles and tempfiles. -/log/*.log -/tmp -/logfile -log/ -bootsnap-load-path-cache -bootsnap-compile-cache/ - -# Ignore plugins except for the bundled ones. +# Plugins except for the bundled ones /plugins/* -!/plugins/lazy-yt/ -!/plugins/poll/ !/plugins/discourse-details/ -!/plugins/discourse-nginx-performance-report +!/plugins/discourse-local-dates !/plugins/discourse-narrative-bot !/plugins/discourse-presence +!/plugins/lazy-yt/ +!/plugins/poll/ !/plugins/styleguide -!/plugins/discourse-local-dates /plugins/*/auto_generated/ /spec/fixtures/plugins/my_plugin/auto_generated -# Ignore Eclipse .project file -/.project - -# Ignore Eclipse .buildpath file -/.buildpath - -# Ignore byebug history -/.byebug_history - -# Ignore RubyMine settings -/.idea - -# Ignore gem that is copied in -MiniProfiler/Ruby/rack-mini-profiler-2.0.1a.gem - -discourse.sublime-workspace - -# Vim temp files -*~ -*.swp -*.swo -*.swm - -# don't check in multisite config -config/multisite.yml -# don't check in my renamed multisite config as well :) -config/multisite1.yml -config/fog_credentials.yml - -/public/fonts -/public/uploads -/public/backups -/public/stylesheet-cache/* - -# Scripts used for downloading/refreshing db -script/download_db -script/refresh_db - -# .procfile -.procfile - -# .env, local environment variables for use with foreman -.env - -# exclude our git version file for now -config/version.rb - -# ignore the Ruby Version manager (rvm) -.rvmrc -.ruby-version -.ruby-gemset -.rbenv -bundler_stubs/* - -vendor/bundle/* -*.db - -# ignore jetbrains ide file -*.iml - -# vim swap -*.swn - -# ignore nodejs files -node_modules -/package-lock.json - +/vendor/bundle/* /vendor/data/GeoLite2-City.mmdb -# Vagrant -.vagrant +# Front-end +dist +node_modules +yarn-error.log -# ignore auto-generated plugin js assets +# Auto-generated plugin JS assets /app/assets/javascripts/plugins/* -# ignore generated api documentation files +# Generated API documentation files openapi/* - -# ignore VSCode config files -.vscode - -# ignore direnv -.envrc - -# ember-cli generated -dist - -# Copyright Deposits -copyright - -yarn-error.log -tags - -# file used with `discourse_dev` gem in development environment. -config/dev.yml diff --git a/bin/rubocop b/bin/rubocop new file mode 100755 index 00000000000..d0c48829311 --- /dev/null +++ b/bin/rubocop @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'rubocop' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rubocop", "rubocop")