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

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
include Concerns::CollectionScope
include CollectionScope
def index
render json: search_scope

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -2,7 +2,7 @@
# 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.
class OrdersController < ApplicationController
include Concerns::SendOrderPdf
include SendOrderPdf
before_action :authenticate_pickups_or_orders
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
def header

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -9,7 +9,7 @@ Bundler.require(*Rails.groups)
module Foodsoft
class Application < Rails::Application
# 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.
# 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.autoloader = :zeitwerk
#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..."
Article.find(:all).each do |article|
price = article.current_price
article.update_attributes!(:clear_price => price.clear_price,
article.update!(:clear_price => price.clear_price,
:gross_price => price.gross_price,
:tax => price.tax,
:refund => price.refund,

View file

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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,5 @@
class PrinterJobsController < ApplicationController
include Concerns::SendOrderPdf
include SendOrderPdf
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
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]
expect(error_array).to include([:name, "name is already taken"])
expect(error_array).to include(ActiveModel::Error)
expect(response).to have_http_status(:success)
end