Skip to content
Merged
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
13 changes: 12 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,18 @@ if File.exist?("/.packages.initrd") || `mount`.match?(/^[\w]+ on \/ type overlay

puts "Installing the Web frontend..."
Dir.chdir("web") do
sh "NODE_ENV=production make install"
node_env = ENV["NODE_ENV"] || "production"
sh "NODE_ENV=#{node_env.shellescape} make install"

# clean up the extra files when switching the development/production mode
if node_env == "production"
# remove the uncompressed and development files
FileUtils.rm_f(Dir.glob("/usr/share/cockpit/d-installer/index.{css,html,js}"))
FileUtils.rm_f(Dir.glob("/usr/share/cockpit/d-installer/*.map"))
else
# remove the compressed files
FileUtils.rm_f(Dir.glob("/usr/share/cockpit/d-installer/*.gz"))
end
Comment on lines +121 to +129
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NP: Why not just removing the full content before running the make install?

Anyway, it looks good, thanks.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If make install failed you would have empty directory, i.e. no d-installer at all, this is safer.

end
end
end