Skip to content

Commit

Permalink
Rever Rubocop auto corrections to examples applied before excluding it
Browse files Browse the repository at this point in the history
Former-commit-id: c56793d
  • Loading branch information
MXfive committed Mar 20, 2020
1 parent fa6882b commit e8e91ae
Show file tree
Hide file tree
Showing 41 changed files with 25 additions and 98 deletions.
8 changes: 3 additions & 5 deletions examples/rails5/Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

Expand Down Expand Up @@ -40,13 +38,13 @@ gem 'bootsnap', '>= 1.1.0', require: false

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: %i[mri mingw x64_mingw]
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem 'listen', '>= 3.0.5', '< 3.2'
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
Expand All @@ -61,6 +59,6 @@ group :test do
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

gem 'rack-cors', '>= 1.1.0'
2 changes: 0 additions & 2 deletions examples/rails5/Rakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

Expand Down
2 changes: 0 additions & 2 deletions examples/rails5/app/channels/application_cable/channel.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

module ApplicationCable
class Channel < ActionCable::Channel::Base
end
Expand Down
2 changes: 0 additions & 2 deletions examples/rails5/app/channels/application_cable/connection.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

module ApplicationCable
class Connection < ActionCable::Connection::Base
end
Expand Down
2 changes: 0 additions & 2 deletions examples/rails5/app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
# frozen_string_literal: true

class ApplicationController < ActionController::Base
end
2 changes: 0 additions & 2 deletions examples/rails5/app/controllers/cors_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

class CorsController < ApplicationController
skip_before_action :verify_authenticity_token
def create
Expand Down
4 changes: 1 addition & 3 deletions examples/rails5/app/controllers/welcome_controller.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# frozen_string_literal: true

class WelcomeController < ApplicationController
skip_before_action :verify_authenticity_token
def index
render plain: 'Hello world'
render plain: "Hello world"
end
end
2 changes: 0 additions & 2 deletions examples/rails5/app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
# frozen_string_literal: true

module ApplicationHelper
end
2 changes: 0 additions & 2 deletions examples/rails5/app/jobs/application_job.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
# frozen_string_literal: true

class ApplicationJob < ActiveJob::Base
end
2 changes: 0 additions & 2 deletions examples/rails5/app/mailers/application_mailer.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

class ApplicationMailer < ActionMailer::Base
default from: 'from@example.com'
layout 'mailer'
Expand Down
2 changes: 0 additions & 2 deletions examples/rails5/app/models/application_record.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
2 changes: 0 additions & 2 deletions examples/rails5/bin/bundle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
load Gem.bin_path('bundler', 'bundle')
4 changes: 1 addition & 3 deletions examples/rails5/bin/rails
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

begin
load File.expand_path('spring', __dir__)
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
Expand Down
4 changes: 1 addition & 3 deletions examples/rails5/bin/rake
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

begin
load File.expand_path('spring', __dir__)
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
Expand Down
2 changes: 0 additions & 2 deletions examples/rails5/bin/setup
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'fileutils'
include FileUtils

Expand Down
1 change: 0 additions & 1 deletion examples/rails5/bin/spring
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

# This file loads Spring without using Bundler, in order to be fast.
# It gets overwritten when you run the `spring binstub` command.
Expand Down
2 changes: 0 additions & 2 deletions examples/rails5/bin/update
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'fileutils'
include FileUtils

Expand Down
8 changes: 3 additions & 5 deletions examples/rails5/bin/yarn
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

APP_ROOT = File.expand_path('..', __dir__)
Dir.chdir(APP_ROOT) do
begin
exec 'yarnpkg', *ARGV
exec "yarnpkg", *ARGV
rescue Errno::ENOENT
warn 'Yarn executable was not detected in the system.'
warn 'Download Yarn at https://yarnpkg.com/en/docs/install'
$stderr.puts "Yarn executable was not detected in the system."
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
exit 1
end
end
2 changes: 0 additions & 2 deletions examples/rails5/config.ru
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

# This file is used by Rack-based servers to start the application.

require_relative 'config/environment'
Expand Down
2 changes: 0 additions & 2 deletions examples/rails5/config/application.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

require_relative 'boot'

require 'rails/all'
Expand Down
2 changes: 0 additions & 2 deletions examples/rails5/config/boot.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)

require 'bundler/setup' # Set up gems listed in the Gemfile.
Expand Down
2 changes: 0 additions & 2 deletions examples/rails5/config/environment.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

# Load the Rails application.
require_relative 'application'

Expand Down
2 changes: 0 additions & 2 deletions examples/rails5/config/environments/development.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

Expand Down
6 changes: 2 additions & 4 deletions examples/rails5/config/environments/production.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

Expand Down Expand Up @@ -56,7 +54,7 @@
config.log_level = :debug

# Prepend all log lines with the following tags.
config.log_tags = [:request_id]
config.log_tags = [ :request_id ]

# Use a different cache store in production.
# config.cache_store = :mem_cache_store
Expand Down Expand Up @@ -85,7 +83,7 @@
# require 'syslog/logger'
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')

if ENV['RAILS_LOG_TO_STDOUT'].present?
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
Expand Down
2 changes: 0 additions & 2 deletions examples/rails5/config/environments/test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.

# ActiveSupport::Reloader.to_prepare do
Expand Down
2 changes: 0 additions & 2 deletions examples/rails5/config/initializers/assets.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# Version of your assets, change this if you want to expire all your assets.
Expand Down
1 change: 0 additions & 1 deletion examples/rails5/config/initializers/backtrace_silencers.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.

# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.

# Define an application-wide content security policy
Expand Down
2 changes: 0 additions & 2 deletions examples/rails5/config/initializers/cookies_serializer.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# Specify a serializer for the signed and encrypted cookie jars.
Expand Down
16 changes: 8 additions & 8 deletions examples/rails5/config/initializers/cors.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# frozen_string_literal: true

Rails.application.config.middleware.insert_before 0, Rack::Cors, debug: true, logger: (-> { Rails.logger }) do
allow do
origins '*'

resource '/cors',
headers: :any,
methods: [:post],
max_age: 0
:headers => :any,
:methods => [:post],
:max_age => 0

resource '*',
headers: :any,
methods: %i[get post delete put patch options head],
max_age: 0
:headers => :any,
:methods => [:get, :post, :delete, :put, :patch, :options, :head],
:max_age => 0
end
end


Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# Configure sensitive parameters which will be filtered from the log file.
Expand Down
1 change: 0 additions & 1 deletion examples/rails5/config/initializers/inflections.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.

# Add new inflection rules using the following format. Inflections
Expand Down
1 change: 0 additions & 1 deletion examples/rails5/config/initializers/mime_types.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.

# Add new mime types for use in respond_to blocks:
Expand Down
2 changes: 0 additions & 2 deletions examples/rails5/config/initializers/wrap_parameters.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# This file contains settings for ActionController::ParamsWrapper which
Expand Down
8 changes: 3 additions & 5 deletions examples/rails5/config/puma.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
# frozen_string_literal: true

# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches the default thread size of Active Record.
#
threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 }
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
threads threads_count, threads_count

# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
#
port ENV.fetch('PORT') { 3000 }
port ENV.fetch("PORT") { 3000 }

# Specifies the `environment` that Puma will run in.
#
environment ENV.fetch('RAILS_ENV') { 'development' }
environment ENV.fetch("RAILS_ENV") { "development" }

# Specifies the number of `workers` to boot in clustered mode.
# Workers are forked webserver processes. If using threads and workers together
Expand Down
6 changes: 2 additions & 4 deletions examples/rails5/config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# frozen_string_literal: true

Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
resources :cors
match '/', to: 'welcome#index', via: %i[get post put delete options head patch]
match '/*glob', to: 'welcome#index', via: %i[get post put delete options head patch]
match '/', to: "welcome#index", via: [:get, :post, :put, :delete, :options, :head, :patch]
match '/*glob', to: "welcome#index", via: [:get, :post, :put, :delete, :options, :head, :patch]
end
2 changes: 0 additions & 2 deletions examples/rails5/config/spring.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

%w[
.ruby-version
.rbenv-vars
Expand Down
1 change: 0 additions & 1 deletion examples/rails5/db/seeds.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# frozen_string_literal: true
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
Expand Down
4 changes: 1 addition & 3 deletions examples/rails5/test/application_system_test_case.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# frozen_string_literal: true

require 'test_helper'
require "test_helper"

class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
Expand Down
2 changes: 0 additions & 2 deletions examples/rails5/test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

ENV['RAILS_ENV'] ||= 'test'
require_relative '../config/environment'
require 'rails/test_help'
Expand Down

0 comments on commit e8e91ae

Please sign in to comment.