Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

209587Update to use seeds.d and plugin assets. #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added db/seeds.d/.gitkeep
Empty file.
28 changes: 10 additions & 18 deletions lib/foreman_plugin_template/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,17 @@ class Engine < ::Rails::Engine
end
end

# Precompile any JS or CSS files under app/assets/
# If requiring files from each other, list them explicitly here to avoid precompiling the same
# content twice.
assets_to_precompile =
Dir.chdir(root) do
Dir['app/assets/javascripts/**/*', 'app/assets/stylesheets/**/*'].map do |f|
f.split(File::SEPARATOR, 4).last
end
end
initializer 'foreman_plugin_template.assets.precompile' do |app|
app.config.assets.precompile += assets_to_precompile
end
initializer 'foreman_plugin_template.configure_assets', group: :assets do
# Precompile any JS or CSS files under app/assets/
# If requiring files from each other, list them explicitly here to avoid precompiling the same
# content twice.
assets_to_precompile =
Dir.chdir(root) do
Dir['app/assets/javascripts/**/*', 'app/assets/stylesheets/**/*'].map do |f|
f.split(File::SEPARATOR, 4).last
end
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this was required if you were using rake assets:precompile to recompile the whole application. SETTINGS is enough if you're just using the plugin-specific asset precompilation, but for say, a source install with plugins then they'd do everything.

SETTINGS[:foreman_plugin_template] = { assets: { precompile: assets_to_precompile } }
end

Expand All @@ -64,12 +62,6 @@ class Engine < ::Rails::Engine
end
end

rake_tasks do
Rake::Task['db:seed'].enhance do
ForemanPluginTemplate::Engine.load_seed
end
end

initializer 'foreman_plugin_template.register_gettext', after: :load_config_initializers do |_app|
locale_dir = File.join(File.expand_path('../../..', __FILE__), 'locale')
locale_domain = 'foreman_plugin_template'
Expand Down