Fix autoloading issues [SCI-3881]

This commit is contained in:
Oleksii Kriuchykhin 2019-09-17 10:50:01 +02:00
parent 06dd43344f
commit e12cd0ae9d
18 changed files with 19 additions and 20 deletions

View file

@ -12,9 +12,8 @@ class Reports::Docx
include RepositoryDatatableHelper
Dir[File.join(File.dirname(__FILE__), 'docx') + '**/*.rb'].each do |file|
require file
include_module = File.basename(file).gsub('.rb', '').split('_').map(&:capitalize).join
include include_module.constantize
include "Reports::Docx::#{include_module}".constantize
end
def initialize(json, docx, options)

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
module DrawExperiment
module Reports::Docx::DrawExperiment
def draw_experiment(subject)
color = @color
link_style = @link_style

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
module DrawMyModule
module Reports::Docx::DrawMyModule
def draw_my_module(subject)
color = @color
link_style = @link_style

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
module DrawMyModuleActivity
module Reports::Docx::DrawMyModuleActivity
def draw_my_module_activity(subject)
my_module = MyModule.find_by_id(subject['id']['my_module_id'])
return unless my_module

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
module DrawMyModuleProtocol
module Reports::Docx::DrawMyModuleProtocol
def draw_my_module_protocol(subject)
my_module = MyModule.find_by_id(subject['id']['my_module_id'])
return unless my_module

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
module DrawMyModuleRepository
module Reports::Docx::DrawMyModuleRepository
def draw_my_module_repository(subject)
my_module = MyModule.find_by_id(subject['id']['my_module_id'])
return unless my_module

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
module DrawProjectHeader
module Reports::Docx::DrawProjectHeader
def draw_project_header(subject)
project = Project.find_by_id(subject['id']['project_id'])
return unless project

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
module DrawResultAsset
module Reports::Docx::DrawResultAsset
def draw_result_asset(subject)
result = Result.find_by_id(subject['id']['result_id'])
return unless result

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
module DrawResultComments
module Reports::Docx::DrawResultComments
def draw_result_comments(subject)
result = Result.find_by_id(subject['id']['result_id'])
return unless result

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
module DrawResultTable
module Reports::Docx::DrawResultTable
def draw_result_table(subject)
result = Result.find_by_id(subject['id']['result_id'])
return unless result

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
module DrawResultText
module Reports::Docx::DrawResultText
def draw_result_text(subject)
result = Result.find_by_id(subject['id']['result_id'])
return unless result

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
module DrawStep
module Reports::Docx::DrawStep
def draw_step(subject)
color = @color
step = Step.find_by_id(subject['id']['step_id'])

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
module DrawStepAsset
module Reports::Docx::DrawStepAsset
def draw_step_asset(subject)
asset = Asset.find_by_id(subject['id']['asset_id'])
return unless asset

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
module DrawStepChecklist
module Reports::Docx::DrawStepChecklist
def draw_step_checklist(subject)
team = @report_team
user = @user

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
module DrawStepComments
module Reports::Docx::DrawStepComments
def draw_step_comments(subject)
step = Step.find_by_id(subject['id']['step_id'])
return unless step

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
module DrawStepTable
module Reports::Docx::DrawStepTable
def draw_step_table(subject)
table = Table.find_by_id(subject['id']['table_id'])
return unless table

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
module PrivateMethods
module Reports::Docx::PrivateMethods
private
# RTE fields support

View file

@ -9,9 +9,9 @@ Bundler.require(*Rails.groups)
module Scinote
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 6.0
config.load_defaults 5.2
config.add_autoload_paths_to_load_path = false
# config.add_autoload_paths_to_load_path = false
config.active_record.schema_format = :sql