From 544079b7f12d242cd41ca9f98773d8945a87ce2f Mon Sep 17 00:00:00 2001 From: Thomas Burkhalter Date: Mon, 30 Sep 2024 21:27:03 +0200 Subject: [PATCH] Fix formatting, add more bash functionality --- .bashrc | 5 +++++ app/cells/decidim/assemblies/assembly_m/footer.erb | 2 +- app/cells/decidim/assemblies/assembly_m/tags.erb | 2 +- app/channels/application_cable/channel.rb | 2 ++ app/channels/application_cable/connection.rb | 2 ++ app/controllers/application_controller.rb | 2 ++ app/controllers/decidim_controller.rb | 2 ++ app/controllers/status_controller.rb | 2 ++ app/helpers/application_helper.rb | 13 +++++++------ app/helpers/last_blog_posts_helper.rb | 12 ++++++------ app/jobs/application_job.rb | 2 ++ app/mailers/application_mailer.rb | 2 ++ app/models/application_record.rb | 2 ++ config/boot.rb | 2 ++ config/environment.rb | 2 ++ config/environments/development.rb | 2 ++ config/environments/production.rb | 2 ++ config/environments/test.rb | 2 ++ .../initializers/application_controller_renderer.rb | 2 ++ config/initializers/backtrace_silencers.rb | 2 ++ config/initializers/content_security_policy.rb | 2 ++ config/initializers/cookies_serializer.rb | 2 ++ config/initializers/filter_parameter_logging.rb | 2 ++ config/initializers/inflections.rb | 2 ++ config/initializers/mime_types.rb | 2 ++ config/initializers/wrap_parameters.rb | 2 ++ config/puma.rb | 2 ++ config/routes.rb | 2 ++ config/spring.rb | 2 ++ db/seeds.rb | 2 ++ docker-compose-build.yml | 5 +++++ docker-compose.yml | 1 + test/application_system_test_case.rb | 4 +++- test/controllers/status_controller_test.rb | 5 +++-- test/test_helper.rb | 2 ++ 35 files changed, 84 insertions(+), 17 deletions(-) diff --git a/.bashrc b/.bashrc index fb805c4b..05e6dc20 100644 --- a/.bashrc +++ b/.bashrc @@ -1,3 +1,7 @@ +alias vim="vim.tiny" +export PATH="${HOME}/bin:${PATH}" +export EDITOR="vim" + if [[ $SENTRY_CURRENT_ENV == "production" ]]; then export PS1="\[\033[01;31m\]STZH-PROD\[\033[00m\] \w> " elif [[ $SENTRY_CURRENT_ENV == "integration" ]]; then @@ -5,3 +9,4 @@ elif [[ $SENTRY_CURRENT_ENV == "integration" ]]; then else export PS1="\[\033[01;32m\]STZH-DEV\[\033[00m\] \w> " fi + diff --git a/app/cells/decidim/assemblies/assembly_m/footer.erb b/app/cells/decidim/assemblies/assembly_m/footer.erb index 8ef3585b..a8a39ce4 100644 --- a/app/cells/decidim/assemblies/assembly_m/footer.erb +++ b/app/cells/decidim/assemblies/assembly_m/footer.erb @@ -1 +1 @@ - <% # this template intentionally left blank %> \ No newline at end of file +<% # this template intentionally left blank %> diff --git a/app/cells/decidim/assemblies/assembly_m/tags.erb b/app/cells/decidim/assemblies/assembly_m/tags.erb index 8ef3585b..a8a39ce4 100644 --- a/app/cells/decidim/assemblies/assembly_m/tags.erb +++ b/app/cells/decidim/assemblies/assembly_m/tags.erb @@ -1 +1 @@ - <% # this template intentionally left blank %> \ No newline at end of file +<% # this template intentionally left blank %> diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb index d6726972..9aec2305 100644 --- a/app/channels/application_cable/channel.rb +++ b/app/channels/application_cable/channel.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ApplicationCable class Channel < ActionCable::Channel::Base end diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb index 0ff5442f..8d6c2a1b 100644 --- a/app/channels/application_cable/connection.rb +++ b/app/channels/application_cable/connection.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ApplicationCable class Connection < ActionCable::Connection::Base end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1b06d7f9..e037746a 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ApplicationController < ActionController::Base before_action :set_sentry_context before_action :set_cache_headers diff --git a/app/controllers/decidim_controller.rb b/app/controllers/decidim_controller.rb index d61ffd09..85919c07 100644 --- a/app/controllers/decidim_controller.rb +++ b/app/controllers/decidim_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Entry point for Decidim. It will use the `DecidimController` as # entry point, but you can change what controller it inherits from # so you can customize some methods. diff --git a/app/controllers/status_controller.rb b/app/controllers/status_controller.rb index 66dd956c..37b17173 100644 --- a/app/controllers/status_controller.rb +++ b/app/controllers/status_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (c) 2006-2017, Puzzle ITC GmbH. This file is part of # PuzzleTime and licensed under the Affero General Public License version 3 # or later. See the COPYING file at the top-level directory or at diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8c0995de..378665ec 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,12 +1,13 @@ -module ApplicationHelper +# frozen_string_literal: true +module ApplicationHelper def number_to_currency(number, options = {}) defaults = { - locale: :de, - unit: Decidim.currency_unit, - separator: ',', - delimiter: '\'', - format: '%u %n' + locale: :de, + unit: Decidim.currency_unit, + separator: ',', + delimiter: '\'', + format: '%u %n' } super number, defaults.merge(options) end diff --git a/app/helpers/last_blog_posts_helper.rb b/app/helpers/last_blog_posts_helper.rb index 362b76b8..e971c235 100644 --- a/app/helpers/last_blog_posts_helper.rb +++ b/app/helpers/last_blog_posts_helper.rb @@ -7,15 +7,15 @@ module LastBlogPostsHelper def blog_image_src(post) image_from_text = - Nokogiri::HTML - .parse(translated_attribute(post.body)) - .css('img') - .first - &.attr('src') + Nokogiri::HTML + .parse(translated_attribute(post.body)) + .css('img') + .first + &.attr('src') return image_from_text if image_from_text.present? return post.photos.min_by(&:weight).url if post.photos.count.positive? asset_pack_path('media/images/organization-default-image.png') end -end \ No newline at end of file +end diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index a009ace5..d92ffddc 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + class ApplicationJob < ActiveJob::Base end diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 286b2239..d84cb6e7 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ApplicationMailer < ActionMailer::Base default from: 'from@example.com' layout 'mailer' diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 10a4cba8..71fbba5b 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ApplicationRecord < ActiveRecord::Base self.abstract_class = true end diff --git a/config/boot.rb b/config/boot.rb index 08150ffa..792e475b 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/config/environment.rb b/config/environment.rb index 426333bb..d5abe558 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Load the Rails application. require_relative 'application' diff --git a/config/environments/development.rb b/config/environments/development.rb index b3d512e2..7b920543 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. diff --git a/config/environments/production.rb b/config/environments/production.rb index f196bf93..57222708 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. diff --git a/config/environments/test.rb b/config/environments/test.rb index 0dfb786e..fcea3915 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb index 89d2efab..6d56e439 100644 --- a/config/initializers/application_controller_renderer.rb +++ b/config/initializers/application_controller_renderer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # ActiveSupport::Reloader.to_prepare do diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb index 59385cdf..4b63f289 100644 --- a/config/initializers/backtrace_silencers.rb +++ b/config/initializers/backtrace_silencers.rb @@ -1,3 +1,5 @@ +# 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. diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 9a4a8106..6719706e 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Define an application-wide content security policy diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb index 5a6a32d3..ee8dff9c 100644 --- a/config/initializers/cookies_serializer.rb +++ b/config/initializers/cookies_serializer.rb @@ -1,3 +1,5 @@ +# 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. diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 4a994e1e..7a4f47b4 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,3 +1,5 @@ +# 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. diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index ac033bf9..dc847422 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Add new inflection rules using the following format. Inflections diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index dc189968..be6fedc5 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -1,3 +1,5 @@ +# 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: diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb index bbfc3961..2f3c0db4 100644 --- a/config/initializers/wrap_parameters.rb +++ b/config/initializers/wrap_parameters.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # This file contains settings for ActionController::ParamsWrapper which diff --git a/config/puma.rb b/config/puma.rb index 5eba91c6..a9cb31b9 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,3 +1,5 @@ +# 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 diff --git a/config/routes.rb b/config/routes.rb index c62bfd34..92461d55 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Rails.application.routes.draw do mount Decidim::Core::Engine => '/' # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html diff --git a/config/spring.rb b/config/spring.rb index 9fa7863f..c5933e49 100644 --- a/config/spring.rb +++ b/config/spring.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + %w[ .ruby-version .rbenv-vars diff --git a/db/seeds.rb b/db/seeds.rb index 4d3602ea..a60983d4 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,3 +1,5 @@ +# 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). # diff --git a/docker-compose-build.yml b/docker-compose-build.yml index be507bbf..31b99ee7 100644 --- a/docker-compose-build.yml +++ b/docker-compose-build.yml @@ -26,6 +26,11 @@ services: - RAILS_SERVE_STATIC_FILES=yes - SECRET_KEY_BASE=TEST - SENTRY_CURRENT_ENV=production + depends_on: + - pg + - cache + - mail + - worker pg: image: postgres environment: diff --git a/docker-compose.yml b/docker-compose.yml index 6e1ce47a..2a5223e9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,6 +21,7 @@ services: - RAILS_DB_HOST=pg - RAILS_ENV=development - RAILS_MEMCACHED_HOST=cache + - SKIP_MEMCACHE_CHECK=true - RAILS_MAIL_DELIVERY_CONFIG=address:mail,port:1025 #- RAILS_DB_NAME=decidim_zuerich_production ports: diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb index d19212ab..652febbd 100644 --- a/test/application_system_test_case.rb +++ b/test/application_system_test_case.rb @@ -1,4 +1,6 @@ -require "test_helper" +# frozen_string_literal: true + +require 'test_helper' class ApplicationSystemTestCase < ActionDispatch::SystemTestCase driven_by :selenium, using: :chrome, screen_size: [1400, 1400] diff --git a/test/controllers/status_controller_test.rb b/test/controllers/status_controller_test.rb index a1af052f..9cc56c3e 100644 --- a/test/controllers/status_controller_test.rb +++ b/test/controllers/status_controller_test.rb @@ -1,9 +1,10 @@ +# frozen_string_literal: true + # Copyright (c) 2006-2017, Puzzle ITC GmbH. This file is part of # PuzzleTime and licensed under the Affero General Public License version 3 # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. - require 'test_helper' class StatusControllerTest < ActionController::TestCase @@ -11,7 +12,7 @@ def test_health endpoint_test :health end -def test_readiness + def test_readiness endpoint_test :readiness end diff --git a/test/test_helper.rb b/test/test_helper.rb index 3ab84e3d..2ee518e8 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + ENV['RAILS_ENV'] ||= 'test' require_relative '../config/environment' require 'rails/test_help'