no preloading so generator can run

This commit is contained in:
Torsten 2023-01-27 19:21:19 +02:00
parent df67ed16b5
commit ec96ed0162
8 changed files with 19 additions and 17 deletions

View File

@ -0,0 +1,11 @@
require "merged"
# directory inside /app/assets/images where YOUR images are kept
# if you change this and add own styles, you will still need a merged directory
# for the previews (card_preview and section_preview)
Merged.images_dir = "merged"
# directory where data and styles are kept
# Notice that the data is ALWAYS inside a merged directory,
# so in the default case Rails.root/merged/*.yml
Merged.data_dir = "."

View File

@ -8,6 +8,5 @@ Example:
This will create:
/merged directory for your data
/merged/*yml empty data files
/app/assets/images/cms for your images
/app/assets/stylesheets/merged/tailwind_extra.css
/app/assets/images/merged for your images
/config/initializers/merged.rb

View File

@ -10,6 +10,7 @@ module Merged
:cards, :sections , :pages].each do |file|
copy_file "empty.yml", "merged/#{file}.yml"
end
copy_file "initializer.rb", "config/initializers/merged.rb"
empty_directory Merged::Image.asset_root
empty_directory Merged.data_dir + "/merged"
end

View File

@ -7,8 +7,8 @@ module Merged
# Directory inside the app/assets/images
mattr_accessor :images_dir
@@images_dir = "merged"
# directory in root to store data
mattr_accessor :data_dir
@@data_dir = "."
end

View File

@ -20,7 +20,6 @@ module Merged
initializer "after_initialize" do |app|
ActiveSupport::Reloader.to_prepare do
Merged::Engine.load_data
end
end
@ -32,17 +31,6 @@ module Merged
config.assets.precompile << kid
end
end
def self.load_data
# pre-load data
[OptionDefinition, CardStyle, SectionStyle , PageStyle,
Card , Section , Page , Image].each {|clazz| clazz.all }
end
def self.load_from( kind , path )
return unless File.exists?(path)
clazz = "Merged::#{kind.camelcase}".constantize
clazz.load(YAML.load_file( path ))
end
end
end

View File

@ -0,0 +1 @@
--- []

View File

@ -0,0 +1 @@
--- []

View File

@ -0,0 +1 @@
--- []