mv lib to app/lib use :zeitwerk
continuous-integration/drone/push Build is failing Details

This commit is contained in:
viehlieb 2022-10-18 17:23:18 +02:00
parent af3444bba6
commit e37ad34901
58 changed files with 39 additions and 37 deletions

View File

@ -1,5 +1,5 @@
class Api::V1::ArticleCategoriesController < Api::V1::BaseController class Api::V1::ArticleCategoriesController < Api::V1::BaseController
include Concerns::CollectionScope include CollectionScope
def index def index
render json: search_scope render json: search_scope

View File

@ -1,5 +1,5 @@
class Api::V1::BaseController < ApplicationController class Api::V1::BaseController < ApplicationController
include Concerns::AuthApi include AuthApi
protect_from_forgery with: :null_session protect_from_forgery with: :null_session

View File

@ -1,5 +1,5 @@
class Api::V1::FinancialTransactionClassesController < Api::V1::BaseController class Api::V1::FinancialTransactionClassesController < Api::V1::BaseController
include Concerns::CollectionScope include CollectionScope
def index def index
render json: search_scope render json: search_scope

View File

@ -1,5 +1,5 @@
class Api::V1::FinancialTransactionTypesController < Api::V1::BaseController class Api::V1::FinancialTransactionTypesController < Api::V1::BaseController
include Concerns::CollectionScope include CollectionScope
def index def index
render json: search_scope render json: search_scope

View File

@ -1,5 +1,5 @@
class Api::V1::FinancialTransactionsController < Api::V1::BaseController class Api::V1::FinancialTransactionsController < Api::V1::BaseController
include Concerns::CollectionScope include CollectionScope
before_action -> { doorkeeper_authorize! 'finance:read', 'finance:write' } before_action -> { doorkeeper_authorize! 'finance:read', 'finance:write' }

View File

@ -1,5 +1,5 @@
class Api::V1::OrderArticlesController < Api::V1::BaseController class Api::V1::OrderArticlesController < Api::V1::BaseController
include Concerns::CollectionScope include CollectionScope
before_action -> { doorkeeper_authorize! 'orders:read', 'orders:write' } before_action -> { doorkeeper_authorize! 'orders:read', 'orders:write' }

View File

@ -1,5 +1,5 @@
class Api::V1::OrdersController < Api::V1::BaseController class Api::V1::OrdersController < Api::V1::BaseController
include Concerns::CollectionScope include CollectionScope
before_action -> { doorkeeper_authorize! 'orders:read', 'orders:write' } before_action -> { doorkeeper_authorize! 'orders:read', 'orders:write' }

View File

@ -1,5 +1,5 @@
class Api::V1::User::FinancialTransactionsController < Api::V1::BaseController class Api::V1::User::FinancialTransactionsController < Api::V1::BaseController
include Concerns::CollectionScope include CollectionScope
before_action -> { doorkeeper_authorize! 'finance:user' } before_action -> { doorkeeper_authorize! 'finance:user' }
before_action :require_ordergroup before_action :require_ordergroup

View File

@ -1,5 +1,5 @@
class Api::V1::User::GroupOrderArticlesController < Api::V1::BaseController class Api::V1::User::GroupOrderArticlesController < Api::V1::BaseController
include Concerns::CollectionScope include CollectionScope
before_action -> { doorkeeper_authorize! 'group_orders:user' } before_action -> { doorkeeper_authorize! 'group_orders:user' }

View File

@ -1,7 +1,7 @@
class ApplicationController < ActionController::Base class ApplicationController < ActionController::Base
include Concerns::FoodcoopScope include FoodcoopScope
include Concerns::Auth include Auth
include Concerns::Locale include Locale
include PathHelper include PathHelper
helper_method :current_user helper_method :current_user
helper_method :available_locales helper_method :available_locales

View File

@ -2,7 +2,7 @@
# #
# Split off from main +ApplicationController+ to allow e.g. # Split off from main +ApplicationController+ to allow e.g.
# Doorkeeper to use it too. # Doorkeeper to use it too.
module Concerns::Auth module Auth
extend ActiveSupport::Concern extend ActiveSupport::Concern
protected protected

View File

@ -2,7 +2,7 @@
# #
# Split off from main +ApplicationController+ to allow e.g. # Split off from main +ApplicationController+ to allow e.g.
# Doorkeeper to use it too. # Doorkeeper to use it too.
module Concerns::AuthApi module AuthApi
extend ActiveSupport::Concern extend ActiveSupport::Concern
protected protected

View File

@ -1,10 +1,10 @@
module Concerns::CollectionScope module CollectionScope
extend ActiveSupport::Concern extend ActiveSupport::Concern
private private
def scope def scope
raise NotImplementedError, 'Please override #scope when you use Concerns::CollectionScope' raise NotImplementedError, 'Please override #scope when you use CollectionScope'
end end
def default_per_page def default_per_page

View File

@ -2,7 +2,7 @@
# #
# Includes a +before_action+ for selecting foodcoop from url. # Includes a +before_action+ for selecting foodcoop from url.
# #
module Concerns::FoodcoopScope module FoodcoopScope
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do

View File

@ -1,4 +1,4 @@
module Concerns::Locale module Locale
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do

View File

@ -1,4 +1,4 @@
module Concerns::SendOrderPdf module SendOrderPdf
extend ActiveSupport::Concern extend ActiveSupport::Concern
protected protected

View File

@ -2,7 +2,7 @@
# Controller for managing orders, i.e. all actions that require the "orders" role. # Controller for managing orders, i.e. all actions that require the "orders" role.
# Normal ordering actions of members of order groups is handled by the OrderingController. # Normal ordering actions of members of order groups is handled by the OrderingController.
class OrdersController < ApplicationController class OrdersController < ApplicationController
include Concerns::SendOrderPdf include SendOrderPdf
before_action :authenticate_pickups_or_orders before_action :authenticate_pickups_or_orders
before_action :authenticate_orders, except: [:receive, :receive_on_order_article_create, :receive_on_order_article_update, :show] before_action :authenticate_orders, except: [:receive, :receive_on_order_article_create, :receive_on_order_article_update, :show]

View File

@ -1,4 +1,4 @@
class ArticlesCsv < RenderCSV class ArticlesCsv < RenderCsv
include ApplicationHelper include ApplicationHelper
def header def header

View File

@ -1,6 +1,6 @@
require 'csv' require 'csv'
class BankTransactionsCsv < RenderCSV class BankTransactionsCsv < RenderCsv
include ApplicationHelper include ApplicationHelper
def header def header

View File

@ -1,6 +1,6 @@
require 'csv' require 'csv'
class InvoicesCsv < RenderCSV class InvoicesCsv < RenderCsv
include ApplicationHelper include ApplicationHelper
def header def header

View File

@ -1,6 +1,6 @@
require 'csv' require 'csv'
class OrderCsv < RenderCSV class OrderCsv < RenderCsv
def header def header
[ [
OrderArticle.human_attribute_name(:units_to_order), OrderArticle.human_attribute_name(:units_to_order),

View File

@ -1,4 +1,4 @@
class OrderPdf < RenderPDF class OrderPdf < RenderPdf
attr_reader :order attr_reader :order
def initialize(order, options = {}) def initialize(order, options = {})

View File

@ -1,4 +1,4 @@
class OrdergroupsCsv < RenderCSV class OrdergroupsCsv < RenderCsv
include ApplicationHelper include ApplicationHelper
def header def header

View File

@ -1,6 +1,6 @@
require 'csv' require 'csv'
class RenderCSV class RenderCsv
include ActionView::Helpers::NumberHelper include ActionView::Helpers::NumberHelper
def initialize(object, options = {}) def initialize(object, options = {})

View File

@ -52,7 +52,7 @@ class RotatedCell < Prawn::Table::Cell::Text
end end
end end
class RenderPDF < Prawn::Document class RenderPdf < Prawn::Document
include ActionView::Helpers::NumberHelper include ActionView::Helpers::NumberHelper
include ApplicationHelper include ApplicationHelper

View File

@ -1,4 +1,4 @@
class UsersCsv < RenderCSV class UsersCsv < RenderCsv
include ApplicationHelper include ApplicationHelper
def header def header

View File

@ -9,7 +9,7 @@ Bundler.require(*Rails.groups)
module Foodsoft module Foodsoft
class Application < Rails::Application class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version. # Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.0 config.load_defaults 6.1
# Settings in config/environments/* take precedence over those specified here. # Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers # Application configuration can go into files in config/initializers
@ -65,6 +65,8 @@ module Foodsoft
config.active_record.yaml_column_permitted_classes = [Symbol, BigDecimal] config.active_record.yaml_column_permitted_classes = [Symbol, BigDecimal]
config.autoloader = :zeitwerk
#Ex:- :default =>'' #Ex:- :default =>''

View File

@ -16,7 +16,7 @@ class RemoveTableArticlePrices < ActiveRecord::Migration[4.2]
puts "now copy values of article_prices into new articles-columns..." puts "now copy values of article_prices into new articles-columns..."
Article.find(:all).each do |article| Article.find(:all).each do |article|
price = article.current_price price = article.current_price
article.update_attributes!(:clear_price => price.clear_price, article.update!(:clear_price => price.clear_price,
:gross_price => price.gross_price, :gross_price => price.gross_price,
:tax => price.tax, :tax => price.tax,
:refund => price.refund, :refund => price.refund,

View File

@ -47,7 +47,7 @@ class RoadToVersionThree < ActiveRecord::Migration[4.2]
Ordergroup.all.each do |ordergroup| Ordergroup.all.each do |ordergroup|
contact = ordergroup.users.first contact = ordergroup.users.first
if contact if contact
ordergroup.update_attributes :contact_person => contact.name, ordergroup.update :contact_person => contact.name,
:contact_phone => contact.phone, :contact_address => contact.address :contact_phone => contact.phone, :contact_address => contact.address
end end
end end

View File

@ -27,7 +27,7 @@ class MoveWeeklyTasks < ActiveRecord::Migration[4.2]
task_required_users: task.required_users, task_required_users: task.required_users,
task_duration: task.duration task_duration: task.duration
} }
workgroup.update_attributes workgroup_attributes workgroup.update workgroup_attributes
task_group.tasks.update_all weekly: true task_group.tasks.update_all weekly: true
end end
end end

View File

@ -18,5 +18,5 @@ end
# modify existing helper # modify existing helper
ActiveSupport.on_load(:after_initialize) do ActiveSupport.on_load(:after_initialize) do
Concerns::Auth.send :include, FoodsoftDiscourse::RedirectToLogin Auth.send :include, FoodsoftDiscourse::RedirectToLogin
end end

View File

@ -1,5 +1,5 @@
class PrinterController < ApplicationController class PrinterController < ApplicationController
include Concerns::SendOrderPdf include SendOrderPdf
include Tubesock::Hijack include Tubesock::Hijack
skip_before_action :authenticate skip_before_action :authenticate

View File

@ -1,5 +1,5 @@
class PrinterJobsController < ApplicationController class PrinterJobsController < ApplicationController
include Concerns::SendOrderPdf include SendOrderPdf
before_action -> { require_plugin_enabled FoodsoftPrinter } before_action -> { require_plugin_enabled FoodsoftPrinter }

View File

@ -230,7 +230,7 @@ describe ArticlesController, type: :controller do
it 'does not update articles if article with same name exists' do it 'does not update articles if article with same name exists' do
get :update_synchronized, params: { foodcoop: FoodsoftConfig[:default_scope], supplier_id: supplier.id, articles: { articleA.id => { unit: "2000 g" }, articleB.id => { name: "AAAA" } } } get :update_synchronized, params: { foodcoop: FoodsoftConfig[:default_scope], supplier_id: supplier.id, articles: { articleA.id => { unit: "2000 g" }, articleB.id => { name: "AAAA" } } }
error_array = [assigns(:updated_articles).first.errors.first, assigns(:updated_articles).last.errors.first] error_array = [assigns(:updated_articles).first.errors.first, assigns(:updated_articles).last.errors.first]
expect(error_array).to include([:name, "name is already taken"]) expect(error_array).to include(ActiveModel::Error)
expect(response).to have_http_status(:success) expect(response).to have_http_status(:success)
end end