start on install generator
This commit is contained in:
parent
924eb6317c
commit
6a9e2182aa
@ -1,9 +0,0 @@
|
||||
require "rails/generators"
|
||||
|
||||
module Merged
|
||||
module Generators
|
||||
class InstallGenerator < Rails::Generators::Base
|
||||
source_root File.expand_path("templates", __dir__)
|
||||
end
|
||||
end
|
||||
end
|
18
lib/generators/merged/install/install_generator.rb
Normal file
18
lib/generators/merged/install/install_generator.rb
Normal file
@ -0,0 +1,18 @@
|
||||
require "merged"
|
||||
require "rails/generators"
|
||||
|
||||
module Merged
|
||||
class InstallGenerator < Rails::Generators::Base
|
||||
source_root File.expand_path("templates", __dir__)
|
||||
|
||||
def install
|
||||
[:card_styles, :option_definitions, :page_styles , :section_styles,
|
||||
:cards, :sections , :pages].each do |file|
|
||||
copy_file "empty.yml", "merged/#{file}.yml"
|
||||
end
|
||||
empty_directory Merged::Image.asset_root
|
||||
empty_directory Merged.data_dir + "/merged"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
1
lib/generators/merged/install/templates/empty.yml
Normal file
1
lib/generators/merged/install/templates/empty.yml
Normal file
@ -0,0 +1 @@
|
||||
---[]
|
9
lib/generators/merged/install/templates/initializer.rb
Normal file
9
lib/generators/merged/install/templates/initializer.rb
Normal file
@ -0,0 +1,9 @@
|
||||
require "merged"
|
||||
|
||||
# directory inside /app/assets/images where the images are kept
|
||||
Merged.images_dir = "cms"
|
||||
|
||||
# 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 = "."
|
@ -1,17 +1,17 @@
|
||||
require "merged/version"
|
||||
require "merged/engine"
|
||||
require "generators/install/install_generator"
|
||||
require "generators/merged/install/install_generator"
|
||||
require "generators/merged/update/update_generator"
|
||||
|
||||
module Merged
|
||||
|
||||
# Directory inside the app/assets/images
|
||||
mattr_accessor :image_path
|
||||
@@image_path = "cms"
|
||||
mattr_accessor :images_dir
|
||||
@@images_dir = "cms"
|
||||
|
||||
# directory in root to store data
|
||||
mattr_accessor :data_path
|
||||
@@image_path = "merged"
|
||||
mattr_accessor :data_dir
|
||||
@@data_dir = "."
|
||||
|
||||
def self.load_data
|
||||
# pre-load data
|
||||
|
Loading…
Reference in New Issue
Block a user