Move precompilation task to Rakefile

This commit is contained in:
Dawa Ometto
2018-12-10 19:50:49 +01:00
parent 4e2b1442bd
commit 8f6c19b3fd
2 changed files with 20 additions and 17 deletions
-17
View File
@@ -104,9 +104,6 @@ MSG
opts.on("--assets [PATH]", "Set the path to look for static assets. Only used if --static is set to true, or environment is production/staging. Default: ./public/assets") do |path|
wiki_options[:static_assets_path] = path
end
opts.on("--precompile-assets [PATH]", "Precompile static assets to PATH.") do |path|
options[:precompile] = path || './public/assets'
end
opts.on("--css", "Inject custom CSS into each page. The '<git-repo>/custom.css' file is used (must be committed).") do
wiki_options[:css] = true
end
@@ -262,20 +259,6 @@ if options[:irb]
puts "Invalid Gollum wiki at #{File.expand_path(gollum_path).inspect}"
exit 0
end
elsif options[:precompile]
require 'gollum/app'
env = Precious::Assets.sprockets
manifest = Sprockets::Manifest.new(env, options[:precompile])
Sprockets::Helpers.configure do |config|
config.environment = env
config.environment.context_class.class_variable_set(:@@base_url, wiki_options[:base_path])
config.prefix = "#{wiki_options[:base_path]}/#{Precious::Assets::ASSET_URL}"
config.digest = true
config.public_path = options[:precompile]
config.manifest = manifest
end
puts "Precompiling assets to #{::File.expand_path(options[:precompile])}..."
manifest.compile(Precious::Assets::MANIFEST)
else
require 'gollum/app'
Precious::App.set(:gollum_path, gollum_path)