no preloading so generator can run
This commit is contained in:
parent
df67ed16b5
commit
ec96ed0162
11
config/initializers/merged.rb
Normal file
11
config/initializers/merged.rb
Normal 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 = "."
|
@ -8,6 +8,5 @@ Example:
|
|||||||
This will create:
|
This will create:
|
||||||
/merged directory for your data
|
/merged directory for your data
|
||||||
/merged/*yml empty data files
|
/merged/*yml empty data files
|
||||||
/app/assets/images/cms for your images
|
/app/assets/images/merged for your images
|
||||||
/app/assets/stylesheets/merged/tailwind_extra.css
|
/config/initializers/merged.rb
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ module Merged
|
|||||||
:cards, :sections , :pages].each do |file|
|
:cards, :sections , :pages].each do |file|
|
||||||
copy_file "empty.yml", "merged/#{file}.yml"
|
copy_file "empty.yml", "merged/#{file}.yml"
|
||||||
end
|
end
|
||||||
|
copy_file "initializer.rb", "config/initializers/merged.rb"
|
||||||
empty_directory Merged::Image.asset_root
|
empty_directory Merged::Image.asset_root
|
||||||
empty_directory Merged.data_dir + "/merged"
|
empty_directory Merged.data_dir + "/merged"
|
||||||
end
|
end
|
||||||
|
@ -7,8 +7,8 @@ module Merged
|
|||||||
|
|
||||||
# Directory inside the app/assets/images
|
# Directory inside the app/assets/images
|
||||||
mattr_accessor :images_dir
|
mattr_accessor :images_dir
|
||||||
|
@@images_dir = "merged"
|
||||||
# directory in root to store data
|
# directory in root to store data
|
||||||
mattr_accessor :data_dir
|
mattr_accessor :data_dir
|
||||||
|
@@data_dir = "."
|
||||||
end
|
end
|
||||||
|
@ -20,7 +20,6 @@ module Merged
|
|||||||
|
|
||||||
initializer "after_initialize" do |app|
|
initializer "after_initialize" do |app|
|
||||||
ActiveSupport::Reloader.to_prepare do
|
ActiveSupport::Reloader.to_prepare do
|
||||||
Merged::Engine.load_data
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -32,17 +31,6 @@ module Merged
|
|||||||
config.assets.precompile << kid
|
config.assets.precompile << kid
|
||||||
end
|
end
|
||||||
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
|
||||||
end
|
end
|
||||||
|
1
test/dummy/merged/card_styles.yml
Normal file
1
test/dummy/merged/card_styles.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
--- []
|
1
test/dummy/merged/page_styles.yml
Normal file
1
test/dummy/merged/page_styles.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
--- []
|
1
test/dummy/merged/section_styles.yml
Normal file
1
test/dummy/merged/section_styles.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
--- []
|
Loading…
x
Reference in New Issue
Block a user